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 FullConfigTemplateViewModel : MyReactiveObject
public class FullConfigTemplateViewModel : MyReactiveObject, ICloseable
{
public event EventHandler? RequestClose;
#region Reactive
[Reactive]
@@ -11,16 +13,16 @@ public class FullConfigTemplateViewModel : MyReactiveObject
public bool EnableFullConfigTemplate4Singbox { get; set; }
[Reactive]
public string FullConfigTemplate4Ray { get; set; }
public string FullConfigTemplate4Ray { get; set; } = string.Empty;
[Reactive]
public string FullTunConfigTemplate4Ray { get; set; }
public string FullTunConfigTemplate4Ray { get; set; } = string.Empty;
[Reactive]
public string FullConfigTemplate4Singbox { get; set; }
public string FullConfigTemplate4Singbox { get; set; } = string.Empty;
[Reactive]
public string FullTunConfigTemplate4Singbox { get; set; }
public string FullTunConfigTemplate4Singbox { get; set; } = string.Empty;
[Reactive]
public bool AddProxyOnly4Ray { get; set; }
@@ -29,19 +31,18 @@ public class FullConfigTemplateViewModel : MyReactiveObject
public bool AddProxyOnly4Singbox { get; set; }
[Reactive]
public string ProxyDetour4Ray { get; set; }
public string ProxyDetour4Ray { get; set; } = string.Empty;
[Reactive]
public string ProxyDetour4Singbox { get; set; }
public string ProxyDetour4Singbox { get; set; } = string.Empty;
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
#endregion Reactive
public FullConfigTemplateViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
public FullConfigTemplateViewModel()
{
_config = AppManager.Instance.Config;
_updateView = updateView;
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
{
await SaveSettingAsync();
@@ -84,7 +85,7 @@ public class FullConfigTemplateViewModel : MyReactiveObject
}
NoticeManager.Instance.Enqueue(ResUI.OperationSuccess);
_ = _updateView?.Invoke(EViewAction.CloseWindow, null);
RequestClose?.Invoke(this, EventArgs.Empty);
}
private async Task<bool> SaveXrayConfigAsync()