-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainWindow.xaml
256 lines (256 loc) · 10.3 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
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<Window x:Name="wdMain" x:Class="SaveGameManager.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
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:ui="http://schemas.modernwpf.com/2019"
mc:Ignorable="d"
Title="SaveGameManager - Lies of P"
Height="650" Width="500"
MinHeight="350" MinWidth="300"
WindowStartupLocation="CenterScreen"
ui:ThemeManager.IsThemeAware="True"
ui:WindowHelper.UseModernWindowStyle="True"
Topmost="{Binding Config.Settings.StaysOnTop, UpdateSourceTrigger=PropertyChanged}">
<b:Interaction.Triggers>
<b:EventTrigger EventName="Loaded">
<b:InvokeCommandAction Command="{Binding LoadCommand}"/>
</b:EventTrigger>
</b:Interaction.Triggers>
<Window.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
<Style x:Key="MyButton" TargetType="Button">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Name="border" BorderThickness="0" BorderBrush="Black" Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="0.8" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Image Source="/Resources/Lies-of-P-Background.jpg"
Stretch="UniformToFill"
Grid.RowSpan="4"
Grid.ColumnSpan="3">
<Image.Effect>
<BlurEffect RenderingBias="Performance" KernelType="Gaussian" Radius="2"/>
</Image.Effect>
</Image>
<Button x:Name="btSettings"
Grid.Column="0"
Margin="2.5,0,0,0"
Height="25" Width="25"
Style="{StaticResource MyButton}">
<Button.Background>
<ImageBrush ImageSource="/Resources/cogwheel.png" Stretch="Uniform" TileMode="None"/>
</Button.Background>
<Button.ContextMenu>
<ContextMenu Name="cmSetting">
<MenuItem x:Name="mtAbout"
Header="About"
Command="{Binding OpenAboutDialogCommand, UpdateSourceTrigger=PropertyChanged}">
<MenuItem.Icon>
<Image Source="/Resources/P_icon.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem x:Name="mtProfiles"
Header="Profiles"
Command="{Binding OpenProfileDialogCommand, UpdateSourceTrigger=PropertyChanged}">
<MenuItem.Icon>
<Image Source="/Resources/P_icon.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem x:Name="mtSettings"
Header="Settings"
Command="{Binding OpenSettingsDialogCommand, UpdateSourceTrigger=PropertyChanged}">
<MenuItem.Icon>
<Image Source="/Resources/P_icon.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</Button.ContextMenu>
<b:Interaction.Triggers>
<b:EventTrigger EventName="Click">
<b:ChangePropertyAction TargetObject="{Binding ContextMenu, ElementName=btSettings}" PropertyName="PlacementTarget" Value="{Binding ElementName=btSettings, Mode=OneWay}"/>
<b:ChangePropertyAction TargetObject="{Binding ContextMenu, ElementName=btSettings}" PropertyName="IsOpen" Value="True"/>
</b:EventTrigger>
</b:Interaction.Triggers>
</Button>
<ComboBox x:Name="cboProfile"
Grid.Column="1"
Grid.ColumnSpan="2"
BorderThickness="1"
Margin="0,5,10,0"
FontSize="12"
MinWidth="248"
Background="#B2484848"
Foreground="White"
SelectedItem= "{Binding SelectedProfile}"
ItemsSource="{Binding Config.Profiles}"
IsEnabled="{Binding SettingsService.MainUiEnabled, UpdateSourceTrigger=PropertyChanged}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Margin="2" Text="{Binding Name}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Image Source="/Resources/sort-icon.png"
Margin="2.5,0,0,5"
Height="25" Width="25"
Grid.Column="0" Grid.Row="1"/>
<ComboBox Grid.Column="1" Grid.Row="1"
Margin="0,3,0,0"
MinWidth="125"
ItemsSource="{Binding SortEnumArray}"
SelectedItem="{Binding Config.Settings.Sort}"
Background="#B2484848"
Foreground="White"
IsEnabled="{Binding SettingsService.MainUiEnabled}">
<b:Interaction.Triggers>
<b:EventTrigger EventName="SelectionChanged">
<b:InvokeCommandAction Command="{Binding SortCommand}"
PassEventArgsToCommand="True"/>
</b:EventTrigger>
</b:Interaction.Triggers>
</ComboBox>
<TextBox Margin="0,2,10,5"
Grid.Column="2" Grid.Row="1"
Background="#B2484848"
Foreground="White"
ui:ControlHelper.PlaceholderText="Search..."
ui:ControlHelper.PlaceholderForeground="White"
Text="{Binding Filter, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding SettingsService.MainUiEnabled}">
<b:Interaction.Triggers>
<b:EventTrigger EventName="TextChanged">
<b:InvokeCommandAction Command="{Binding FilterCommand}"/>
</b:EventTrigger>
</b:Interaction.Triggers>
</TextBox>
<ui:ListView x:Name="tvSavegame"
Grid.Row="2"
Grid.ColumnSpan="3"
ScrollViewer.CanContentScroll="True"
Margin="10,0,10,0"
Background="#B2484848"
ItemsSource="{Binding SelectedProfile.SaveGames}"
SelectedItem="{Binding SelectedSaveGame}">
<b:Interaction.Triggers>
<b:EventTrigger EventName="KeyDown">
<b:InvokeCommandAction Command="{Binding KeyDownCommand}"
PassEventArgsToCommand="True"/>
</b:EventTrigger>
<b:EventTrigger EventName="MouseDoubleClick">
<b:InvokeCommandAction Command="{Binding LoadSaveGameCommand}"
PassEventArgsToCommand="True"/>
</b:EventTrigger>
</b:Interaction.Triggers>
<ui:ListView.ContextMenu>
<ContextMenu>
<MenuItem x:Name="mtDelete"
Header="Delete"
Command="{Binding DeleteSaveGameCommand, UpdateSourceTrigger=PropertyChanged}">
<MenuItem.Icon>
<Image Source="/Resources/loschen.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem x:Name="mtRename"
Header="Rename"
Command="{Binding RenameSavegameCommand, UpdateSourceTrigger=PropertyChanged}">
<MenuItem.Icon>
<Image Source="/Resources/bleistift.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem x:Name="mtOpenFolder"
Header="Open Folder"
Command="{Binding OpenSaveGameCommand, UpdateSourceTrigger=PropertyChanged}">
<MenuItem.Icon>
<Image Source="/Resources/datei-offnen.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</ui:ListView.ContextMenu>
<ui:ListView.ItemTemplate>
<HierarchicalDataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="/Resources/P_16.png" Margin="0,0,5,0" Stretch="Fill"/>
<TextBlock Text="{Binding Name}" Foreground="White" />
</StackPanel>
</HierarchicalDataTemplate>
</ui:ListView.ItemTemplate>
</ui:ListView>
<StackPanel Orientation="Horizontal"
Grid.Row="3" Grid.ColumnSpan="3"
Margin="10,5,0,0">
<Button x:Name="btnImport"
Width="60" Height="27"
FontSize="12"
Background="#B2484848"
Foreground="White"
Content="Import"
Command="{Binding CreateSaveGameCommand}"
IsEnabled="{Binding SettingsService.MainUiEnabled}">
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Button.Resources>
</Button>
<Button x:Name="btnReplace"
Width="60" Height="27"
Margin="5,0,0,0"
Background="#B2484848"
Foreground="White"
FontSize="12"
Content="Replace"
Command="{Binding ReplaceSaveGameCommand}"
IsEnabled="{Binding SettingsService.MainUiEnabled}">
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Button.Resources>
</Button>
<Button x:Name="btnLoad"
Width="60" Height="27"
Margin="5,0,0,0"
Background="#B2484848"
Foreground="White"
FontSize="12"
Content="Load"
Command="{Binding LoadSaveGameCommand}"
IsEnabled="{Binding SettingsService.MainUiEnabled}">
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Button.Resources>
</Button>
</StackPanel>
</Grid>
</Window>