Skip to content

Commit 3ecbd3b

Browse files
committed
Improved UI for Desktop CheckUpdate
1 parent fe81b51 commit 3ecbd3b

File tree

3 files changed

+83
-90
lines changed

3 files changed

+83
-90
lines changed

v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml

Lines changed: 73 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -10,90 +10,80 @@
1010
d:DesignWidth="800"
1111
x:DataType="vms:CheckUpdateViewModel"
1212
mc:Ignorable="d">
13-
<Button
14-
Classes="Tertiary"
15-
FontWeight="Regular"
16-
Theme="{DynamicResource BorderlessButton}">
17-
<Button.Content>
18-
<TextBlock Text="{x:Static resx:ResUI.menuCheckUpdate}" />
19-
</Button.Content>
20-
<Button.Flyout>
21-
<Flyout Placement="RightEdgeAlignedTop">
22-
<DockPanel Margin="16">
23-
<StackPanel
24-
HorizontalAlignment="Right"
25-
Classes="Margin8"
26-
DockPanel.Dock="Bottom"
27-
Orientation="Horizontal">
2813

29-
<TextBlock
30-
HorizontalAlignment="Left"
31-
VerticalAlignment="Center"
32-
Classes="Margin8"
33-
Text="{x:Static resx:ResUI.TbSettingsEnableCheckPreReleaseUpdate}" />
34-
<ToggleSwitch
35-
x:Name="togEnableCheckPreReleaseUpdate"
36-
HorizontalAlignment="Left"
37-
Classes="Margin8" />
14+
<DockPanel Margin="16">
15+
<StackPanel
16+
HorizontalAlignment="Right"
17+
Classes="Margin8"
18+
DockPanel.Dock="Bottom"
19+
Orientation="Horizontal">
20+
21+
<TextBlock
22+
HorizontalAlignment="Left"
23+
VerticalAlignment="Center"
24+
Classes="Margin8"
25+
Text="{x:Static resx:ResUI.TbSettingsEnableCheckPreReleaseUpdate}" />
26+
<ToggleSwitch
27+
x:Name="togEnableCheckPreReleaseUpdate"
28+
HorizontalAlignment="Left"
29+
Classes="Margin8" />
3830

39-
<Button
40-
x:Name="btnCheckUpdate"
41-
Width="100"
42-
Classes="Margin8"
43-
Content="{x:Static resx:ResUI.menuCheckUpdate}" />
44-
</StackPanel>
31+
<Button
32+
x:Name="btnCheckUpdate"
33+
Width="100"
34+
Classes="Margin8"
35+
Content="{x:Static resx:ResUI.menuCheckUpdate}" />
36+
</StackPanel>
37+
38+
<StackPanel>
39+
<ListBox
40+
x:Name="lstCheckUpdates"
41+
BorderThickness="1"
42+
ItemsSource="{Binding CheckUpdateItems}">
43+
<ItemsControl.ItemsPanel>
44+
<ItemsPanelTemplate>
45+
<StackPanel Orientation="Vertical" />
46+
</ItemsPanelTemplate>
47+
</ItemsControl.ItemsPanel>
48+
<ItemsControl.ItemTemplate>
49+
<DataTemplate>
50+
<Border
51+
Width="500"
52+
Height="80"
53+
Margin="0"
54+
VerticalAlignment="Center"
55+
Theme="{StaticResource CardBorder}">
56+
<Grid>
57+
<Grid.RowDefinitions>
58+
<RowDefinition Height="Auto" />
59+
</Grid.RowDefinitions>
60+
<Grid.ColumnDefinitions>
61+
<ColumnDefinition Width="1*" />
62+
<ColumnDefinition Width="1*" />
63+
<ColumnDefinition Width="3*" />
64+
</Grid.ColumnDefinitions>
65+
<ToggleSwitch
66+
x:Name="togAutoRefresh"
67+
Grid.Column="0"
68+
Margin="8"
69+
HorizontalAlignment="Left"
70+
VerticalAlignment="Center"
71+
IsChecked="{Binding isSelected}" />
72+
<TextBlock
73+
Grid.Column="1"
74+
VerticalAlignment="Center"
75+
Text="{Binding coreType}" />
76+
<TextBlock
77+
Grid.Column="2"
78+
VerticalAlignment="Center"
79+
Text="{Binding remarks}"
80+
TextWrapping="WrapWithOverflow" />
81+
</Grid>
82+
</Border>
83+
</DataTemplate>
84+
</ItemsControl.ItemTemplate>
85+
</ListBox>
86+
</StackPanel>
87+
</DockPanel>
4588

