-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
128 lines (116 loc) · 7.56 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
<Window x:Class="Gh61.EdgePdfPreviewEnabler.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Gh61.EdgePdfPreviewEnabler"
xmlns:commands="clr-namespace:Gh61.EdgePdfPreviewEnabler.Commands"
xmlns:resx="clr-namespace:Gh61.EdgePdfPreviewEnabler.Localization"
mc:Ignorable="d"
Title="Microsoft Edge PDF Preview Enabler" Height="550" Width="800"
WindowStyle="ToolWindow"
WindowStartupLocation="CenterScreen">
<Window.DataContext>
<local:MainWindowViewModel />
</Window.DataContext>
<Grid Margin="16" Grid.IsSharedSizeScope="True">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Visibility="{Binding NonAdminMessageVisibility}" Margin="0 0 0 8" Padding="6" Background="LightCoral">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="{x:Static resx:Resources.NonAdminMessage}"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="{x:Static resx:Resources.AdminPrivilegeWarning}"/>
<Button Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" Padding="12" Command="{x:Static commands:RestartAsAdminCommand.Instance}">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding AdminShieldBitmapSource}" Margin="0 0 6 0"/>
<TextBlock Text="{Binding RelativeSource={RelativeSource FindAncestor , AncestorType={x:Type Button}}, Path=Command.Text}"/>
</StackPanel>
</Button>
</Grid>
</Border>
<TextBlock Grid.Row="1" Grid.Column="0" Text="{x:Static resx:Resources.InstallationsHeader}" FontSize="16" FontWeight="DemiBold" />
<Button Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" Command="{x:Static commands:RefreshRulesCommand.Instance}" CommandParameter="{Binding DependencyRules}" />
<ItemsControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" BorderBrush="Gray" BorderThickness="1" ItemsSource="{Binding DependencyRules}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="0 2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" SharedSizeGroup="col1" />
<ColumnDefinition Width="Auto" SharedSizeGroup="col2" />
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0" IsChecked="{Binding IsFulfilled, Mode=OneWay}" IsEnabled="False">
<TextBlock Text="{Binding Title, Mode=OneTime}" />
</CheckBox>
<Button Grid.Column="1" Margin="0" Command="{x:Static commands:InstallDependencyRuleCommand.Instance}" CommandParameter="{Binding}" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBlock Grid.Row="3" Grid.Column="0" Text="{x:Static resx:Resources.RegistryHeader}" FontSize="16" FontWeight="DemiBold" />
<StackPanel Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" Orientation="Horizontal">
<Button Command="{x:Static commands:RefreshRulesCommand.Instance}" CommandParameter="{Binding RegistryRules}" />
<Button Command="{x:Static commands:ApplyMultipleRegistryRulesCommand.Instance}" CommandParameter="{Binding RegistryRules}" />
</StackPanel>
<ItemsControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding RegistryRules}" BorderBrush="Gray" BorderThickness="1">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="0 2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" SharedSizeGroup="col1" />
<ColumnDefinition Width="Auto" SharedSizeGroup="col2" />
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0" IsChecked="{Binding IsFulfilled, Mode=OneWay}" IsEnabled="False">
<TextBlock Text="{Binding Title, Mode=OneTime}" />
</CheckBox>
<Button Grid.Column="1" Margin="0" Command="{x:Static commands:ApplyRegistryRuleCommand.Instance}" CommandParameter="{Binding}" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBlock Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" Text="{x:Static resx:Resources.DefaultPdfPreviewerHeader}" Height="26" FontSize="16" FontWeight="DemiBold" />
<Border Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" BorderBrush="Gray" BorderThickness="1">
<Grid Margin="0 2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" SharedSizeGroup="col1" />
<ColumnDefinition Width="Auto" SharedSizeGroup="col2" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<CheckBox Grid.Row="0" Grid.Column="0" IsChecked="{Binding SetAsDefaultRule.IsFulfilled, Mode=OneWay}" IsEnabled="False">
<TextBlock Text="{Binding SetAsDefaultRule.Title, Mode=OneTime}" />
</CheckBox>
<!-- Due to bug in WPF the CommandParameter needs to be written before Command, and both needs to be bound from VM -->
<Button Grid.Row="0" Grid.Column="1" Margin="0" CommandParameter="{Binding SetAsDefaultRule}" Command="{Binding ApplyRegistryRuleCommand}" />
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal">
<TextBlock Text="{x:Static resx:Resources.PreviewHandlerCurrent}" Margin="4 0"/>
<ComboBox SelectedItem="{Binding DefaultPreviewer.SelectedItem}" ItemsSource="{Binding DefaultPreviewer.Items}" DisplayMemberPath="Name" />
<CheckBox IsChecked="{Binding DefaultPreviewer.ShowOnlyPdf}">
<TextBlock Text="{x:Static resx:Resources.PreviewHandlerItemOnlyPdf}" />
</CheckBox>
</StackPanel>
<Button Grid.Row="1" Grid.Column="1" Margin="0" CommandParameter="{Binding DefaultPreviewer}" Command="{Binding DefaultPreviewer.ApplySelectedCommand}" />
</Grid>
</Border>
</Grid>
</Window>