Optimized code

pull/5550/head
2dust 2024-08-15 21:03:00 +08:00
parent 30ff9d0ea9
commit a9860418ba
36 changed files with 46 additions and 54 deletions

View File

@ -59,6 +59,7 @@ namespace v2rayN
Environment.Exit(0); Environment.Exit(0);
return; return;
} }
LazyConfig.Instance.SetConfig(_config);
//Under Win10 //Under Win10
if (Environment.OSVersion.Version.Major < 10) if (Environment.OSVersion.Version.Major < 10)

View File

@ -11,7 +11,7 @@ namespace v2rayN.Converters
{ {
try try
{ {
var fontFamily = LazyConfig.Instance.GetConfig().uiItem.currentFontFamily; var fontFamily = LazyConfig.Instance.Config.uiItem.currentFontFamily;
if (!Utils.IsNullOrEmpty(fontFamily)) if (!Utils.IsNullOrEmpty(fontFamily))
{ {
var fontPath = Utils.GetFontsPath(); var fontPath = Utils.GetFontsPath();

View File

@ -87,7 +87,7 @@ namespace v2rayN.Handler
return; return;
} }
var urlBase = $"{GetApiUrl()}/proxies"; 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<Task> tasks = new List<Task>(); List<Task> tasks = new List<Task>();
foreach (var it in lstProxy) foreach (var it in lstProxy)

View File

@ -206,7 +206,6 @@ namespace v2rayN.Handler
}; };
} }
LazyConfig.Instance.SetConfig(config);
return 0; return 0;
} }

View File

@ -20,7 +20,7 @@ namespace v2rayN.Handler.CoreConfig
msg = ResUI.CheckServerSettings; msg = ResUI.CheckServerSettings;
return -1; return -1;
} }
var config = LazyConfig.Instance.GetConfig(); var config = LazyConfig.Instance.Config;
msg = ResUI.InitialConfiguration; msg = ResUI.InitialConfiguration;
if (node.configType == EConfigType.Custom) if (node.configType == EConfigType.Custom)

View File

