summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Views/InstantView.xaml
blob: bb9bc1971da282bc2accfcffcffe6c806db4c34e (plain)
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<UserControl x:Class="HandBrakeWPF.Views.InstantView"
             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:controls="clr-namespace:HandBrakeWPF.Controls"
             xmlns:converters="clr-namespace:HandBrakeWPF.Converters"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             mc:Ignorable="d" 
             cal:Message.Attach="[Event Loaded] = [Action Load]"
             >

    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Drop">
            <cal:ActionMessage MethodName="FilesDroppedOnWindow">
                <cal:Parameter Value="$eventArgs" />
            </cal:ActionMessage>
        </i:EventTrigger>
    </i:Interaction.Triggers>

    <UserControl.Resources>
        <converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
    </UserControl.Resources>

    <!-- Window Body -->
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>


        <!-- Source -->
        <StackPanel Orientation="Vertical" Grid.Row="0">
            <!--  Source  -->
            <StackPanel Margin="10,5,5,5"
                            HorizontalAlignment="Stretch"
                            VerticalAlignment="Stretch"
                            >
                <StackPanel Orientation="Horizontal">
                    <Label Content="Source" FontWeight="Bold" />
                </StackPanel>

                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="8,10,0,10">

                    <TextBlock Text="Drag and Drop a file  - OR - Open a " />
                    <Button cal:Message.Attach="[Event Click] = [Action FileScan]" Padding="8,2">
                        File
                    </Button>
                    <TextBlock Text="- OR -" FontWeight="Bold" Margin="10,0,10,0" />
                    <Button cal:Message.Attach="[Event Click] = [Action FolderScan]" Padding="8,2">
                        Folder
                    </Button>

                </StackPanel>

                <ListBox Grid.Row="2"
                 Margin="10,10,10,10"
                         MinHeight="150" MaxHeight="150"
                 VerticalAlignment="Stretch"
                 Background="LightGray"
                 ItemsSource="{Binding TitleList}"
                 SelectionMode="Single">
                    <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.ContextMenu>
                        <ContextMenu>
                            <MenuItem Header="Select All" cal:Message.Attach="[Event Click] = [Action SelectAll]" />
                            <MenuItem Header="Deselect All" cal:Message.Attach="[Event Click] = [Action UnSelectAll]" />
                            <Separator />
                            <MenuItem Header="Order by Title" IsChecked="{Binding OrderedByTitle}" cal:Message.Attach="[Event Click] = [Action OrderByTitle]" />
                            <MenuItem Header="Order by Duration" IsChecked="{Binding OrderedByDuration}" cal:Message.Attach="[Event Click] = [Action OrderByDuration]" />
                        </ContextMenu>
                    </ListBox.ContextMenu>

                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid HorizontalAlignment="Stretch" MinHeight="28">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>

                                <CheckBox IsChecked="{Binding IsSelected}" Grid.RowSpan="2" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" />

                                <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" Margin="10,0,0,0" >
                                    <TextBlock Text="Title:" Margin="0,0,5,0" FontWeight="Bold" />
                                    <TextBlock Text="{Binding Title}" Margin="5,0,5,0" />
                                </StackPanel>

                                <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" Margin="10,0,0,0" >
                                    <TextBlock Text="Source:" Margin="0,0,5,0" FontWeight="Bold" />
                                    <TextBlock Text="{Binding SourceName}" Margin="5,0,5,0" />
                                </StackPanel>
                            </Grid>

                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
        </StackPanel>


        <!-- Destination -->
        <StackPanel Grid.Row="1"
                        Margin="10,5,5,5"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        >
            <Label Content="Destination" FontWeight="Bold" />
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Label Margin="8,0,0,0" Content="File" />
                <TextBox Name="Destination"
                             Grid.Column="1"
                             Margin="8,0,0,0"
                             Text="{Binding OutputDirectory,
                                            UpdateSourceTrigger=PropertyChanged}"
                             />
                <Button Name="DestinationBrowser"
                            Grid.Column="2"
                            Margin="8,0,5,0"
                        Padding="8,2"
                            Content="Browse"
                            cal:Message.Attach="[Event Click] = [Action BrowseDestination]"
                            />
            </Grid>
        </StackPanel>

        <!-- Opitons -->
        <StackPanel Grid.Row="2"
                        Margin="10,5,5,5"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        >
            <Label Content="Options" FontWeight="Bold" />

            <StackPanel Orientation="Horizontal" Margin="8,0,0,0">
                <TextBlock Text="Preset:" Margin="0,0,5,0" />
                <ComboBox ItemsSource="{Binding Presets}" SelectedItem="{Binding SelectedPreset}" MinWidth="150" />
            </StackPanel>

        </StackPanel>


        <!-- Buttons and Queueing -->
        <Grid Grid.Row="3" Margin="10,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Label Content="Start" FontWeight="Bold" Grid.Row="0" />
            <Button Content="Start Encoding" cal:Message.Attach="[Event Click] = [Action StartEncode]"  FontWeight="Bold" Grid.Row="1" Padding="8,2" HorizontalAlignment="Center"
                    Visibility="{Binding IsEncoding, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
            <Button Content="Stop Encoding" cal:Message.Attach="[Event Click] = [Action StopEncode]"  FontWeight="Bold" Grid.Row="1" Padding="8,2" HorizontalAlignment="Center" 
                    Visibility="{Binding IsEncoding, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
        </Grid>


        <!--  StatusPanel  -->
        <controls:StatusPanel x:Name="loadingPanel"
                              Grid.Row="3"
                              Grid.RowSpan="2"
                              Height="70"
                              VerticalAlignment="Bottom"
                              Panel.ZIndex="10"
                              IsLoading="{Binding ShowStatusWindow}"
                              Message="{Binding StatusLabel}"
                              SubMessage="Please Wait ..."
                              />

        <!--  Status Bar  -->
        <StatusBar Grid.Row="4" Grid.ColumnSpan="2" MinHeight="32" >

            <ProgressBar Value="{Binding ProgressPercentage}" Visibility="{Binding IsEncoding, Converter={StaticResource boolToVisConverter}}"
                         Width="100" Height="18" VerticalAlignment="Center"/>
            <Label VerticalAlignment="Center"
                   Content="{Binding Path=ProgramStatusLabel}" />

        </StatusBar>

    </Grid>
</UserControl>