Browse Source

Improved UI for Desktop CheckUpdate

pull/5829/head
2dust 2 months ago
parent
commit
3ecbd3bc10
  1. 156
      v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml
  2. 6
      v2rayN/v2rayN.Desktop/Views/MainWindow.axaml
  3. 11
      v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs

156
v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml

@ -10,90 +10,80 @@
d:DesignWidth="800" d:DesignWidth="800"
x:DataType="vms:CheckUpdateViewModel" x:DataType="vms:CheckUpdateViewModel"
mc:Ignorable="d"> mc:Ignorable="d">
<Button
Classes="Tertiary"
FontWeight="Regular"
Theme="{DynamicResource BorderlessButton}">
<Button.Content>
<TextBlock Text="{x:Static resx:ResUI.menuCheckUpdate}" />
</Button.Content>
<Button.Flyout>
<Flyout Placement="RightEdgeAlignedTop">
<DockPanel Margin="16">
<StackPanel
HorizontalAlignment="Right"
Classes="Margin8"
DockPanel.Dock="Bottom"
Orientation="Horizontal">
<TextBlock <DockPanel Margin="16">
HorizontalAlignment="Left" <StackPanel
VerticalAlignment="Center" HorizontalAlignment="Right"
Classes="Margin8" Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsEnableCheckPreReleaseUpdate}" /> DockPanel.Dock="Bottom"
<ToggleSwitch Orientation="Horizontal">
x:Name="togEnableCheckPreReleaseUpdate"
HorizontalAlignment="Left" <TextBlock
Classes="Margin8" /> HorizontalAlignment="Left"
VerticalAlignment="Center"
Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsEnableCheckPreReleaseUpdate}" />
<ToggleSwitch
x:Name="togEnableCheckPreReleaseUpdate"
HorizontalAlignment="Left"
Classes="Margin8" />
<Button <Button
x:Name="btnCheckUpdate" x:Name="btnCheckUpdate"
Width="100" Width="100"
Classes="Margin8" Classes="Margin8"
Content="{x:Static resx:ResUI.menuCheckUpdate}" /> Content="{x:Static resx:ResUI.menuCheckUpdate}" />
</StackPanel> </StackPanel>
<StackPanel>
<ListBox
x:Name="lstCheckUpdates"
BorderThickness="1"
ItemsSource="{Binding CheckUpdateItems}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border
Width="500"
Height="80"
Margin="0"
VerticalAlignment="Center"
Theme="{StaticResource CardBorder}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<ToggleSwitch
x:Name="togAutoRefresh"
Grid.Column="0"
Margin="8"
HorizontalAlignment="Left"
VerticalAlignment="Center"
IsChecked="{Binding isSelected}" />
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Text="{Binding coreType}" />
<TextBlock
Grid.Column="2"
VerticalAlignment="Center"
Text="{Binding remarks}"
TextWrapping="WrapWithOverflow" />
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ListBox>
</StackPanel>
</DockPanel>
<StackPanel>
<ListBox
x:Name="lstCheckUpdates"
BorderThickness="1"
ItemsSource="{Binding CheckUpdateItems}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border
Width="500"
Height="80"
Margin="0"
VerticalAlignment="Center"
Theme="{StaticResource CardBorder}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<ToggleSwitch
x:Name="togAutoRefresh"
Grid.Column="0"
Margin="8"
HorizontalAlignment="Left"
VerticalAlignment="Center"
IsChecked="{Binding isSelected}" />
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Text="{Binding coreType}" />
<TextBlock
Grid.Column="2"
VerticalAlignment="Center"
Text="{Binding remarks}"
TextWrapping="WrapWithOverflow" />
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ListBox>
</StackPanel>
</DockPanel>
</Flyout>
</Button.Flyout>
</Button>
</UserControl> </UserControl>

6
v2rayN/v2rayN.Desktop/Views/MainWindow.axaml

@ -90,11 +90,7 @@
</MenuItem.Header> </MenuItem.Header>
</MenuItem> </MenuItem>
<MenuItem Padding="8,0"> <MenuItem x:Name="menuCheckUpdate" Header="{x:Static resx:ResUI.menuCheckUpdate}" />
<MenuItem.Header>
<ContentControl x:Name="conCheckUpdate" />
</MenuItem.Header>
</MenuItem>
<MenuItem x:Name="menuHelp" Padding="8,0"> <MenuItem x:Name="menuHelp" Padding="8,0">
<MenuItem.Header> <MenuItem.Header>

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

@ -20,6 +20,7 @@ namespace v2rayN.Desktop.Views
{ {
private static Config _config; private static Config _config;
private WindowNotificationManager? _manager; private WindowNotificationManager? _manager;
private CheckUpdateView? _checkUpdateView;
private BackupAndRestoreView? _backupAndRestoreView; private BackupAndRestoreView? _backupAndRestoreView;
public MainWindow() public MainWindow()
@ -36,6 +37,7 @@ namespace v2rayN.Desktop.Views
menuSettingsSetUWP.Click += menuSettingsSetUWP_Click; menuSettingsSetUWP.Click += menuSettingsSetUWP_Click;
menuPromotion.Click += menuPromotion_Click; menuPromotion.Click += menuPromotion_Click;
menuClose.Click += menuClose_Click; menuClose.Click += menuClose_Click;
menuCheckUpdate.Click += MenuCheckUpdate_Click;
menuBackupAndRestore.Click += MenuBackupAndRestore_Click; menuBackupAndRestore.Click += MenuBackupAndRestore_Click;
var IsAdministrator = true;//WindowsUtils.IsAdministrator(); var IsAdministrator = true;//WindowsUtils.IsAdministrator();
@ -156,7 +158,6 @@ namespace v2rayN.Desktop.Views
tabClashConnections2.Content ??= new ClashConnectionsView(); tabClashConnections2.Content ??= new ClashConnectionsView();
} }
conTheme.Content ??= new ThemeSettingView(); conTheme.Content ??= new ThemeSettingView();
conCheckUpdate.Content ??= new CheckUpdateView();
RestoreUI(); RestoreUI();
AddHelpMenuItem(); AddHelpMenuItem();
@ -368,7 +369,13 @@ namespace v2rayN.Desktop.Views
//ViewModel?.ScanScreenTaskAsync(result); //ViewModel?.ScanScreenTaskAsync(result);
} }
private void MenuBackupAndRestore_Click(object sender, RoutedEventArgs e) private void MenuCheckUpdate_Click(object? sender, RoutedEventArgs e)
{
_checkUpdateView ??= new CheckUpdateView();
DialogHost.Show(_checkUpdateView);
}
private void MenuBackupAndRestore_Click(object? sender, RoutedEventArgs e)
{ {
_backupAndRestoreView ??= new BackupAndRestoreView(this); _backupAndRestoreView ??= new BackupAndRestoreView(this);
DialogHost.Show(_backupAndRestoreView); DialogHost.Show(_backupAndRestoreView);

Loading…
Cancel
Save