46-
<StackPanel>
47-
<ListBox
48-
x:Name="lstCheckUpdates"
49-
BorderThickness="1"
50-
ItemsSource="{Binding CheckUpdateItems}">
51-
<ItemsControl.ItemsPanel>
52-
<ItemsPanelTemplate>
53-
<StackPanel Orientation="Vertical" />
54-
</ItemsPanelTemplate>
55-
</ItemsControl.ItemsPanel>
56-
<ItemsControl.ItemTemplate>
57-
<DataTemplate>
58-
<Border
59-
Width="500"
60-
Height="80"
61-
Margin="0"
62-
VerticalAlignment="Center"
63-
Theme="{StaticResource CardBorder}">
64-
<Grid>
65-
<Grid.RowDefinitions>
66-
<RowDefinition Height="Auto" />
67-
</Grid.RowDefinitions>
68-
<Grid.ColumnDefinitions>
69-
<ColumnDefinition Width="1*" />
70-
<ColumnDefinition Width="1*" />
71-
<ColumnDefinition Width="3*" />
72-
</Grid.ColumnDefinitions>
73-
<ToggleSwitch
74-
x:Name="togAutoRefresh"
75-
Grid.Column="0"
76-
Margin="8"
77-
HorizontalAlignment="Left"
78-
VerticalAlignment="Center"
79-
IsChecked="{Binding isSelected}" />
80-
<TextBlock
81-
Grid.Column="1"
82-
VerticalAlignment="Center"
83-
Text="{Binding coreType}" />
84-
<TextBlock
85-
Grid.Column="2"
86-
VerticalAlignment="Center"
87-
Text="{Binding remarks}"
88-
TextWrapping="WrapWithOverflow" />
89-
</Grid>
90-
</Border>
91-
</DataTemplate>
92-
</ItemsControl.ItemTemplate>
93-
</ListBox>
94-
</StackPanel>
95-
</DockPanel>
96-
</Flyout>
97-
</Button.Flyout>
98-
</Button>
9989
</UserControl>

v2rayN/v2rayN.Desktop/Views/MainWindow.axaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,7 @@
9090
</MenuItem.Header>
9191
</MenuItem>
9292

93-
<MenuItem Padding="8,0">
94-
<MenuItem.Header>
95-
<ContentControl x:Name="conCheckUpdate" />
96-
</MenuItem.Header>
97-
</MenuItem>
93+
<MenuItem x:Name="menuCheckUpdate" Header="{x:Static resx:ResUI.menuCheckUpdate}" />
9894

9995
<MenuItem x:Name="menuHelp" Padding="8,0">
10096
<MenuItem.Header>

v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public partial class MainWindow : ReactiveWindow<MainWindowViewModel>
2020
{
2121
private static Config _config;
2222
private WindowNotificationManager? _manager;
23+
private CheckUpdateView? _checkUpdateView;
2324
private BackupAndRestoreView? _backupAndRestoreView;
2425

2526
public MainWindow()
@@ -36,6 +37,7 @@ public MainWindow()
3637
menuSettingsSetUWP.Click += menuSettingsSetUWP_Click;
3738
menuPromotion.Click += menuPromotion_Click;
3839
menuClose.Click += menuClose_Click;
40+
menuCheckUpdate.Click += MenuCheckUpdate_Click;
3941
menuBackupAndRestore.Click += MenuBackupAndRestore_Click;
4042

4143
var IsAdministrator = true;//WindowsUtils.IsAdministrator();
@@ -156,7 +158,6 @@ public MainWindow()
156158
tabClashConnections2.Content ??= new ClashConnectionsView();
157159
}
158160
conTheme.Content ??= new ThemeSettingView();
159-
conCheckUpdate.Content ??= new CheckUpdateView();
160161

161162
RestoreUI();
162163
AddHelpMenuItem();
@@ -368,7 +369,13 @@ public async Task ScanScreenTaskAsync()
368369
//ViewModel?.ScanScreenTaskAsync(result);
369370
}
370371

371-
private void MenuBackupAndRestore_Click(object sender, RoutedEventArgs e)
372+
private void MenuCheckUpdate_Click(object? sender, RoutedEventArgs e)
373+
{
374+
_checkUpdateView ??= new CheckUpdateView();
375+
DialogHost.Show(_checkUpdateView);
376+
}
377+
378+
private void MenuBackupAndRestore_Click(object? sender, RoutedEventArgs e)
372379
{
373380
_backupAndRestoreView ??= new BackupAndRestoreView(this);
374381
DialogHost.Show(_backupAndRestoreView);

0 commit comments

Comments
 (0)