Clean code

pull/5550/head
2dust 2024-08-10 19:20:31 +08:00
parent 2504b4737b
commit 3dd75b17cf
5 changed files with 9 additions and 20 deletions

View File

@ -2,18 +2,18 @@
{ {
public enum EViewAction public enum EViewAction
{ {
AdjustMainLvColWidth,
ProfilesFocus,
CloseWindow, CloseWindow,
ShowYesNo, ShowYesNo,
AddBatchRoutingRulesYesNo, AddBatchRoutingRulesYesNo,
AdjustMainLvColWidth,
ProfilesFocus,
ShareSub,
ShareServer,
SubEditWindow, SubEditWindow,
SubShare,
RoutingRuleSettingWindow, RoutingRuleSettingWindow,
RoutingRuleDetailsWindow, RoutingRuleDetailsWindow,
AddServerWindow, AddServerWindow,
AddServer2Window, AddServer2Window,
ShareServer,
DNSSettingWindow, DNSSettingWindow,
RoutingSettingWindow, RoutingSettingWindow,
OptionSettingWindow, OptionSettingWindow,

View File

@ -439,10 +439,6 @@ namespace v2rayN.ViewModels
{ {
Reload(); Reload();
} }
if (_config.uiItem.enableAutoAdjustMainLvColWidth)
{
_updateView?.Invoke(EViewAction.AdjustMainLvColWidth, null);
}
} }
} }

View File

@ -56,7 +56,7 @@ namespace v2rayN.ViewModels
}, canEditRemove); }, canEditRemove);
SubShareCmd = ReactiveCommand.Create(() => SubShareCmd = ReactiveCommand.Create(() =>
{ {
_updateView?.Invoke(EViewAction.SubShare, SelectedSource?.url); _updateView?.Invoke(EViewAction.ShareSub, SelectedSource?.url);
}, canEditRemove); }, canEditRemove);
} }

View File

@ -100,14 +100,7 @@ namespace v2rayN.Views
private bool UpdateViewHandler(EViewAction action, object? obj) private bool UpdateViewHandler(EViewAction action, object? obj)
{ {
if (action == EViewAction.AdjustMainLvColWidth) if (action == EViewAction.ProfilesFocus)
{
Application.Current.Dispatcher.Invoke(() =>
{
AutofitColumnWidth();
});
}
else if (action == EViewAction.ProfilesFocus)
{ {
lstProfiles.Focus(); lstProfiles.Focus();
} }

View File

@ -54,15 +54,15 @@ namespace v2rayN.Views
if (obj is null) return false; if (obj is null) return false;
return (new SubEditWindow((SubItem)obj)).ShowDialog() ?? false; return (new SubEditWindow((SubItem)obj)).ShowDialog() ?? false;
} }
else if (action == EViewAction.SubShare) else if (action == EViewAction.ShareSub)
{ {
if (obj is null) return false; if (obj is null) return false;
SubShare((string)obj); ShareSub((string)obj);
} }
return true; return true;
} }
private async void SubShare(string url) private async void ShareSub(string url)
{ {
if (Utils.IsNullOrEmpty(url)) if (Utils.IsNullOrEmpty(url))
{ {