diff --git a/v2rayN/v2rayN/App.xaml.cs b/v2rayN/v2rayN/App.xaml.cs index 406cd3ac..73467ee3 100644 --- a/v2rayN/v2rayN/App.xaml.cs +++ b/v2rayN/v2rayN/App.xaml.cs @@ -59,6 +59,7 @@ namespace v2rayN Environment.Exit(0); return; } + LazyConfig.Instance.SetConfig(_config); //Under Win10 if (Environment.OSVersion.Version.Major < 10) diff --git a/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs b/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs index 5ce03286..0e8fac70 100644 --- a/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs +++ b/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs @@ -11,7 +11,7 @@ namespace v2rayN.Converters { try { - var fontFamily = LazyConfig.Instance.GetConfig().uiItem.currentFontFamily; + var fontFamily = LazyConfig.Instance.Config.uiItem.currentFontFamily; if (!Utils.IsNullOrEmpty(fontFamily)) { var fontPath = Utils.GetFontsPath(); diff --git a/v2rayN/v2rayN/Handler/ClashApiHandler.cs b/v2rayN/v2rayN/Handler/ClashApiHandler.cs index 1e04bf1e..bc2daa76 100644 --- a/v2rayN/v2rayN/Handler/ClashApiHandler.cs +++ b/v2rayN/v2rayN/Handler/ClashApiHandler.cs @@ -87,7 +87,7 @@ namespace v2rayN.Handler return; } var urlBase = $"{GetApiUrl()}/proxies"; - urlBase += @"/{0}/delay?timeout=10000&url=" + LazyConfig.Instance.GetConfig().speedTestItem.speedPingTestUrl; + urlBase += @"/{0}/delay?timeout=10000&url=" + LazyConfig.Instance.Config.speedTestItem.speedPingTestUrl; List tasks = new List(); foreach (var it in lstProxy) diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs index 3fda6adf..09c45c32 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs @@ -206,7 +206,6 @@ namespace v2rayN.Handler }; } - LazyConfig.Instance.SetConfig(config); return 0; } diff --git a/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigHandler.cs b/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigHandler.cs index b1b810dd..b8aa4b40 100644 --- a/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigHandler.cs @@ -20,7 +20,7 @@ namespace v2rayN.Handler.CoreConfig msg = ResUI.CheckServerSettings; return -1; } - var config = LazyConfig.Instance.GetConfig(); + var config = LazyConfig.Instance.Config; msg = ResUI.InitialConfiguration; if (node.configType == EConfigType.Custom) diff --git a/v2rayN/v2rayN/Handler/DownloadHandler.cs b/v2rayN/v2rayN/Handler/DownloadHandler.cs index c6ead790..99ba06a6 100644 --- a/v2rayN/v2rayN/Handler/DownloadHandler.cs +++ b/v2rayN/v2rayN/Handler/DownloadHandler.cs @@ -34,7 +34,7 @@ namespace v2rayN.Handler { try { - Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); + Utils.SetSecurityProtocol(LazyConfig.Instance.Config.guiItem.enableSecurityProtocolTls13); var progress = new Progress(); progress.ProgressChanged += (sender, value) => @@ -66,7 +66,7 @@ namespace v2rayN.Handler { try { - Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); + Utils.SetSecurityProtocol(LazyConfig.Instance.Config.guiItem.enableSecurityProtocolTls13); UpdateCompleted?.Invoke(this, new ResultEventArgs(false, $"{ResUI.Downloading} {url}")); var progress = new Progress(); @@ -96,7 +96,7 @@ namespace v2rayN.Handler public async Task UrlRedirectAsync(string url, bool blProxy) { - Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); + Utils.SetSecurityProtocol(LazyConfig.Instance.Config.guiItem.enableSecurityProtocolTls13); var webRequestHandler = new SocketsHttpHandler { AllowAutoRedirect = false, @@ -185,7 +185,7 @@ namespace v2rayN.Handler { try { - Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); + Utils.SetSecurityProtocol(LazyConfig.Instance.Config.guiItem.enableSecurityProtocolTls13); var webProxy = GetWebProxy(blProxy); var client = new HttpClient(new SocketsHttpHandler() { @@ -230,7 +230,7 @@ namespace v2rayN.Handler { try { - Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); + Utils.SetSecurityProtocol(LazyConfig.Instance.Config.guiItem.enableSecurityProtocolTls13); var webProxy = GetWebProxy(blProxy); @@ -264,7 +264,7 @@ namespace v2rayN.Handler try { - var config = LazyConfig.Instance.GetConfig(); + var config = LazyConfig.Instance.Config; int responseTime = await GetRealPingTime(config.speedTestItem.speedPingTestUrl, webProxy, 10); return responseTime; } diff --git a/v2rayN/v2rayN/Handler/HotkeyHandler.cs b/v2rayN/v2rayN/Handler/HotkeyHandler.cs index d91cddeb..4dbe2ba4 100644 --- a/v2rayN/v2rayN/Handler/HotkeyHandler.cs +++ b/v2rayN/v2rayN/Handler/HotkeyHandler.cs @@ -19,7 +19,7 @@ namespace v2rayN.Handler private Config _config { - get => LazyConfig.Instance.GetConfig(); + get => LazyConfig.Instance.Config; } private Dictionary> _hotkeyTriggerDic; diff --git a/v2rayN/v2rayN/Handler/LazyConfig.cs b/v2rayN/v2rayN/Handler/LazyConfig.cs index 7224c532..62f45298 100644 --- a/v2rayN/v2rayN/Handler/LazyConfig.cs +++ b/v2rayN/v2rayN/Handler/LazyConfig.cs @@ -7,12 +7,12 @@ namespace v2rayN.Handler { private static readonly Lazy _instance = new(() => new()); private Config _config; - - public static LazyConfig Instance => _instance.Value; - private int? _statePort; private int? _statePort2; + public static LazyConfig Instance => _instance.Value; + public Config Config => _config; + public int StatePort { get @@ -45,15 +45,7 @@ namespace v2rayN.Handler #region Config - public void SetConfig(Config config) - { - _config = config; - } - - public Config GetConfig() - { - return _config; - } + public void SetConfig(Config config) => _config = config; public int GetLocalPort(EInboundProtocol protocol) { diff --git a/v2rayN/v2rayN/Handler/UpdateHandler.cs b/v2rayN/v2rayN/Handler/UpdateHandler.cs index a2576bf8..4f2e1be6 100644 --- a/v2rayN/v2rayN/Handler/UpdateHandler.cs +++ b/v2rayN/v2rayN/Handler/UpdateHandler.cs @@ -548,7 +548,7 @@ namespace v2rayN.Handler //} //if (blDownload) //{ - await downloadHandle.DownloadFileAsync(url, true, 600); + await downloadHandle.DownloadFileAsync(url, true, 600); //} } diff --git a/v2rayN/v2rayN/ViewModels/AddServer2ViewModel.cs b/v2rayN/v2rayN/ViewModels/AddServer2ViewModel.cs index 449f3bfe..aa70027e 100644 --- a/v2rayN/v2rayN/ViewModels/AddServer2ViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/AddServer2ViewModel.cs @@ -24,7 +24,7 @@ namespace v2rayN.ViewModels public AddServer2ViewModel(ProfileItem profileItem, Func? updateView) { _noticeHandler = Locator.Current.GetService(); - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _updateView = updateView; if (profileItem.indexId.IsNullOrEmpty()) diff --git a/v2rayN/v2rayN/ViewModels/AddServerViewModel.cs b/v2rayN/v2rayN/ViewModels/AddServerViewModel.cs index 9987f098..bb9f4f0e 100644 --- a/v2rayN/v2rayN/ViewModels/AddServerViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/AddServerViewModel.cs @@ -19,7 +19,7 @@ namespace v2rayN.ViewModels public AddServerViewModel(ProfileItem profileItem, Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; diff --git a/v2rayN/v2rayN/ViewModels/ClashConnectionsViewModel.cs b/v2rayN/v2rayN/ViewModels/ClashConnectionsViewModel.cs index e93f9e16..43de0b5c 100644 --- a/v2rayN/v2rayN/ViewModels/ClashConnectionsViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ClashConnectionsViewModel.cs @@ -31,7 +31,7 @@ namespace v2rayN.ViewModels public ClashConnectionsViewModel(Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _updateView = updateView; SortingSelected = _config.clashUIItem.connectionsSorting; AutoRefresh = _config.clashUIItem.connectionsAutoRefresh; diff --git a/v2rayN/v2rayN/ViewModels/ClashProxiesViewModel.cs b/v2rayN/v2rayN/ViewModels/ClashProxiesViewModel.cs index 97c04f8c..7bb2d92c 100644 --- a/v2rayN/v2rayN/ViewModels/ClashProxiesViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ClashProxiesViewModel.cs @@ -50,7 +50,7 @@ namespace v2rayN.ViewModels public ClashProxiesViewModel(Func? updateView) { _noticeHandler = Locator.Current.GetService(); - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _updateView = updateView; SelectedGroup = new(); diff --git a/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs index 48351d23..ea3ce40d 100644 --- a/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs @@ -28,7 +28,7 @@ namespace v2rayN.ViewModels public DNSSettingViewModel(Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; diff --git a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs index d15388c8..22cd0d44 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -159,7 +159,7 @@ namespace v2rayN.ViewModels public MainWindowViewModel(Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; diff --git a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs index ffb35a7d..286ef3aa 100644 --- a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs @@ -107,7 +107,7 @@ namespace v2rayN.ViewModels public OptionSettingViewModel(Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; @@ -301,7 +301,7 @@ namespace v2rayN.ViewModels _config.hysteriaItem.up_mbps = hyUpMbps; _config.hysteriaItem.down_mbps = hyDownMbps; _config.coreBasicItem.enableFragment = enableFragment; - + _config.guiItem.autoRun = AutoRun; _config.guiItem.enableStatistics = EnableStatistics; _config.guiItem.keepOlderDedupl = KeepOlderDedupl; diff --git a/v2rayN/v2rayN/ViewModels/ProfilesViewModel.cs b/v2rayN/v2rayN/ViewModels/ProfilesViewModel.cs index 4681c91a..6cc41d1e 100644 --- a/v2rayN/v2rayN/ViewModels/ProfilesViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ProfilesViewModel.cs @@ -101,7 +101,7 @@ namespace v2rayN.ViewModels public ProfilesViewModel(Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; diff --git a/v2rayN/v2rayN/ViewModels/RoutingRuleDetailsViewModel.cs b/v2rayN/v2rayN/ViewModels/RoutingRuleDetailsViewModel.cs index 8a049114..087a9546 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingRuleDetailsViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingRuleDetailsViewModel.cs @@ -34,7 +34,7 @@ namespace v2rayN.ViewModels public RoutingRuleDetailsViewModel(RulesItem rulesItem, Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; diff --git a/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs index e3f6b9f7..2468a854 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs @@ -41,7 +41,7 @@ namespace v2rayN.ViewModels public RoutingRuleSettingViewModel(RoutingItem routingItem, Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; SelectedSource = new(); diff --git a/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs index 47c3cf8f..30a9853e 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs @@ -72,7 +72,7 @@ namespace v2rayN.ViewModels public RoutingSettingViewModel(Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; SelectedSource = new(); diff --git a/v2rayN/v2rayN/ViewModels/SubEditViewModel.cs b/v2rayN/v2rayN/ViewModels/SubEditViewModel.cs index 825ed28e..1f6dec86 100644 --- a/v2rayN/v2rayN/ViewModels/SubEditViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/SubEditViewModel.cs @@ -19,7 +19,7 @@ namespace v2rayN.ViewModels public SubEditViewModel(SubItem subItem, Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; diff --git a/v2rayN/v2rayN/ViewModels/SubSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/SubSettingViewModel.cs index 51752eab..e6f9b56d 100644 --- a/v2rayN/v2rayN/ViewModels/SubSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/SubSettingViewModel.cs @@ -30,7 +30,7 @@ namespace v2rayN.ViewModels public SubSettingViewModel(Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; diff --git a/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs index 8e17e499..ffb8cebe 100644 --- a/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs @@ -38,7 +38,7 @@ namespace v2rayN.ViewModels public ThemeSettingViewModel() { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); MainFormHandler.Instance.RegisterSystemColorSet(_config, Application.Current.MainWindow, (bool bl) => { ModifyTheme(bl); }); diff --git a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs index 4a191f4f..c204ad98 100644 --- a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs @@ -38,7 +38,7 @@ namespace v2rayN.Views this.BindCommand(ViewModel, vm => vm.EditServerCmd, v => v.btnEdit).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SaveServerCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs index 61fbe2be..bad8e924 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs @@ -222,7 +222,7 @@ namespace v2rayN.Views }); this.Title = $"{profileItem.configType}"; - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs index 48124dfb..e0c933f0 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs @@ -17,7 +17,7 @@ namespace v2rayN.Views InitializeComponent(); this.Owner = Application.Current.MainWindow; - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; ViewModel = new DNSSettingViewModel(UpdateViewHandler); @@ -54,7 +54,7 @@ namespace v2rayN.Views this.BindCommand(ViewModel, vm => vm.ImportDefConfig4V2rayCmd, v => v.btnImportDefConfig4V2ray).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.ImportDefConfig4SingboxCmd, v => v.btnImportDefConfig4Singbox).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs index b12bb6cc..47f3056a 100644 --- a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs @@ -19,7 +19,7 @@ namespace v2rayN.Views InitializeComponent(); this.Owner = Application.Current.MainWindow; - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _config.globalHotkeys ??= new List(); txtGlobalHotkey0.KeyDown += TxtGlobalHotkey_PreviewKeyDown; diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml.cs b/v2rayN/v2rayN/Views/MainWindow.xaml.cs index 109d2323..34082e9f 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/MainWindow.xaml.cs @@ -25,7 +25,7 @@ namespace v2rayN.Views { InitializeComponent(); - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; App.Current.SessionEnding += Current_SessionEnding; this.Closing += MainWindow_Closing; diff --git a/v2rayN/v2rayN/Views/MsgView.xaml.cs b/v2rayN/v2rayN/Views/MsgView.xaml.cs index a8877cbe..baea1153 100644 --- a/v2rayN/v2rayN/Views/MsgView.xaml.cs +++ b/v2rayN/v2rayN/Views/MsgView.xaml.cs @@ -17,7 +17,7 @@ namespace v2rayN.Views public MsgView() { InitializeComponent(); - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; MessageBus.Current.Listen(Global.CommandSendMsgView).Subscribe(x => DelegateAppendText(x)); Global.PresetMsgFilters.ForEach(it => { diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs index d44fe6f3..01800f50 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs @@ -20,7 +20,7 @@ namespace v2rayN.Views InitializeComponent(); this.Owner = Application.Current.MainWindow; - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; var lstFonts = GetFonts(Utils.GetFontsPath()); ViewModel = new OptionSettingViewModel(UpdateViewHandler); @@ -169,7 +169,7 @@ namespace v2rayN.Views this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/ProfilesView.xaml.cs b/v2rayN/v2rayN/Views/ProfilesView.xaml.cs index e8b4f495..bff475ec 100644 --- a/v2rayN/v2rayN/Views/ProfilesView.xaml.cs +++ b/v2rayN/v2rayN/Views/ProfilesView.xaml.cs @@ -27,7 +27,7 @@ namespace v2rayN.Views InitializeComponent(); lstGroup.MaxHeight = Math.Floor(SystemParameters.WorkArea.Height * 0.20 / 40) * 40; - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; Application.Current.Exit += Current_Exit; btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click; diff --git a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs index 2d1a16bc..ce643ce2 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs @@ -61,7 +61,7 @@ namespace v2rayN.Views this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs index ff6340b4..acd027be 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs @@ -62,7 +62,7 @@ namespace v2rayN.Views this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs index 68560429..f74cdebc 100644 --- a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs @@ -69,7 +69,7 @@ namespace v2rayN.Views this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs index 4c6e7b74..a8fed5b0 100644 --- a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs @@ -40,7 +40,7 @@ namespace v2rayN.Views this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs index 63836f5a..5e1a4ac9 100644 --- a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs @@ -35,7 +35,7 @@ namespace v2rayN.Views this.BindCommand(ViewModel, vm => vm.SubEditCmd, v => v.menuSubEdit).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SubShareCmd, v => v.menuSubShare).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj)