Skip to content

Commit d727ff4

Browse files
committed
Code clean
1 parent 1b5069a commit d727ff4

16 files changed

Lines changed: 57 additions & 57 deletions

v2rayN/v2rayN.Desktop/GlobalUsings.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
global using Avalonia.Media;
1818
global using Avalonia.Media.Imaging;
1919
global using Avalonia.Platform;
20-
global using ReactiveUI.Avalonia;
2120
global using Avalonia.Styling;
2221
global using Avalonia.Threading;
23-
global using ReactiveUI;
24-
global using ReactiveUI.Fody.Helpers;
2522
global using DynamicData;
2623
global using MsBox.Avalonia.Enums;
24+
global using ReactiveUI;
25+
global using ReactiveUI.Avalonia;
26+
global using ReactiveUI.Fody.Helpers;
2727
global using ServiceLib;
2828
global using ServiceLib.Base;
2929
global using ServiceLib.Common;

v2rayN/v2rayN.Desktop/Views/AddGroupServerWindow.axaml.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public AddGroupServerWindow(ProfileItem profileItem)
1313
{
1414
InitializeComponent();
1515

16-
this.Loaded += Window_Loaded;
17-
btnCancel.Click += (s, e) => this.Close();
16+
Loaded += Window_Loaded;
17+
btnCancel.Click += (s, e) => Close();
1818
lstChild.SelectionChanged += LstChild_SelectionChanged;
1919

2020
ViewModel = new AddGroupServerViewModel(profileItem, UpdateViewHandler);
@@ -32,11 +32,11 @@ public AddGroupServerWindow(ProfileItem profileItem)
3232
switch (profileItem.ConfigType)
3333
{
3434
case EConfigType.PolicyGroup:
35-
this.Title = ResUI.TbConfigTypePolicyGroup;
35+
Title = ResUI.TbConfigTypePolicyGroup;
3636
break;
3737

3838
case EConfigType.ProxyChain:
39-
this.Title = ResUI.TbConfigTypeProxyChain;
39+
Title = ResUI.TbConfigTypeProxyChain;
4040
gridPolicyGroup.IsVisible = false;
4141
break;
4242
}
@@ -64,7 +64,7 @@ public AddGroupServerWindow(ProfileItem profileItem)
6464
menuSelectAllChild.Click += (s, e) => lstChild.SelectAll();
6565

6666
// Keyboard shortcuts when focus is within grid
67-
this.AddHandler(KeyDownEvent, AddGroupServerWindow_KeyDown, RoutingStrategies.Tunnel);
67+
AddHandler(KeyDownEvent, AddGroupServerWindow_KeyDown, RoutingStrategies.Tunnel);
6868
lstChild.LoadingRow += LstChild_LoadingRow;
6969
}
7070

@@ -78,7 +78,7 @@ private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
7878
switch (action)
7979
{
8080
case EViewAction.CloseWindow:
81-
this.Close(true);
81+
Close(true);
8282
break;
8383
}
8484
return await Task.FromResult(true);

v2rayN/v2rayN.Desktop/Views/AddServer2Window.axaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public AddServer2Window(ProfileItem profileItem)
1414
{
1515
InitializeComponent();
1616

17-
this.Loaded += Window_Loaded;
18-
btnCancel.Click += (s, e) => this.Close();
17+
Loaded += Window_Loaded;
18+
btnCancel.Click += (s, e) => Close();
1919
ViewModel = new AddServer2ViewModel(profileItem, UpdateViewHandler);
2020

2121
cmbCoreType.ItemsSource = Utils.GetEnumNames<ECoreType>().Where(t => t != ECoreType.v2rayN.ToString()).ToList().AppendEmpty();
@@ -39,7 +39,7 @@ private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
3939
switch (action)
4040
{
4141
case EViewAction.CloseWindow:
42-
this.Close(true);
42+
Close(true);
4343
break;
4444

4545
case EViewAction.BrowseServer:

v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public AddServerWindow(ProfileItem profileItem)
1313
{
1414
InitializeComponent();
1515

16-
this.Loaded += Window_Loaded;
17-
btnCancel.Click += (s, e) => this.Close();
16+
Loaded += Window_Loaded;
17+
btnCancel.Click += (s, e) => Close();
1818
cmbNetwork.SelectionChanged += CmbNetwork_SelectionChanged;
1919
cmbStreamSecurity.SelectionChanged += CmbStreamSecurity_SelectionChanged;
2020
btnGUID.Click += btnGUID_Click;
@@ -196,15 +196,15 @@ public AddServerWindow(ProfileItem profileItem)
196196
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
197197
});
198198

199-
this.Title = $"{profileItem.ConfigType}";
199+
Title = $"{profileItem.ConfigType}";
200200
}
201201

