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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
<Window x:Class="HandBrakeWPF.Views.QueueView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:cal="http://www.caliburnproject.org"
xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
xmlns:Model="clr-namespace:HandBrake.ApplicationServices.Model;assembly=HandBrake.ApplicationServices"
mc:Ignorable="d" Title="{Binding Title}"
Width="600" Height="400"
Background="#FFF0F0F0">
<Window.Resources>
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
<Converters:FullPathToFileNameConverter x:Key="filePathToFilenameConverter" />
<Converters:EnumComboConverter x:Key="enumComboConverter" />
<Converters:QueueStatusToVisibilityConverter x:Key="queueStatusVisConverter" />
</Window.Resources>
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ToolBar Name="mainToolBar" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SnapsToDevicePixels="False">
<Button Name="Start" cal:Message.Attach="[Event Click] = [Action StartEncode]" Visibility="{Binding IsEncoding, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}">
<StackPanel Orientation="Horizontal">
<Image Source="Images/Play.png" Height="32" Width="32" />
<Label Content="Start" Margin="8,0,0,0" VerticalAlignment="Center" />
</StackPanel>
</Button>
<Button Name="Pause" cal:Message.Attach="[Event Click] = [Action PauseEncode]" Visibility="{Binding IsEncoding, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}">
<StackPanel Orientation="Horizontal">
<Image Source="Images/Pause.png" Height="32" Width="32" />
<Label Content="Pause" Margin="8,0,0,0" VerticalAlignment="Center" />
</StackPanel>
</Button>
</ToolBar>
<StackPanel Grid.Row="1" Margin="10,20,10,20">
<TextBlock Text="{Binding JobsPending}" />
<TextBlock Text="{Binding JobStatus}" />
</StackPanel>
<ListBox Grid.Row="2" ItemsSource="{Binding QueueJobs}" SelectionMode="Extended" Background="LightGray" Margin="10,0,10,10"
dd:DragDrop.IsDragSource="True" dd:DragDrop.IsDropTarget="True"
dd:DragDrop.DropHandler="{Binding}">
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Header="Import Queue" cal:Message.Attach="[Event Click] = [Action Import]" />
<MenuItem Header="Export Queue" cal:Message.Attach="[Event Click] = [Action Export]" />
<Separator />
<MenuItem Header="Clear" cal:Message.Attach="[Event Click] = [Action Clear]" />
<MenuItem Header="Clear Completed" cal:Message.Attach="[Event Click] = [Action ClearCompleted]" />
</ContextMenu>
</ListBox.ContextMenu>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Background" Value="WhiteSmoke" />
<Setter Property="Margin" Value="0,0,0,1" />
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate x:Name="QueueItemTemplate">
<Grid HorizontalAlignment="Stretch" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Marker -->
<Image Width="16" Height="16" Grid.Column="0" Margin="10,0,10,0" >
<Image.Style>
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="Waiting">
<Setter Property="Source" Value="Images\Movies.png"/>
</DataTrigger>
<DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="In Progress">
<Setter Property="Source" Value="Images\Working0.png"/>
</DataTrigger>
<DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="Completed" >
<Setter Property="Source" Value="Images\Complete.png"/>
</DataTrigger>
<DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="Error" >
<Setter Property="Source" Value="Images\WarningSmall.png"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
<!-- Settings -->
<StackPanel Grid.Column="1" HorizontalAlignment="Stretch" Margin="0,5,0,5">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Title: " FontWeight="Bold" />
<TextBlock Text="{Binding Task.Title}"/>
<TextBlock Text="{Binding Task.PointToPointMode}" FontWeight="Bold" Margin="10,0,0,0" />
<TextBlock Text=": " />
<TextBlock Text="{Binding Task.StartPoint}"/>
<TextBlock Text="to" Margin="5,0,5,0" />
<TextBlock Text="{Binding Task.EndPoint}"/>
</StackPanel>
<!-- TODO Support Drive Label Name-->
<StackPanel Orientation="Horizontal">
<TextBlock Text="Source: " FontWeight="Bold" />
<TextBlock Text="{Binding Task.Source, Converter={StaticResource filePathToFilenameConverter}}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Destination: " FontWeight="Bold" />
<TextBlock Text="{Binding Task.Destination, Converter={StaticResource filePathToFilenameConverter}}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Status: " FontWeight="Bold" />
<TextBlock Text="{Binding Status, Converter={StaticResource enumComboConverter}}"/>
</StackPanel>
</StackPanel>
<!-- Delete -->
<Grid VerticalAlignment="Center" Grid.Column="2" Margin="10,0,10,0">
<StackPanel Orientation="Vertical">
<Image Source="Images/Refresh.ico" Width="20" Height="20" ToolTip="Reset job status to Waiting."
Visibility="{Binding Status, Converter={StaticResource queueStatusVisConverter}}" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDown">
<cal:ActionMessage MethodName="RetryJob">
<cal:Parameter Value="{Binding}" />
</cal:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Image>
<Image Source="Images/delete.png" Width="20" Height="20" Margin="0,5,0,0" ToolTip="Remove this Job">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDown">
<cal:ActionMessage MethodName="RemoveJob">
<cal:Parameter Value="{Binding}" />
</cal:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Image>
</StackPanel>
</Grid>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Window>
|