ViewModel-First (#9621)

* Interaction

* Remove view action

* ViewModel-first

* MainGirdOrientation Hot Reload

* Fix avalonia preview

* Remove CloseWindowInteraction

* Fix

* Avoid threading issues

* Fix

* ProfilesSelect

* Try fix previewer

* Remove AppEvents.ProfilesRefreshRequested

* Remove AppEvents.SubscriptionsRefreshRequested

* Remove AppEvents.ProxiesReloadRequested

* Remove AppEvents.AdjustMainLvColWidthRequested

* Remove AppEvents.SetDefaultServerRequested

* Remove AppEvents.RoutingsMenuRefreshRequested

* Remove AppEvents.TestServerRequested

* Remove AppEvents.InboundDisplayRequested

* Remove AppEvents.SubscriptionsUpdateRequested

* Remove AppEvents.ShowHideWindowRequested

* Remove AppEvents.ReloadRequested

* Remove AppEvents.AddServerRequested

* Fix
This commit is contained in:
DHR60
2026-07-14 01:05:05 +00:00
committed by GitHub
parent 6f50206606
commit 9664ee380e
115 changed files with 2075 additions and 2190 deletions
@@ -1,7 +1,9 @@
namespace ServiceLib.ViewModels;
public class OptionSettingViewModel : MyReactiveObject
public class OptionSettingViewModel : MyReactiveObject, ICloseable
{
public event EventHandler? RequestClose;
#region Core
[Reactive] public int LocalPort { get; set; }
@@ -123,10 +125,9 @@ public class OptionSettingViewModel : MyReactiveObject
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
public OptionSettingViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
public OptionSettingViewModel()
{
_config = AppManager.Instance.Config;
_updateView = updateView;
BlIsWindows = Utils.IsWindows();
BlIsLinux = Utils.IsLinux();
BlIsIsMacOS = Utils.IsMacOS();
@@ -142,8 +143,6 @@ public class OptionSettingViewModel : MyReactiveObject
private async Task Init()
{
await _updateView?.Invoke(EViewAction.InitSettingFont, null);
#region Core
var inbound = _config.Inbound.First();
@@ -314,8 +313,7 @@ public class OptionSettingViewModel : MyReactiveObject
|| DisplayRealTimeSpeed != _config.GuiItem.DisplayRealTimeSpeed
|| EnableDragDropSort != _config.UiItem.EnableDragDropSort
|| EnableHWA != _config.GuiItem.EnableHWA
|| CurrentFontFamily != _config.UiItem.CurrentFontFamily
|| MainGirdOrientation != (int)_config.UiItem.MainGirdOrientation;
|| CurrentFontFamily != _config.UiItem.CurrentFontFamily;
//if (Utile.IsNullOrEmpty(Kcpmtu.ToString()) || !Utile.IsNumeric(Kcpmtu.ToString())
// || Utile.IsNullOrEmpty(Kcptti.ToString()) || !Utile.IsNumeric(Kcptti.ToString())
@@ -432,7 +430,7 @@ public class OptionSettingViewModel : MyReactiveObject
AppManager.Instance.Reset();
NoticeManager.Instance.Enqueue(needReboot ? ResUI.NeedRebootTips : ResUI.OperationSuccess);
_updateView?.Invoke(EViewAction.CloseWindow, null);
RequestClose?.Invoke(this, EventArgs.Empty);
}
else
{