202202
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
203203
{
204204
switch (action)
205205
{
206206
case EViewAction.CloseWindow:
207-
this.Close(true);
207+
Close(true);
208208
break;
209209
}
210210
return await Task.FromResult(true);

v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public ClashProxiesView()
77
InitializeComponent();
88
ViewModel = new ClashProxiesViewModel(UpdateViewHandler);
99
lstProxyDetails.DoubleTapped += LstProxyDetails_DoubleTapped;
10-
this.KeyDown += ClashProxiesView_KeyDown;
10+
KeyDown += ClashProxiesView_KeyDown;
1111

1212
this.WhenActivated(disposables =>
1313
{

v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public DNSSettingWindow()
1212

1313
_config = AppManager.Instance.Config;
1414
Loaded += Window_Loaded;
15-
btnCancel.Click += (s, e) => this.Close();
15+
btnCancel.Click += (s, e) => Close();
1616
ViewModel = new DNSSettingViewModel(UpdateViewHandler);
1717

1818
cmbRayFreedomDNSStrategy.ItemsSource = Global.DomainStrategy4Freedoms;
@@ -77,7 +77,7 @@ private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
7777
switch (action)
7878
{
7979
case EViewAction.CloseWindow:
80-
this.Close(true);
80+
Close(true);
8181
break;
8282
}
8383
return await Task.FromResult(true);

v2rayN/v2rayN.Desktop/Views/FullConfigTemplateWindow.axaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public FullConfigTemplateWindow()
1212

1313
_config = AppManager.Instance.Config;
1414
Loaded += Window_Loaded;
15-
btnCancel.Click += (s, e) => this.Close();
15+
btnCancel.Click += (s, e) => Close();
1616
ViewModel = new FullConfigTemplateViewModel(UpdateViewHandler);
1717

1818
this.WhenActivated(disposables =>
@@ -36,7 +36,7 @@ private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
3636
switch (action)
3737
{
3838
case EViewAction.CloseWindow:
39-
this.Close(true);
39+
Close(true);
4040
break;
4141
}
4242
return await Task.FromResult(true);

v2rayN/v2rayN.Desktop/Views/GlobalHotkeySettingWindow.axaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public GlobalHotkeySettingWindow()
1717

1818
HotkeyManager.Instance.IsPause = true;
1919
Loaded += Window_Loaded;
20-
this.Closing += (s, e) => HotkeyManager.Instance.IsPause = false;
21-
btnCancel.Click += (s, e) => this.Close();
20+
Closing += (s, e) => HotkeyManager.Instance.IsPause = false;
21+
btnCancel.Click += (s, e) => Close();
2222

2323
this.WhenActivated(disposables =>
2424
{
@@ -34,7 +34,7 @@ private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
3434
switch (action)
3535
{
3636
case EViewAction.CloseWindow:
37-
this.Close(true);
37+
Close(true);
3838
break;
3939
}
4040
return await Task.FromResult(true);

v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public MainWindow()
2121
_config = AppManager.Instance.Config;
2222
_manager = new WindowNotificationManager(TopLevel.GetTopLevel(this)) { MaxItems = 3, Position = NotificationPosition.TopRight };
2323

24-
this.KeyDown += MainWindow_KeyDown;
24+
KeyDown += MainWindow_KeyDown;
2525
menuSettingsSetUWP.Click += menuSettingsSetUWP_Click;
2626
menuPromotion.Click += menuPromotion_Click;
2727
menuCheckUpdate.Click += MenuCheckUpdate_Click;
@@ -153,14 +153,14 @@ public MainWindow()
153153

154154
if (Utils.IsWindows())
155155
{
156-
this.Title = $"{Utils.GetVersion()} - {(Utils.IsAdministrator() ? ResUI.RunAsAdmin : ResUI.NotRunAsAdmin)}";
156+
Title = $"{Utils.GetVersion()} - {(Utils.IsAdministrator() ? ResUI.RunAsAdmin : ResUI.NotRunAsAdmin)}";
157157

158158
ThreadPool.RegisterWaitForSingleObject(Program.ProgramStarted, OnProgramStarted, null, -1, false);
159159
HotkeyManager.Instance.Init(_config, OnHotkeyHandler);
160160
}
161161
else
162162
{
163-
this.Title = $"{Utils.GetVersion()}";
163+
Title = $"{Utils.GetVersion()}";
164164

165165
menuRebootAsAdmin.IsVisible = false;
166166
menuSettingsSetUWP.IsVisible = false;
@@ -170,7 +170,7 @@ public MainWindow()
170170

171171
if (_config.UiItem.AutoHideStartup && Utils.IsWindows())
172172
{
173-
this.WindowState = WindowState.Minimized;
173+
WindowState = WindowState.Minimized;
174174
}
175175

176176
AddHelpMenuItem();
@@ -407,27 +407,27 @@ public void ShowHideWindow(bool? blShow)
407407
: !_config.UiItem.ShowInTaskbar);
408408
if (bl)
409409
{
410-
this.Show();
411-
if (this.WindowState == WindowState.Minimized)
410+
Show();
411+
if (WindowState == WindowState.Minimized)
412412
{
413-
this.WindowState = WindowState.Normal;
413+
WindowState = WindowState.Normal;
414414
}
415-
this.Activate();
416-
this.Focus();
415+
Activate();
416+
Focus();
417417
}
418418
else
419419
{
420420
if (Utils.IsLinux() && _config.UiItem.Hide2TrayWhenClose == false)
421421
{
422-
this.WindowState = WindowState.Minimized;
422+
WindowState = WindowState.Minimized;
423423
return;
424424
}
425425

426-
foreach (var ownedWindow in this.OwnedWindows)
426+
foreach (var ownedWindow in OwnedWindows)
427427
{
428428
ownedWindow.Close();
429429
}
430-
this.Hide();
430+
Hide();
431431
}
432432

433433
_config.UiItem.ShowInTaskbar = bl;

v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public OptionSettingWindow()
1111
InitializeComponent();
1212

1313
Loaded += Window_Loaded;
14-
btnCancel.Click += (s, e) => this.Close();
14+
btnCancel.Click += (s, e) => Close();
1515
_config = AppManager.Instance.Config;
1616

1717
ViewModel = new OptionSettingViewModel(UpdateViewHandler);
@@ -153,7 +153,7 @@ private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
153153
switch (action)
154154
{
155155
case EViewAction.CloseWindow:
156-
this.Close(true);
156+
Close(true);
157157
break;
158158

159159
case EViewAction.InitSettingFont:

0 commit comments

Comments
 (0)