mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-16 01:15:01 +03:00
Code clean (#9482)
This commit is contained in:
@@ -72,14 +72,18 @@ public partial class App : Application
|
||||
|
||||
private async void MenuAddServerViaClipboardClick(object? sender, EventArgs e)
|
||||
{
|
||||
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
try
|
||||
{
|
||||
if (desktop.MainWindow != null)
|
||||
if (Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime { MainWindow: not null })
|
||||
{
|
||||
AppEvents.AddServerViaClipboardRequested.Publish();
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.SaveLog("MenuAddServerViaClipboardClick", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private async void MenuExit_Click(object? sender, EventArgs e)
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ThemeSettingViewModel : MyReactiveObject
|
||||
{
|
||||
_config.UiItem.CurrentTheme = CurrentTheme;
|
||||
ModifyTheme();
|
||||
ConfigHandler.SaveConfig(_config);
|
||||
_ = ConfigHandler.SaveConfig(_config);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ThemeSettingViewModel : MyReactiveObject
|
||||
{
|
||||
_config.UiItem.CurrentFontSize = CurrentFontSize;
|
||||
ModifyFontSize();
|
||||
ConfigHandler.SaveConfig(_config);
|
||||
_ = ConfigHandler.SaveConfig(_config);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ThemeSettingViewModel : MyReactiveObject
|
||||
{
|
||||
_config.UiItem.CurrentLanguage = CurrentLanguage;
|
||||
Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage);
|
||||
ConfigHandler.SaveConfig(_config);
|
||||
_ = ConfigHandler.SaveConfig(_config);
|
||||
NoticeManager.Instance.Enqueue(ResUI.NeedRebootTips);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ public partial class AddServer2Window : WindowBase<AddServer2ViewModel>
|
||||
btnCancel.Click += (s, e) => Close();
|
||||
ViewModel = new AddServer2ViewModel(profileItem, UpdateViewHandler);
|
||||
|
||||
cmbCoreType.ItemsSource = Utils.GetEnumNames<ECoreType>().Where(t => t != ECoreType.v2rayN.ToString()).ToList().AppendEmpty();
|
||||
cmbCoreType.ItemsSource = Utils.GetEnumNames<ECoreType>().Where(t => t != nameof(ECoreType.v2rayN)).ToList().AppendEmpty();
|
||||
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
|
||||
@@ -112,7 +112,7 @@ public partial class ClashConnectionsView : ReactiveUserControl<ClashConnections
|
||||
{
|
||||
try
|
||||
{
|
||||
List<ColumnItem> lvColumnItem = new();
|
||||
List<ColumnItem> lvColumnItem = [];
|
||||
foreach (var item2 in lstConnections.Columns)
|
||||
{
|
||||
if (item2.Tag == null)
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace v2rayN.Desktop.Views;
|
||||
|
||||
public partial class GlobalHotkeySettingWindow : WindowBase<GlobalHotkeySettingViewModel>
|
||||
{
|
||||
private readonly List<object> _textBoxKeyEventItem = new();
|
||||
private readonly List<object> _textBoxKeyEventItem = [];
|
||||
|
||||
public GlobalHotkeySettingWindow()
|
||||
{
|
||||
|
||||
@@ -144,13 +144,13 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
|
||||
AppEvents.ShutdownRequested
|
||||
.AsObservable()
|
||||
.ObserveOn(RxSchedulers.MainThreadScheduler)
|
||||
.Subscribe(content => Shutdown(content))
|
||||
.Subscribe(Shutdown)
|
||||
.DisposeWith(disposables);
|
||||
|
||||
AppEvents.ShowHideWindowRequested
|
||||
.AsObservable()
|
||||
.ObserveOn(RxSchedulers.MainThreadScheduler)
|
||||
.Subscribe(blShow => ShowHideWindow(blShow))
|
||||
.Subscribe(ShowHideWindow)
|
||||
.DisposeWith(disposables);
|
||||
});
|
||||
|
||||
|
||||
@@ -447,7 +447,7 @@ public partial class ProfilesView : ReactiveUserControl<ProfilesViewModel>
|
||||
{
|
||||
try
|
||||
{
|
||||
List<ColumnItem> lvColumnItem = new();
|
||||
List<ColumnItem> lvColumnItem = [];
|
||||
foreach (var item2 in lstProfiles.Columns)
|
||||
{
|
||||
if (item2.Tag == null)
|
||||
|
||||
@@ -47,10 +47,7 @@ public partial class StatusBarView : ReactiveUserControl<StatusBarViewModel>
|
||||
switch (action)
|
||||
{
|
||||
case EViewAction.DispatcherRefreshIcon:
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
RefreshIcon();
|
||||
},
|
||||
Dispatcher.UIThread.Post(RefreshIcon,
|
||||
DispatcherPriority.Default);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user