-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
150 lines (149 loc) · 10.1 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<Window x:Class="Labs.WPF.TorrentDownload.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:behaviors="clr-namespace:Labs.WPF.Core.Behaviors;assembly=Labs.WPF.Core"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
mc:Ignorable="d"
Height="570" Width="1000" WindowStartupLocation="CenterScreen">
<Window.Resources>
<ControlTemplate x:Key="ToggleButtonControlTemplate1" TargetType="{x:Type ToggleButton}">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Window.Resources>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<i:InvokeCommandAction Command="{Binding LoadedCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<xctk:BusyIndicator IsBusy="{Binding IsBusy}" BusyContent="{Binding BusyContent}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Ribbon Grid.ColumnSpan="5">
<Ribbon.ApplicationMenu>
<RibbonApplicationMenu>
<RibbonApplicationMenuItem Command="{Binding ExitCommand}" Header="Sair"/>
</RibbonApplicationMenu>
</Ribbon.ApplicationMenu>
<RibbonTab Header="Tv Shows">
<RibbonGroup Header="Episodes">
<RibbonButton Command="{Binding UpdateCommand}"
LargeImageSource="/images/refreshicon128x128.png"
Label="Update"
ToolTip="Update Episodes and Series"
ToolTipDescription="Start a full update on episodes and series"/>
<RibbonButton Command="{Binding MarkEpisodeAsDownloadedCommand}" IsEnabled="{Binding SelectedEpisode, FallbackValue=false, Converter={StaticResource NullToBooleanConverter}}"
LargeImageSource="/images/CheckIcon128x128.png"
Label="Set Download"
ToolTip="Mark episode as downloaded"/>
<RibbonButton Command="{Binding StartDownloadCommand}" IsEnabled="{Binding SelectedEpisode, FallbackValue=false, Converter={StaticResource NullToBooleanConverter}}"
LargeImageSource="{Binding SearchAndDownloadButtonImage}"
Label="{Binding SearchAndDownloadButtonLabel}"
ToolTip="Search for torrents links"
ToolTipDescription="Search for torrents links"/>
<RibbonButton Command="{Binding EditEpisodeCommand}" IsEnabled="{Binding SelectedEpisode, FallbackValue=false, Converter={StaticResource NullToBooleanConverter}}"
LargeImageSource="/images/EditIcon128x128.png"
Label="Edit"
ToolTip="Edit selected episode"/>
<RibbonButton Command="{Binding DeleteEpisodeCommand}" IsEnabled="{Binding SelectedEpisode, FallbackValue=false, Converter={StaticResource NullToBooleanConverter}}"
LargeImageSource="/images/RemoveIcon128x128.png"
Label="Remove"
ToolTip="Remove selected episode"/>
</RibbonGroup>
<RibbonGroup Header="Visualization">
<RibbonToggleButton Label="Show Downloaded"
IsChecked="{Binding ShowingDonwloaded}"
LargeImageSource="/images/DownloadedIcon128x128.png"/>
<RibbonToggleButton Label="Future Episodes"
IsChecked="{Binding ShowingFutureEpisodes}"
LargeImageSource="/images/FutureIcon128x128.png"/>
</RibbonGroup>
<RibbonGroup Header="Search">
<RibbonTextBox Label="New Shows:" Text="{Binding SearchTerm, UpdateSourceTrigger=PropertyChanged}" Command="{Binding SearchCommand}" TextBoxWidth="300"/>
</RibbonGroup>
</RibbonTab>
<RibbonTab Header="Subtitles">
<RibbonGroup Header="Actions">
<RibbonButton Command="{Binding SearchFilesCommand}"
LargeImageSource="/images/SearchIcon128x128.png"
Label="Search"
ToolTip="Search tvshow files"/>
</RibbonGroup>
</RibbonTab>
</Ribbon>
<Border BorderThickness="1" BorderBrush="Black" CornerRadius="2" Grid.Row="2" Grid.ColumnSpan="5" Margin="5" >
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="Search Shows:"
Margin="5"/>
<TextBox Text="{Binding SearchExistingItemsTerm, UpdateSourceTrigger=PropertyChanged}"
Grid.Column="1" Margin="5"/>
<TextBlock Text="Group by:" Grid.Column="2" Margin="5"/>
<Button Content="Tv Show Name" Grid.Column="3" Margin="5" Command="{Binding GroupByCommand}" CommandParameter="TvShowName"/>
<Button Content="Reset" Grid.Column="4" Margin="5" Command="{Binding GroupByCommand}"/>
<DataGrid Grid.Row="1" Grid.ColumnSpan="6"
Margin="5"
ItemsSource="{Binding EpisodesViewSource}"
CanUserAddRows="False"
CanUserDeleteRows="False"
AutoGenerateColumns="False"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectedItem="{Binding SelectedEpisode}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction Command="{Binding EditEpisodeCommand}" CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Style.Triggers>
<DataTrigger Binding="{Binding TorrentURI, Converter={StaticResource NullToBooleanConverter}}" Value="false">
<Setter Property="TextElement.Foreground" Value="Black"/>
</DataTrigger>
<DataTrigger Binding="{Binding TorrentURI, Converter={StaticResource NullToBooleanConverter}}" Value="true">
<Setter Property="TextElement.Foreground" Value="Red"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="Tv Show" Binding="{Binding TvShow.Name}" Width="Auto" IsReadOnly="True"/>
<DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="Auto" IsReadOnly="True"/>
<DataGridTextColumn Header="Season" Binding="{Binding Season}" IsReadOnly="True"/>
<DataGridTextColumn Header="Number" Binding="{Binding Number}" IsReadOnly="True"/>
<DataGridTextColumn Header="Aired" Binding="{Binding FirstAired, StringFormat=dd/MM/yyyy}" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
<Border Grid.Row="1" Grid.ColumnSpan="5" Margin="5" CornerRadius="2" BorderThickness="1" BorderBrush="Gray">
<TextBlock HorizontalAlignment="Center" Text="{Binding ErrorMessage}" Foreground="Red" FontWeight="Bold" FontSize="13"/>
</Border>
</Grid>
</xctk:BusyIndicator>
</Window>