@ -34,7 +34,7 @@ namespace v2rayN.Handler
{ {
try try
{ {
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); Utils.SetSecurityProtocol(LazyConfig.Instance.Config.guiItem.enableSecurityProtocolTls13);
var progress = new Progress<string>(); var progress = new Progress<string>();
progress.ProgressChanged += (sender, value) => progress.ProgressChanged += (sender, value) =>
@ -66,7 +66,7 @@ namespace v2rayN.Handler
{ {
try try
{ {
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); Utils.SetSecurityProtocol(LazyConfig.Instance.Config.guiItem.enableSecurityProtocolTls13);
UpdateCompleted?.Invoke(this, new ResultEventArgs(false, $"{ResUI.Downloading} {url}")); UpdateCompleted?.Invoke(this, new ResultEventArgs(false, $"{ResUI.Downloading} {url}"));
var progress = new Progress<double>(); var progress = new Progress<double>();
@ -96,7 +96,7 @@ namespace v2rayN.Handler
public async Task<string?> UrlRedirectAsync(string url, bool blProxy) public async Task<string?> UrlRedirectAsync(string url, bool blProxy)
{ {
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); Utils.SetSecurityProtocol(LazyConfig.Instance.Config.guiItem.enableSecurityProtocolTls13);
var webRequestHandler = new SocketsHttpHandler var webRequestHandler = new SocketsHttpHandler
{ {
AllowAutoRedirect = false, AllowAutoRedirect = false,
@ -185,7 +185,7 @@ namespace v2rayN.Handler
{ {
try try
{ {
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); Utils.SetSecurityProtocol(LazyConfig.Instance.Config.guiItem.enableSecurityProtocolTls13);
var webProxy = GetWebProxy(blProxy); var webProxy = GetWebProxy(blProxy);
var client = new HttpClient(new SocketsHttpHandler() var client = new HttpClient(new SocketsHttpHandler()
{ {
@ -230,7 +230,7 @@ namespace v2rayN.Handler
{ {
try try
{ {
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); Utils.SetSecurityProtocol(LazyConfig.Instance.Config.guiItem.enableSecurityProtocolTls13);
var webProxy = GetWebProxy(blProxy); var webProxy = GetWebProxy(blProxy);
@ -264,7 +264,7 @@ namespace v2rayN.Handler
try try
{ {
var config = LazyConfig.Instance.GetConfig(); var config = LazyConfig.Instance.Config;
int responseTime = await GetRealPingTime(config.speedTestItem.speedPingTestUrl, webProxy, 10); int responseTime = await GetRealPingTime(config.speedTestItem.speedPingTestUrl, webProxy, 10);
return responseTime; return responseTime;
} }

View File

@ -19,7 +19,7 @@ namespace v2rayN.Handler
private Config _config private Config _config
{ {
get => LazyConfig.Instance.GetConfig(); get => LazyConfig.Instance.Config;
} }
private Dictionary<int, List<EGlobalHotkey>> _hotkeyTriggerDic; private Dictionary<int, List<EGlobalHotkey>> _hotkeyTriggerDic;

View File

@ -7,12 +7,12 @@ namespace v2rayN.Handler
{ {
private static readonly Lazy<LazyConfig> _instance = new(() => new()); private static readonly Lazy<LazyConfig> _instance = new(() => new());
private Config _config; private Config _config;
public static LazyConfig Instance => _instance.Value;
private int? _statePort; private int? _statePort;
private int? _statePort2; private int? _statePort2;
public static LazyConfig Instance => _instance.Value;
public Config Config => _config;
public int StatePort public int StatePort
{ {
get get
@ -45,15 +45,7 @@ namespace v2rayN.Handler
#region Config #region Config
public void SetConfig(Config config) public void SetConfig(Config config) => _config = config;
{
_config = config;
}
public Config GetConfig()
{
return _config;
}
public int GetLocalPort(EInboundProtocol protocol) public int GetLocalPort(EInboundProtocol protocol)
{ {

View File

@ -24,7 +24,7 @@ namespace v2rayN.ViewModels
public AddServer2ViewModel(ProfileItem profileItem, Func<EViewAction, object?, bool>? updateView) public AddServer2ViewModel(ProfileItem profileItem, Func<EViewAction, object?, bool>? updateView)
{ {
_noticeHandler = Locator.Current.GetService<NoticeHandler>(); _noticeHandler = Locator.Current.GetService<NoticeHandler>();
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
_updateView = updateView; _updateView = updateView;
if (profileItem.indexId.IsNullOrEmpty()) if (profileItem.indexId.IsNullOrEmpty())

View File

@ -19,7 +19,7 @@ namespace v2rayN.ViewModels
public AddServerViewModel(ProfileItem profileItem, Func<EViewAction, object?, bool>? updateView) public AddServerViewModel(ProfileItem profileItem, Func<EViewAction, object?, bool>? updateView)
{ {
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
_noticeHandler = Locator.Current.GetService<NoticeHandler>(); _noticeHandler = Locator.Current.GetService<NoticeHandler>();
_updateView = updateView; _updateView = updateView;

View File

@ -31,7 +31,7 @@ namespace v2rayN.ViewModels
public ClashConnectionsViewModel(Func<EViewAction, object?, bool>? updateView) public ClashConnectionsViewModel(Func<EViewAction, object?, bool>? updateView)
{ {
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
_updateView = updateView; _updateView = updateView;
SortingSelected = _config.clashUIItem.connectionsSorting; SortingSelected = _config.clashUIItem.connectionsSorting;
AutoRefresh = _config.clashUIItem.connectionsAutoRefresh; AutoRefresh = _config.clashUIItem.connectionsAutoRefresh;

View File

@ -50,7 +50,7 @@ namespace v2rayN.ViewModels
public ClashProxiesViewModel(Func<EViewAction, object?, bool>? updateView) public ClashProxiesViewModel(Func<EViewAction, object?, bool>? updateView)
{ {
_noticeHandler = Locator.Current.GetService<NoticeHandler>(); _noticeHandler = Locator.Current.GetService<NoticeHandler>();
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
_updateView = updateView; _updateView = updateView;
SelectedGroup = new(); SelectedGroup = new();

View File

@ -28,7 +28,7 @@ namespace v2rayN.ViewModels
public DNSSettingViewModel(Func<EViewAction, object?, bool>? updateView) public DNSSettingViewModel(Func<EViewAction, object?, bool>? updateView)
{ {
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
_noticeHandler = Locator.Current.GetService<NoticeHandler>(); _noticeHandler = Locator.Current.GetService<NoticeHandler>();
_updateView = updateView; _updateView = updateView;

View File

@ -159,7 +159,7 @@ namespace v2rayN.ViewModels
public MainWindowViewModel(Func<EViewAction, object?, bool>? updateView) public MainWindowViewModel(Func<EViewAction, object?, bool>? updateView)
{ {
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
_noticeHandler = Locator.Current.GetService<NoticeHandler>(); _noticeHandler = Locator.Current.GetService<NoticeHandler>();
_updateView = updateView; _updateView = updateView;

View File

@ -107,7 +107,7 @@ namespace v2rayN.ViewModels
public OptionSettingViewModel(Func<EViewAction, object?, bool>? updateView) public OptionSettingViewModel(Func<EViewAction, object?, bool>? updateView)
{ {
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
_noticeHandler = Locator.Current.GetService<NoticeHandler>(); _noticeHandler = Locator.Current.GetService<NoticeHandler>();
_updateView = updateView; _updateView = updateView;

View File

@ -101,7 +101,7 @@ namespace v2rayN.ViewModels
public ProfilesViewModel(Func<EViewAction, object?, bool>? updateView) public ProfilesViewModel(Func<EViewAction, object?, bool>? updateView)
{ {
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
_noticeHandler = Locator.Current.GetService<NoticeHandler>(); _noticeHandler = Locator.Current.GetService<NoticeHandler>();
_updateView = updateView; _updateView = updateView;

View File

@ -34,7 +34,7 @@ namespace v2rayN.ViewModels
public RoutingRuleDetailsViewModel(RulesItem rulesItem, Func<EViewAction, object?, bool>? updateView) public RoutingRuleDetailsViewModel(RulesItem rulesItem, Func<EViewAction, object?, bool>? updateView)
{ {
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
_noticeHandler = Locator.Current.GetService<NoticeHandler>(); _noticeHandler = Locator.Current.GetService<NoticeHandler>();
_updateView = updateView; _updateView = updateView;

View File

@ -41,7 +41,7 @@ namespace v2rayN.ViewModels
public RoutingRuleSettingViewModel(RoutingItem routingItem, Func<EViewAction, object?, bool>? updateView) public RoutingRuleSettingViewModel(RoutingItem routingItem, Func<EViewAction, object?, bool>? updateView)
{ {
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
_noticeHandler = Locator.Current.GetService<NoticeHandler>(); _noticeHandler = Locator.Current.GetService<NoticeHandler>();
_updateView = updateView; _updateView = updateView;
SelectedSource = new(); SelectedSource = new();

View File

@ -72,7 +72,7 @@ namespace v2rayN.ViewModels
public RoutingSettingViewModel(Func<EViewAction, object?, bool>? updateView) public RoutingSettingViewModel(Func<EViewAction, object?, bool>? updateView)
{ {
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
_noticeHandler = Locator.Current.GetService<NoticeHandler>(); _noticeHandler = Locator.Current.GetService<NoticeHandler>();
_updateView = updateView; _updateView = updateView;
SelectedSource = new(); SelectedSource = new();

View File

@ -19,7 +19,7 @@ namespace v2rayN.ViewModels
public SubEditViewModel(SubItem subItem, Func<EViewAction, object?, bool>? updateView) public SubEditViewModel(SubItem subItem, Func<EViewAction, object?, bool>? updateView)
{ {
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
_noticeHandler = Locator.Current.GetService<NoticeHandler>(); _noticeHandler = Locator.Current.GetService<NoticeHandler>();
_updateView = updateView; _updateView = updateView;

View File

@ -30,7 +30,7 @@ namespace v2rayN.ViewModels
public SubSettingViewModel(Func<EViewAction, object?, bool>? updateView) public SubSettingViewModel(Func<EViewAction, object?, bool>? updateView)
{ {
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
_noticeHandler = Locator.Current.GetService<NoticeHandler>(); _noticeHandler = Locator.Current.GetService<NoticeHandler>();
_updateView = updateView; _updateView = updateView;

View File

@ -38,7 +38,7 @@ namespace v2rayN.ViewModels
public ThemeSettingViewModel() public ThemeSettingViewModel()
{ {
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
_noticeHandler = Locator.Current.GetService<NoticeHandler>(); _noticeHandler = Locator.Current.GetService<NoticeHandler>();
MainFormHandler.Instance.RegisterSystemColorSet(_config, Application.Current.MainWindow, (bool bl) => { ModifyTheme(bl); }); MainFormHandler.Instance.RegisterSystemColorSet(_config, Application.Current.MainWindow, (bool bl) => { ModifyTheme(bl); });

View File

@ -38,7 +38,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.EditServerCmd, v => v.btnEdit).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.EditServerCmd, v => v.btnEdit).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.SaveServerCmd, v => v.btnSave).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) private bool UpdateViewHandler(EViewAction action, object? obj)

View File

@ -222,7 +222,7 @@ namespace v2rayN.Views
}); });
this.Title = $"{profileItem.configType}"; 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) private bool UpdateViewHandler(EViewAction action, object? obj)

View File

@ -17,7 +17,7 @@ namespace v2rayN.Views
InitializeComponent(); InitializeComponent();
this.Owner = Application.Current.MainWindow; this.Owner = Application.Current.MainWindow;
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
ViewModel = new DNSSettingViewModel(UpdateViewHandler); 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.ImportDefConfig4V2rayCmd, v => v.btnImportDefConfig4V2ray).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.ImportDefConfig4SingboxCmd, v => v.btnImportDefConfig4Singbox).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) private bool UpdateViewHandler(EViewAction action, object? obj)

View File

@ -19,7 +19,7 @@ namespace v2rayN.Views
InitializeComponent(); InitializeComponent();
this.Owner = Application.Current.MainWindow; this.Owner = Application.Current.MainWindow;
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
_config.globalHotkeys ??= new List<KeyEventItem>(); _config.globalHotkeys ??= new List<KeyEventItem>();
txtGlobalHotkey0.KeyDown += TxtGlobalHotkey_PreviewKeyDown; txtGlobalHotkey0.KeyDown += TxtGlobalHotkey_PreviewKeyDown;

View File

@ -25,7 +25,7 @@ namespace v2rayN.Views
{ {
InitializeComponent(); InitializeComponent();
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
App.Current.SessionEnding += Current_SessionEnding; App.Current.SessionEnding += Current_SessionEnding;
this.Closing += MainWindow_Closing; this.Closing += MainWindow_Closing;

View File

@ -17,7 +17,7 @@ namespace v2rayN.Views
public MsgView() public MsgView()
{ {
InitializeComponent(); InitializeComponent();
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
MessageBus.Current.Listen<string>(Global.CommandSendMsgView).Subscribe(x => DelegateAppendText(x)); MessageBus.Current.Listen<string>(Global.CommandSendMsgView).Subscribe(x => DelegateAppendText(x));
Global.PresetMsgFilters.ForEach(it => Global.PresetMsgFilters.ForEach(it =>
{ {

View File

@ -20,7 +20,7 @@ namespace v2rayN.Views
InitializeComponent(); InitializeComponent();
this.Owner = Application.Current.MainWindow; this.Owner = Application.Current.MainWindow;
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
var lstFonts = GetFonts(Utils.GetFontsPath()); var lstFonts = GetFonts(Utils.GetFontsPath());
ViewModel = new OptionSettingViewModel(UpdateViewHandler); ViewModel = new OptionSettingViewModel(UpdateViewHandler);
@ -169,7 +169,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); 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) private bool UpdateViewHandler(EViewAction action, object? obj)

View File

@ -27,7 +27,7 @@ namespace v2rayN.Views
InitializeComponent(); InitializeComponent();
lstGroup.MaxHeight = Math.Floor(SystemParameters.WorkArea.Height * 0.20 / 40) * 40; lstGroup.MaxHeight = Math.Floor(SystemParameters.WorkArea.Height * 0.20 / 40) * 40;
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.Config;
Application.Current.Exit += Current_Exit; Application.Current.Exit += Current_Exit;
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click; btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;

View File

@ -61,7 +61,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); 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) private bool UpdateViewHandler(EViewAction action, object? obj)

View File

@ -62,7 +62,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); 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) private bool UpdateViewHandler(EViewAction action, object? obj)

View File

@ -69,7 +69,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); 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) private bool UpdateViewHandler(EViewAction action, object? obj)

View File

@ -40,7 +40,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); 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) private bool UpdateViewHandler(EViewAction action, object? obj)

View File

@ -35,7 +35,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.SubEditCmd, v => v.menuSubEdit).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SubEditCmd, v => v.menuSubEdit).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.SubShareCmd, v => v.menuSubShare).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) private bool UpdateViewHandler(EViewAction action, object? obj)