summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Views/QueueView.xaml
blob: c37c88a6a7621cb40f4fc75ebaae6c5fe9dd6d73 (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
<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" mc:Ignorable="d" Title="{Binding Title}" 
             Width="600" Height="400"
             Background="#FFF0F0F0">

    <Window.Resources>
        <Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
    </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">
            <ListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem">
                    <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
                </Style>
            </ListBox.ItemContainerStyle>
            
            <ListBox.ItemTemplate>
                <DataTemplate>

                    <Grid HorizontalAlignment="Stretch">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <!-- Marker -->
                        <Image Source="Images/Movies.png" Width="16" Height="16" Grid.Column="0" Margin="10,0,10,0" />

                        <!-- Settings -->
                        <StackPanel Grid.Column="1" HorizontalAlignment="Stretch">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Source" FontWeight="Bold" />
                                <TextBlock Text="{Binding Source}"/>
                            </StackPanel>

                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Destination" FontWeight="Bold" />
                                <TextBlock Text="{Binding Source}"/>
                            </StackPanel>
                        </StackPanel>

                        <!-- Delete -->
                        <Image Source="Images/delete.png" Width="16" Height="16" Grid.Column="2" Margin="10,0,10,0">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="MouseDown">
                                    <cal:ActionMessage MethodName="RemoveJob">
                                        <cal:Parameter Value="{Binding}" />
                                    </cal:ActionMessage>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </Image>

                    </Grid>


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


    </Grid>
</Window>