diff --git a/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml b/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml index 2beaec94..1e0def17 100644 --- a/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml @@ -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" + <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> + + <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" - Classes="Margin8" - Text="{x:Static resx:ResUI.TbSettingsEnableCheckPreReleaseUpdate}" /> - <ToggleSwitch - x:Name="togEnableCheckPreReleaseUpdate" - HorizontalAlignment="Left" - Classes="Margin8" /> + 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> - <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> - </Flyout> - </Button.Flyout> - </Button> </UserControl> \ No newline at end of file diff --git a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml index 4eb4bd2d..65f2017a 100644 --- a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml @@ -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> diff --git a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs index 4e9f9197..74ca8739 100644 --- a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs @@ -20,6 +20,7 @@ namespace v2rayN.Desktop.Views { private static Config _config; private WindowNotificationManager? _manager; + private CheckUpdateView? _checkUpdateView; private BackupAndRestoreView? _backupAndRestoreView; public MainWindow() @@ -36,6 +37,7 @@ namespace v2rayN.Desktop.Views 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(); @@ -156,7 +158,6 @@ namespace v2rayN.Desktop.Views tabClashConnections2.Content ??= new ClashConnectionsView(); } conTheme.Content ??= new ThemeSettingView(); - conCheckUpdate.Content ??= new CheckUpdateView(); RestoreUI(); AddHelpMenuItem(); @@ -368,7 +369,13 @@ namespace v2rayN.Desktop.Views //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);