Refactor NoticeHandler
This commit is contained in:
@@ -17,7 +17,6 @@ namespace v2rayN.Desktop.ViewModels
|
||||
public AppViewModel()
|
||||
{
|
||||
_config = AppHandler.Instance.Config;
|
||||
_noticeHandler = Locator.Current.GetService<NoticeHandler>();
|
||||
|
||||
AddServerViaClipboardCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@ using Avalonia.Controls;
|
||||
using Avalonia.Styling;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using Splat;
|
||||
using System.Reactive.Linq;
|
||||
|
||||
namespace v2rayN.Desktop.ViewModels
|
||||
@@ -22,7 +21,6 @@ namespace v2rayN.Desktop.ViewModels
|
||||
public ThemeSettingViewModel()
|
||||
{
|
||||
_config = AppHandler.Instance.Config;
|
||||
_noticeHandler = Locator.Current.GetService<NoticeHandler>();
|
||||
|
||||
BindingUI();
|
||||
RestoreUI();
|
||||
@@ -75,7 +73,7 @@ namespace v2rayN.Desktop.ViewModels
|
||||
_config.uiItem.currentLanguage = CurrentLanguage;
|
||||
Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage);
|
||||
ConfigHandler.SaveConfig(_config);
|
||||
_noticeHandler?.Enqueue(ResUI.NeedRebootTips);
|
||||
NoticeHandler.Instance.Enqueue(ResUI.NeedRebootTips);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using Splat;
|
||||
using System.Reactive.Disposables;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
@@ -10,7 +9,6 @@ namespace v2rayN.Desktop.Views
|
||||
{
|
||||
public partial class BackupAndRestoreView : ReactiveUserControl<BackupAndRestoreViewModel>
|
||||
{
|
||||
private NoticeHandler? _noticeHandler;
|
||||
private Window _window;
|
||||
|
||||
public BackupAndRestoreView(Window window)
|
||||
@@ -23,7 +21,6 @@ namespace v2rayN.Desktop.Views
|
||||
|
||||
ViewModel = new BackupAndRestoreViewModel(UpdateViewHandler);
|
||||
|
||||
_noticeHandler = Locator.Current.GetService<NoticeHandler>();
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
this.Bind(ViewModel, vm => vm.OperationMsg, v => v.txtMsg.Text).DisposeWith(disposables);
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace v2rayN.Desktop.Views
|
||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.ImportDefConfig4V2rayCmd, v => v.btnImportDefConfig4V2ray).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.ImportDefConfig4SingboxCmd, v => v.btnImportDefConfig4Singbox).DisposeWith(disposables);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
|
||||
|
||||
@@ -79,7 +79,6 @@ namespace v2rayN.Desktop.Views
|
||||
this.BindCommand(ViewModel, vm => vm.ClearServerStatisticsCmd, v => v.menuClearServerStatistics).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.OpenTheFileLocationCmd, v => v.menuOpenTheFileLocation).DisposeWith(disposables);
|
||||
|
||||
|
||||
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.BlReloadEnabled, v => v.menuReload.IsEnabled).DisposeWith(disposables);
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ namespace v2rayN.Desktop.Views
|
||||
else
|
||||
{
|
||||
ViewModel?.EditServerAsync(EConfigType.Custom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LstProfiles_LoadingRow(object? sender, DataGridRowEventArgs e)
|
||||
@@ -313,6 +313,7 @@ namespace v2rayN.Desktop.Views
|
||||
ViewModel?.RefreshServers();
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuStorageUI_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
StorageUI();
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace v2rayN.Desktop.Views
|
||||
txtContent.Text = url;
|
||||
imgQrcode.Source = GetQRCode(url);
|
||||
|
||||
// btnCancel.Click += (s, e) => this.Close();
|
||||
// btnCancel.Click += (s, e) => this.Close();
|
||||
}
|
||||
|
||||
private Bitmap? GetQRCode(string? url)
|
||||
|
||||
Reference in New Issue
Block a user