Skip to content

Commit

Permalink
Improved UI for Desktop CheckUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Oct 4, 2024
1 parent fe81b51 commit 3ecbd3b
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 90 deletions.
156 changes: 73 additions & 83 deletions v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,90 +10,80 @@
d:DesignWidth="800"
x:DataType="vms:CheckUpdateViewModel"
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
HorizontalAlignment="Left"
VerticalAlignment="Center"
Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsEnableCheckPreReleaseUpdate}" />
<ToggleSwitch
x:Name="togEnableCheckPreReleaseUpdate"
HorizontalAlignment="Left"
Classes="Margin8" />
<DockPanel Margin="16">
<StackPanel
HorizontalAlignment="Right"
Classes="Margin8"
DockPanel.Dock="Bottom"
Orientation="Horizontal">

<TextBlock
HorizontalAlignment="Left"
VerticalAlignment="Center"
Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsEnableCheckPreReleaseUpdate}" />
<ToggleSwitch
x:Name="togEnableCheckPreReleaseUpdate"
HorizontalAlignment="Left"
Classes="Margin8" />

<Button
x:Name="btnCheckUpdate"
Width="100"
Classes="Margin8"
Content="{x:Static resx:ResUI.menuCheckUpdate}" />
</StackPanel>
<Button
x:Name="btnCheckUpdate"
Width="100"
Classes="Margin8"
Content="{x:Static resx:ResUI.menuCheckUpdate}" />
</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>
6 changes: 1 addition & 5 deletions v2rayN/v2rayN.Desktop/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@
</MenuItem.Header>
</MenuItem>

<MenuItem Padding="8,0">
<MenuItem.Header>
<ContentControl x:Name="conCheckUpdate" />
</MenuItem.Header>
</MenuItem>
<MenuItem x:Name="menuCheckUpdate" Header="{x:Static resx:ResUI.menuCheckUpdate}" />

<MenuItem x:Name="menuHelp" Padding="8,0">
<MenuItem.Header>
Expand Down
11 changes: 9 additions & 2 deletions v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public partial class MainWindow : ReactiveWindow<MainWindowViewModel>
{
private static Config _config;
private WindowNotificationManager? _manager;
private CheckUpdateView? _checkUpdateView;
private BackupAndRestoreView? _backupAndRestoreView;

public MainWindow()
Expand All @@ -36,6 +37,7 @@ public MainWindow()
menuSettingsSetUWP.Click += menuSettingsSetUWP_Click;
menuPromotion.Click += menuPromotion_Click;
menuClose.Click += menuClose_Click;
menuCheckUpdate.Click += MenuCheckUpdate_Click;
menuBackupAndRestore.Click += MenuBackupAndRestore_Click;

var IsAdministrator = true;//WindowsUtils.IsAdministrator();
Expand Down Expand Up @@ -156,7 +158,6 @@ public MainWindow()
tabClashConnections2.Content ??= new ClashConnectionsView();
}
conTheme.Content ??= new ThemeSettingView();
conCheckUpdate.Content ??= new CheckUpdateView();

RestoreUI();
AddHelpMenuItem();
Expand Down Expand Up @@ -368,7 +369,13 @@ public async Task ScanScreenTaskAsync()
//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);
DialogHost.Show(_backupAndRestoreView);
Expand Down

0 comments on commit 3ecbd3b

Please sign in to comment.