-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
276 lines (275 loc) · 18.3 KB
/
MainWindow.xaml
File metadata and controls
276 lines (275 loc) · 18.3 KB
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
<Window x:Class="TankView.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:TankView"
xmlns:vm="clr-namespace:TankView.ViewModel"
xmlns:om="clr-namespace:TankView.ObjectModel"
xmlns:objectModel="clr-namespace:TankView.ObjectModel"
xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI"
xmlns:adonisExtensions="clr-namespace:AdonisUI.Extensions;assembly=AdonisUI"
xmlns:controls="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
TextElement.FontWeight="Regular"
TextElement.FontSize="13"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
mc:Ignorable="d"
Title="{Binding ModuloTitle}"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
Height="800"
Width="1300"
MinWidth="865"
MinHeight="450">
<Window.Style>
<Style TargetType="Window" BasedOn="{StaticResource {x:Type Window}}"/>
</Window.Style>
<Window.Resources>
<om:SizeConverter x:Key="SizeConverter" />
<BooleanToVisibilityConverter x:Key="BoolVisbilityConverter" />
<!-- hahahah slay me -->
<HierarchicalDataTemplate x:Key="FolderDataView" DataType="{x:Type TypeName=vm:Folder}"
ItemsSource="{Binding Folders}">
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
</HierarchicalDataTemplate>
<objectModel:GUIDToImageConverter x:Key="GUIDToImageConverter" />
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="1*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Menu Grid.Row="0">
<MenuItem Header="File">
<MenuItem Header="Open...">
<MenuItem Header="CASC" Click="OpenCASC"
IsEnabled="{Binding IsReady, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" />
<MenuItem Header="NGDP" Click="OpenNGDP"
IsEnabled="{Binding IsReady, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" />
</MenuItem>
<MenuItem Header="Recent..." ItemsSource="{Binding RecentLocations}">
<MenuItem.ItemContainerStyle>
<Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
<Setter Property="Header" Value="{Binding}" />
<Setter Property="IsEnabled"
Value="{Binding IsReady, UpdateSourceTrigger=PropertyChanged, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}" />
<EventSetter Event="Click" Handler="OpenRecent" />
</Style>
</MenuItem.ItemContainerStyle>
</MenuItem>
<MenuItem Header="Local Installs..." ItemsSource="{Binding ProductAgent}">
<MenuItem.ItemContainerStyle>
<Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
<Setter Property="Header" Value="{Binding Path=Label}" />
<Setter Property="Tag" Value="{Binding Path=Value}" />
<Setter Property="IsEnabled"
Value="{Binding IsReady, UpdateSourceTrigger=PropertyChanged, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}" />
<Setter Property="ToolTip" Value="{Binding Path=Value}" />
<EventSetter Event="Click" Handler="OpenAgent" />
</Style>
</MenuItem.ItemContainerStyle>
</MenuItem>
<Separator />
<MenuItem Header="Exit" Click="Exit" />
</MenuItem>
<MenuItem Header="Options">
<MenuItem Header="CASC" DataContext="{Binding CASCSettings}">
<MenuItem Header="Cache APM"
IsChecked="{Binding APM, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
IsCheckable="True" />
<MenuItem Header="Load Manifests"
IsChecked="{Binding Manifest, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
IsCheckable="True" />
</MenuItem>
<MenuItem Header="NGDP">
<MenuItem Header="Patch Host" ItemsSource="{Binding NGDPPatchHosts}">
<MenuItem.ItemContainerStyle>
<Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
<Setter Property="Header" Value="{Binding Path=Name}" />
<Setter Property="Tag" Value="{Binding Path=Host}" />
<Setter Property="IsCheckable" Value="True" />
<Setter Property="IsChecked" Value="{Binding Path=Active}" />
<EventSetter Event="Click" Handler="NGDPHostChange" />
</Style>
</MenuItem.ItemContainerStyle>
</MenuItem>
</MenuItem>
<MenuItem Header="Extraction">
<MenuItem Header="Convert Sounds" DataContext="{Binding ExtractionSettings}"
IsChecked="{Binding EnableConvertSounds, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
IsCheckable="True" />
<MenuItem Header="Convert Images" DataContext="{Binding ExtractionSettings}"
IsChecked="{Binding EnableConvertImages, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
IsCheckable="True" />
<MenuItem Header="Image Format" ItemsSource="{Binding ImageExtractionFormats}">
<MenuItem.ItemContainerStyle>
<Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
<Setter Property="Header" Value="{Binding Path=Name}" />
<Setter Property="Tag" Value="{Binding Path=Format}" />
<Setter Property="IsCheckable" Value="True" />
<Setter Property="IsChecked" Value="{Binding Path=Active}" />
<EventSetter Event="Click" Handler="ImageExtractionFormatChange" />
</Style>
</MenuItem.ItemContainerStyle>
</MenuItem>
</MenuItem>
<MenuItem Header="Preview" DataContext="{Binding GUIDTree}"
IsChecked="{Binding ShowPreview, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
IsCheckable="True" />
<MenuItem Header="Dark Mode" DataContext="{Binding AppSettings}"
IsChecked="{Binding EnableDarkMode, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
IsCheckable="True" />
<MenuItem Header="Autoplay" DataContext="{Binding GUIDTree}"
IsChecked="{Binding EnableAutoPlay, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
IsCheckable="True" />
<MenuItem Header="Only show new files" DataContext="{Binding GUIDTree}"
IsChecked="{Binding OnlyShowNewFiles, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
IsCheckable="True" />
</MenuItem>
<MenuItem Header="Extract" Click="ExtractFiles" Width="100"
IsEnabled="{Binding IsDataReady, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" Background="Transparent"
HorizontalContentAlignment="Left" VerticalContentAlignment="Center"/>
<MenuItem Header="Obj Export" Click="ExtractAsObj" Width="100"
IsEnabled="{Binding IsDataReady, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" Background="Transparent"
HorizontalContentAlignment="Left" VerticalContentAlignment="Center"/>
<MenuItem IsEnabled="{Binding IsDataReady, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" Background="Transparent"
HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
<MenuItem.Header>
<Grid>
<TextBox
Width="300"
Text="{Binding SearchQuery, UpdateSourceTrigger=PropertyChanged, Delay=300}"
IsEnabled="{Binding IsDataReady, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"/>
</Grid>
</MenuItem.Header>
</MenuItem>
</Menu>
<Grid Grid.Row="1" DataContext="{Binding GUIDTree}" Name="MainView">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="250" />
<ColumnDefinition Width="1*" MinWidth="250" />
</Grid.ColumnDefinitions>
<TreeView Grid.Column="0" x:Name="FolderView" VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.VirtualizationMode="Recycling" AllowDrop="False"
ItemsSource="{Binding Root, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
ItemTemplate="{StaticResource FolderDataView}">
<TreeView.Resources>
<ContextMenu x:Key="ExtractTree">
<MenuItem Header="Extract" Click="ExtractFolder" />
</ContextMenu>
</TreeView.Resources>
<TreeView.ItemContainerStyle>
<Style TargetType="TreeViewItem" BasedOn="{StaticResource {x:Type TreeViewItem}}">
<EventSetter Event="Selected" Handler="ChangeActiveNode" />
<Setter Property="ContextMenu" Value="{StaticResource ExtractTree}" />
<Setter Property="IsExpanded" Value="{Binding IsExpanded}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" />
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
<GridSplitter Grid.Column="0" Width="3" HorizontalAlignment="Right" VerticalAlignment="Stretch"
ResizeDirection="Columns" ShowsPreview="True" ResizeBehavior="CurrentAndNext" />
<TabControl Grid.Column="1" x:Name="Tabs">
<TabItem Header="List">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{Binding ListRow, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
MinHeight="250" />
<RowDefinition
Height="{Binding PreviewRow, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
MinHeight="{Binding PreviewRowMin, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" />
</Grid.RowDefinitions>
<DockPanel Grid.Row="0">
<ListView x:Name="FolderItemList"
SelectedItem="{Binding TopSelectedEntry, Mode=OneWayToSource}"
ItemsSource="{Binding SelectedEntries, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.VirtualizationMode="Recycling"
GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler"
PreviewKeyDown="FolderItemList_OnKeyDown"
MouseDoubleClick="FolderItemList_OnMouseDoubleClick">
<ListView.View>
<GridView>
<GridViewColumn Header="GUID" DisplayMemberBinding="{Binding Filename}"
Width="135" />
<GridViewColumn Header="Size"
DisplayMemberBinding="{Binding Size, Converter={StaticResource SizeConverter}}"
Width="130" />
<GridViewColumn Header="Value" Width="600">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock TextWrapping="Wrap" Text="{Binding StringValue}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</DockPanel>
<GridSplitter
IsEnabled="{Binding ShowPreview, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
Visibility="{Binding ShowPreview, UpdateSourceTrigger=PropertyChanged, Mode=OneWay, Converter={StaticResource BoolVisbilityConverter}}"
Grid.Row="0" Height="3" HorizontalAlignment="Stretch" VerticalAlignment="Bottom"
ResizeDirection="Rows" ShowsPreview="True" ResizeBehavior="CurrentAndNext">
<GridSplitter.Background>
<SolidColorBrush Color="White"/>
</GridSplitter.Background>
</GridSplitter>
<DockPanel IsEnabled="{Binding ShowPreview, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
Visibility="{Binding ShowPreview, UpdateSourceTrigger=PropertyChanged, Mode=OneWay, Converter={StaticResource BoolVisbilityConverter}}"
Grid.Row="1">
<ContentControl Content="{Binding PreviewControl}" />
</DockPanel>
</Grid>
</TabItem>
<TabItem Header="Image" IsEnabled="{Binding ShowPreviewList, UpdateSourceTrigger=PropertyChanged, Mode=OneWay, Converter={StaticResource BoolVisbilityConverter}}" HorizontalAlignment="Right" Width="49">
<ListView x:Name="FolderImageList" ItemsSource="{Binding SelectedEntries, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" VirtualizingPanel.CacheLengthUnit="Page" VirtualizingPanel.CacheLength="1, 1" VirtualizingPanel.ScrollUnit="Item" VirtualizingPanel.VirtualizationMode="Recycling">
<ListView.Resources>
<Style x:Key="{x:Type ListViewItem}" TargetType="ListViewItem" BasedOn="{StaticResource {x:Type ListViewItem}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<Grid>
<Border x:Name="Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
adonisExtensions:CornerRadiusExtension.CornerRadius="{TemplateBinding adonisExtensions:CornerRadiusExtension.CornerRadius}"/>
<ContentPresenter/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListView.Resources>
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="200" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Image Grid.Row="0" Source="{Binding Converter={StaticResource GUIDToImageConverter}}" Width="200" Height="200"></Image>
<TextBlock Grid.Row="1" Text="{Binding Filename}" TextAlignment="Center"/>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<controls:VirtualizingWrapPanel MouseWheelDeltaItem="2" CacheLength="0" CacheLengthUnit="Item" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
</TabItem>
</TabControl>
</Grid>
<StatusBar Grid.Row="2" DataContext="{Binding ProgressInfo}">
<StatusBarItem VerticalContentAlignment="Stretch">
<ProgressBar Width="242" Height="Auto"
Value="{Binding Percentage, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
</StatusBarItem>
<StatusBarItem Content="{Binding State, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
</StatusBar>
</Grid>
</Window>