-
Notifications
You must be signed in to change notification settings - Fork 823
Expand file tree
/
Copy pathMainWindow.axaml
More file actions
425 lines (398 loc) · 26 KB
/
MainWindow.axaml
File metadata and controls
425 lines (398 loc) · 26 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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:automation="clr-namespace:Avalonia.Automation;assembly=Avalonia.Controls"
xmlns:peers="clr-namespace:Avalonia.Automation.Peers;assembly=Avalonia.Controls"
xmlns:views="using:UniGetUI.Avalonia.Views"
xmlns:vm="using:UniGetUI.Avalonia.ViewModels"
xmlns:controls="using:UniGetUI.Avalonia.Views.Controls"
xmlns:t="using:UniGetUI.Avalonia.MarkupExtensions"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="750"
x:Class="UniGetUI.Avalonia.Views.MainWindow"
x:DataType="vm:MainWindowViewModel"
Title="UniGetUI"
Width="1450"
MinWidth="700"
MinHeight="500">
<Panel>
<!-- Main content pushed below the native title bar -->
<Grid x:Name="MainContentGrid"
ColumnDefinitions="Auto,*"
RowDefinitions="*,4,Auto"
Background="{DynamicResource AppWindowBackground}"
Margin="{Binding $parent[Window].WindowDecorationMargin}">
<!-- ── Sidebar (spans all rows) ── -->
<ContentControl Grid.Column="0" Grid.RowSpan="3"
Width="{Binding Sidebar.PaneWidth}"
Content="{Binding Sidebar}"
automation:AutomationProperties.AccessibilityView="Control"
automation:AutomationProperties.Name="{t:Translate Navigation panel}"
automation:AutomationProperties.LandmarkType="{x:Static peers:AutomationLandmarkType.Navigation}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<ContentControl.DataTemplates>
<DataTemplate DataType="vm:SidebarViewModel">
<views:SidebarView/>
</DataTemplate>
</ContentControl.DataTemplates>
</ContentControl>
<!-- ── Banners + page content ── -->
<Grid Grid.Column="1" Grid.Row="0" RowDefinitions="Auto,*" Margin="0,10">
<StackPanel Grid.Row="0"
Spacing="0"
automation:AutomationProperties.AccessibilityView="Control">
<StackPanel.DataTemplates>
<DataTemplate DataType="vm:InfoBarViewModel">
<controls:InfoBar/>
</DataTemplate>
</StackPanel.DataTemplates>
<ContentControl Content="{Binding UpdatesBanner}"/>
<ContentControl Content="{Binding ErrorBanner}"/>
<ContentControl Content="{Binding WinGetWarningBanner}"/>
<ContentControl Content="{Binding TelemetryWarner}"/>
</StackPanel>
<ContentControl Grid.Row="1"
Content="{Binding CurrentPageContent}"
automation:AutomationProperties.AccessibilityView="Control"
automation:AutomationProperties.LandmarkType="{x:Static peers:AutomationLandmarkType.Main}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"/>
</Grid>
<!-- ── GridSplitter (only visible when operations are present) ── -->
<GridSplitter Grid.Column="1" Grid.Row="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsVisible="{Binding OperationsPanelVisible}"
automation:AutomationProperties.AccessibilityView="Raw"
Background="{DynamicResource AppSplitterBackground}"
Opacity="0.8"/>
<!-- ── Operations panel ── -->
<Border Grid.Column="1" Grid.Row="2"
IsVisible="{Binding OperationsPanelVisible}"
BorderThickness="0,1,0,0"
BorderBrush="{DynamicResource AppBorderBrush}"
automation:AutomationProperties.AccessibilityView="Control"
automation:AutomationProperties.Name="{t:Translate Operations}"
automation:AutomationProperties.LandmarkType="{x:Static peers:AutomationLandmarkType.Region}"
Background="{DynamicResource AppOperationsPanelBackground}">
<Grid RowDefinitions="Auto,Auto">
<!-- Toolbar: expand/collapse + bulk-ops menu -->
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto"
Height="28" Margin="4,2,4,2">
<!-- Expand/collapse chevron -->
<Button Grid.Column="0"
Width="28" Height="24" Padding="4"
Background="Transparent" BorderThickness="0" CornerRadius="4"
Command="{Binding ToggleOperationsPanelCommand}"
automation:AutomationProperties.Name="{t:Translate Toggle operations panel}"
ToolTip.Tip="{t:Translate Toggle operations panel}">
<Panel Width="10" Height="10">
<PathIcon Width="10" Height="10"
automation:AutomationProperties.AccessibilityView="Raw"
IsVisible="{Binding OperationsPanelExpanded}"
Data="M0,0 L5,6 L10,0"/>
<PathIcon Width="10" Height="10"
automation:AutomationProperties.AccessibilityView="Raw"
IsVisible="{Binding !OperationsPanelExpanded}"
Data="M0,6 L5,0 L10,6"/>
</Panel>
</Button>
<TextBlock Grid.Column="1"
Text="{t:Translate Operations}"
FontSize="11" Opacity="0.6"
VerticalAlignment="Center"
Margin="4,0,0,0"/>
<!-- Bulk-ops menu -->
<Button Grid.Column="2"
Width="28" Height="24" Padding="4"
Background="Transparent" BorderThickness="0" CornerRadius="4"
automation:AutomationProperties.Name="{t:Translate Bulk operations}"
ToolTip.Tip="{t:Translate Bulk operations}">
<TextBlock Text="⋯" FontSize="13"
automation:AutomationProperties.AccessibilityView="Raw"/>
<Button.Flyout>
<MenuFlyout>
<MenuItem Header="{t:Translate Retry failed}"
Command="{Binding RetryFailedOperationsCommand}"/>
<MenuItem Header="{t:Translate Clear successful}"
Command="{Binding ClearSuccessfulOperationsCommand}"/>
<MenuItem Header="{t:Translate Clear finished}"
Command="{Binding ClearFinishedOperationsCommand}"/>
<Separator/>
<MenuItem Header="{t:Translate Cancel all}"
Command="{Binding CancelAllOperationsCommand}"/>
</MenuFlyout>
</Button.Flyout>
</Button>
</Grid>
<!-- Operations list (hidden when panel is collapsed) -->
<ScrollViewer Grid.Row="1"
IsVisible="{Binding OperationsPanelExpanded}"
MaxHeight="220"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<ItemsControl ItemsSource="{Binding Operations}"
Margin="8,4,8,4">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:OperationViewModel">
<Border Background="{Binding BackgroundBrush}"
CornerRadius="6"
Padding="10,6"
Margin="0,3,0,3">
<Grid ColumnDefinitions="Auto,*,Auto">
<!-- Package icon -->
<Image Grid.Column="0"
Source="{Binding PackageIcon}"
Width="32" Height="24"
Margin="0,0,10,0"
automation:AutomationProperties.AccessibilityView="Raw"
VerticalAlignment="Center"
Stretch="Uniform"/>
<!-- Centre: title, live line, progress, badges -->
<StackPanel Grid.Column="1"
Spacing="3"
VerticalAlignment="Center"
Margin="0,0,8,0">
<TextBlock Text="{Binding Title}"
FontWeight="SemiBold"
FontSize="13"
TextTrimming="CharacterEllipsis"/>
<Button Content="{Binding LiveLine}"
Command="{Binding ShowDetailsCommand}"
automation:AutomationProperties.HelpText="{Binding Title}"
FontSize="11"
Opacity="0.65"
HorizontalAlignment="Left"
Padding="0"
Background="Transparent"
BorderThickness="0"
CornerRadius="0"
Cursor="Hand"/>
<ProgressBar IsIndeterminate="{Binding ProgressIndeterminate}"
Value="{Binding ProgressValue}"
automation:AutomationProperties.Name="{Binding Title}"
automation:AutomationProperties.ItemStatus="{Binding LiveLine}"
Minimum="0" Maximum="100"
Height="3"
CornerRadius="2"
Foreground="{Binding ProgressBrush}"/>
<!-- Badge icon-buttons (Admin, Interactive, …) -->
<ItemsControl ItemsSource="{Binding Badges}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Spacing="4"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:OperationBadgeVm">
<Button Background="{DynamicResource AppBadgeBackground}"
BorderThickness="0"
CornerRadius="4"
Padding="5,2"
automation:AutomationProperties.Name="{Binding Label}"
automation:AutomationProperties.HelpText="{Binding Primary}"
ToolTip.Tip="{Binding Primary}">
<StackPanel Orientation="Horizontal" Spacing="4">
<controls:SvgIcon Path="{Binding IconPath}"
Width="12" Height="12"
Foreground="{DynamicResource AppIconForeground}"/>
<TextBlock Text="{Binding Label}"
FontSize="10"
Opacity="0.8"/>
</StackPanel>
<Button.Flyout>
<Flyout>
<StackPanel Spacing="6" MaxWidth="240">
<TextBlock Text="{Binding Label}"
FontWeight="SemiBold"
TextWrapping="Wrap"/>
<TextBlock Text="{Binding Primary}"
Opacity="0.85"
TextWrapping="Wrap"/>
<TextBlock Text="{Binding Secondary}"
Opacity="0.7"
FontSize="11"
TextWrapping="Wrap"/>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
<!-- Split-button: Cancel/Close + "…" menu -->
<Border Grid.Column="2"
CornerRadius="6"
ClipToBounds="True"
VerticalAlignment="Center">
<StackPanel Orientation="Horizontal">
<Button Content="{Binding ButtonText}"
Command="{Binding ButtonCommand}"
automation:AutomationProperties.Name="{Binding ButtonText}"
Padding="12,6"
CornerRadius="0"
FontSize="12"/>
<Border Width="1"
VerticalAlignment="Stretch"
automation:AutomationProperties.AccessibilityView="Raw"
Background="{DynamicResource AppBorderBrush}"
Opacity="0.3"/>
<Button Width="32"
Padding="4"
CornerRadius="0"
automation:AutomationProperties.Name="{t:Translate More}"
Flyout="{Binding OpMenu}">
<TextBlock Text="⋯" FontSize="14"
automation:AutomationProperties.AccessibilityView="Raw"/>
</Button>
</StackPanel>
</Border>
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Border>
</Grid>
<TextBlock x:Name="LiveAnnouncementHost"
Width="1"
Height="1"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Opacity="0"
IsHitTestVisible="False"
Text="{Binding AnnouncementText}"
automation:AutomationProperties.AccessibilityView="Control"
automation:AutomationProperties.Name="{Binding AnnouncementText}"
automation:AutomationProperties.LiveSetting="{Binding AnnouncementLiveSetting}"/>
<!-- ── Title bar: drag area + search box ── -->
<Grid x:Name="TitleBarGrid"
Height="{Binding $parent[Window].WindowDecorationMargin.Top}"
VerticalAlignment="Top"
ColumnDefinitions="*,Auto,*">
<!-- Drag area — sits behind everything so interactive controls still work -->
<Border Grid.Column="0" Grid.ColumnSpan="3"
Background="{DynamicResource AppTitleBarBackground}"
automation:AutomationProperties.AccessibilityView="Raw"
IsHitTestVisible="True"
PointerPressed="TitleBar_PointerPressed"/>
<!-- Left: hamburger + app name -->
<StackPanel x:Name="HamburgerPanel"
Grid.Column="0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal"
Margin="65,0,8,0"
Spacing="8">
<Button Width="32" Height="32"
Padding="4"
Background="Transparent"
BorderThickness="0"
CornerRadius="4"
automation:AutomationProperties.Name="{t:Translate Toggle navigation panel}"
ToolTip.Tip="{t:Translate Toggle navigation panel}"
Command="{Binding ToggleSidebarCommand}">
<PathIcon Width="14" Height="14"
automation:AutomationProperties.AccessibilityView="Raw"
Data="M1,1 H15 V3 H1 Z M1,7 H15 V9 H1 Z M1,13 H15 V15 H1 Z"/>
</Button>
<TextBlock Text="UniGetUI"
FontSize="13"
FontWeight="SemiBold"
VerticalAlignment="Center"/>
</StackPanel>
<!-- Centre: search box — vertically centred, no platform-specific margin -->
<StackPanel Grid.Column="1"
VerticalAlignment="Center"
automation:AutomationProperties.AccessibilityView="Control"
Orientation="Horizontal"
Spacing="0">
<TextBox x:Name="GlobalSearchBox"
Width="300"
MinHeight="20"
Height="30"
FontSize="15"
Margin="0,5,0,0"
CornerRadius="4,0,0,4"
PlaceholderText="{Binding GlobalSearchPlaceholder}"
IsEnabled="{Binding GlobalSearchEnabled}"
automation:AutomationProperties.Name="{Binding GlobalSearchPlaceholder}"
automation:AutomationProperties.AcceleratorKey="Ctrl+F"
Text="{Binding GlobalSearchText}"
KeyDown="SearchBox_KeyDown"/>
<Button Height="30"
Width="30"
Padding="3"
Margin="0,5,0,0"
CornerRadius="0,4,4,0"
IsEnabled="{Binding GlobalSearchEnabled}"
automation:AutomationProperties.Name="{Binding GlobalSearchPlaceholder}"
Command="{Binding SubmitGlobalSearchCommand}">
<controls:SvgIcon Path="avares://UniGetUI.Avalonia/Assets/Symbols/search.svg"
Width="18"
Height="18"/>
</Button>
</StackPanel>
<!-- Right column: Linux window buttons on the far right -->
<Panel Grid.Column="2">
<!-- Linux only: min / max / close (IsVisible set in code-behind) -->
<StackPanel x:Name="LinuxWindowButtons"
Orientation="Horizontal"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Margin="0,0,4,0"
Spacing="0"
IsVisible="False">
<!-- Minimize: horizontal line -->
<Button Width="46" Height="32" Padding="0"
Background="Transparent" BorderThickness="0" CornerRadius="0"
automation:AutomationProperties.Name="{t:Translate Minimize}"
ToolTip.Tip="{t:Translate Minimize}"
Click="MinimizeButton_Click">
<Path Stroke="{DynamicResource SystemBaseHighColor}"
StrokeThickness="1.5"
StrokeLineCap="Round"
automation:AutomationProperties.AccessibilityView="Raw"
Data="M2,0 H10"
Width="12" Height="2"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Button>
<!-- Maximize / Restore: square outline, geometry swapped in code-behind -->
<Button x:Name="MaximizeButton"
Width="46" Height="32" Padding="0"
Background="Transparent" BorderThickness="0" CornerRadius="0"
automation:AutomationProperties.Name="{t:Translate Maximize}"
ToolTip.Tip="{t:Translate Maximize}"
Click="MaximizeButton_Click">
<Path x:Name="MaximizeIcon"
Stroke="{DynamicResource SystemBaseHighColor}"
StrokeThickness="1.5"
StrokeLineCap="Round"
automation:AutomationProperties.AccessibilityView="Raw"
Data="M0,0 H10 V10 H0 Z"
Width="12" Height="12"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Button>
<!-- Close: X -->
<Button Width="46" Height="32" Padding="0"
Background="Transparent" BorderThickness="0" CornerRadius="0"
automation:AutomationProperties.Name="{t:Translate Close}"
ToolTip.Tip="{t:Translate Close}"
Click="CloseButton_Click">
<Path Stroke="{DynamicResource SystemBaseHighColor}"
StrokeThickness="1.5"
StrokeLineCap="Round"
automation:AutomationProperties.AccessibilityView="Raw"
Data="M0,0 L10,10 M10,0 L0,10"
Width="12" Height="12"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Button>
</StackPanel>
</Panel>
</Grid>
</Panel>
</Window>