mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-13 11:59:13 +00:00
Optimization and improvement
This commit is contained in:
parent
0377e7ce19
commit
e96a4818c4
5 changed files with 9 additions and 9 deletions
|
@ -11,6 +11,9 @@ namespace ServiceLib.ViewModels;
|
||||||
|
|
||||||
public class StatusBarViewModel : MyReactiveObject
|
public class StatusBarViewModel : MyReactiveObject
|
||||||
{
|
{
|
||||||
|
private static readonly Lazy<StatusBarViewModel> _instance = new(() => new(null));
|
||||||
|
public static StatusBarViewModel Instance => _instance.Value;
|
||||||
|
|
||||||
#region ObservableCollection
|
#region ObservableCollection
|
||||||
|
|
||||||
public IObservableCollection<RoutingItem> RoutingItems { get; } = new ObservableCollectionExtended<RoutingItem>();
|
public IObservableCollection<RoutingItem> RoutingItems { get; } = new ObservableCollectionExtended<RoutingItem>();
|
||||||
|
|
|
@ -16,9 +16,7 @@ public partial class App : Application
|
||||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
|
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
|
||||||
|
|
||||||
var ViewModel = new StatusBarViewModel(null);
|
DataContext = StatusBarViewModel.Instance;
|
||||||
Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(StatusBarViewModel));
|
|
||||||
DataContext = ViewModel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnFrameworkInitializationCompleted()
|
public override void OnFrameworkInitializationCompleted()
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace v2rayN.Desktop.Views;
|
||||||
public partial class MainWindow : WindowBase<MainWindowViewModel>
|
public partial class MainWindow : WindowBase<MainWindowViewModel>
|
||||||
{
|
{
|
||||||
private static Config _config;
|
private static Config _config;
|
||||||
private WindowNotificationManager? _manager;
|
private readonly WindowNotificationManager? _manager;
|
||||||
private CheckUpdateView? _checkUpdateView;
|
private CheckUpdateView? _checkUpdateView;
|
||||||
private BackupAndRestoreView? _backupAndRestoreView;
|
private BackupAndRestoreView? _backupAndRestoreView;
|
||||||
private bool _blCloseByUser = false;
|
private bool _blCloseByUser = false;
|
||||||
|
|
|
@ -6,7 +6,6 @@ using Avalonia.ReactiveUI;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
using DialogHostAvalonia;
|
using DialogHostAvalonia;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using Splat;
|
|
||||||
using v2rayN.Desktop.Common;
|
using v2rayN.Desktop.Common;
|
||||||
|
|
||||||
namespace v2rayN.Desktop.Views;
|
namespace v2rayN.Desktop.Views;
|
||||||
|
@ -20,9 +19,8 @@ public partial class StatusBarView : ReactiveUserControl<StatusBarViewModel>
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_config = AppManager.Instance.Config;
|
_config = AppManager.Instance.Config;
|
||||||
//ViewModel = new StatusBarViewModel(UpdateViewHandler);
|
|
||||||
//Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(StatusBarViewModel));
|
ViewModel = StatusBarViewModel.Instance;
|
||||||
ViewModel = Locator.Current.GetService<StatusBarViewModel>();
|
|
||||||
ViewModel?.InitUpdateView(UpdateViewHandler);
|
ViewModel?.InitUpdateView(UpdateViewHandler);
|
||||||
|
|
||||||
txtRunningServerDisplay.Tapped += TxtRunningServerDisplay_Tapped;
|
txtRunningServerDisplay.Tapped += TxtRunningServerDisplay_Tapped;
|
||||||
|
|
|
@ -15,7 +15,8 @@ public partial class StatusBarView
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_config = AppManager.Instance.Config;
|
_config = AppManager.Instance.Config;
|
||||||
ViewModel = new StatusBarViewModel(UpdateViewHandler);
|
ViewModel = StatusBarViewModel.Instance;
|
||||||
|
ViewModel?.InitUpdateView(UpdateViewHandler);
|
||||||
|
|
||||||
menuExit.Click += menuExit_Click;
|
menuExit.Click += menuExit_Click;
|
||||||
txtRunningServerDisplay.PreviewMouseDown += txtRunningInfoDisplay_MouseDoubleClick;
|
txtRunningServerDisplay.PreviewMouseDown += txtRunningInfoDisplay_MouseDoubleClick;
|
||||||
|
|
Loading…
Reference in a new issue