mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-11 06:54:58 +03:00
Add 'New Update' notification flow
Introduce a small update-notification feature: add AppEvents.HasUpdateNotified event and have TaskManager publish it when update messages exist. Add localized resource key (menuNewUpdate) and expose it in the ResUI designer; update resource files for several languages. In the UI, add a New Update button in MainWindow.xaml, wire its click to the existing check-update handler, bind its visibility to a new BlNewUpdate property on MainWindowViewModel, and subscribe the viewmodel to the new event. Also reset the notification flag after showing the Check Update dialog.
This commit is contained in:
@@ -102,6 +102,13 @@
|
||||
|
||||
<MenuItem x:Name="menuClose" Header="{x:Static resx:ResUI.menuExit}" />
|
||||
</Menu>
|
||||
|
||||
<Button
|
||||
x:Name="btnNewUpdate"
|
||||
Margin="{StaticResource MarginLr8}"
|
||||
HorizontalAlignment="Left"
|
||||
Content="{x:Static resx:ResUI.menuNewUpdate}"
|
||||
IsVisible="False" />
|
||||
</DockPanel>
|
||||
|
||||
<view:StatusBarView DockPanel.Dock="Bottom" />
|
||||
|
||||
@@ -25,6 +25,7 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
|
||||
menuSettingsSetUWP.Click += MenuSettingsSetUWP_Click;
|
||||
menuPromotion.Click += MenuPromotion_Click;
|
||||
menuCheckUpdate.Click += MenuCheckUpdate_Click;
|
||||
btnNewUpdate.Click += MenuCheckUpdate_Click;
|
||||
menuBackupAndRestore.Click += MenuBackupAndRestore_Click;
|
||||
menuClose.Click += MenuClose_Click;
|
||||
|
||||
@@ -102,6 +103,7 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
|
||||
|
||||
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.BlReloadEnabled, v => v.menuReload.IsEnabled).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.BlNewUpdate, v => v.btnNewUpdate.IsVisible).DisposeWith(disposables);
|
||||
|
||||
switch (_config.UiItem.MainGirdOrientation)
|
||||
{
|
||||
@@ -367,6 +369,8 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
|
||||
{
|
||||
_checkUpdateView ??= new CheckUpdateView();
|
||||
DialogHost.Show(_checkUpdateView);
|
||||
|
||||
AppEvents.HasUpdateNotified.Publish(false);
|
||||
}
|
||||
|
||||
private void MenuBackupAndRestore_Click(object? sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user