mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-03 20:12:07 +03:00
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:
@@ -2,6 +2,8 @@ namespace ServiceLib.ViewModels;
|
||||
|
||||
public class RoutingSettingViewModel : MyReactiveObject
|
||||
{
|
||||
public Interaction<string, bool> ShowYesNoInteraction { get; } = new();
|
||||
|
||||
#region Reactive
|
||||
|
||||
public IObservableCollection<RoutingItemModel> RoutingItems { get; } = new ObservableCollectionExtended<RoutingItemModel>();
|
||||
@@ -26,10 +28,9 @@ public class RoutingSettingViewModel : MyReactiveObject
|
||||
|
||||
#endregion Reactive
|
||||
|
||||
public RoutingSettingViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
|
||||
public RoutingSettingViewModel()
|
||||
{
|
||||
_config = AppManager.Instance.Config;
|
||||
_updateView = updateView;
|
||||
|
||||
var canEditRemove = this.WhenAnyValue(
|
||||
x => x.SelectedSource,
|
||||
@@ -131,7 +132,8 @@ public class RoutingSettingViewModel : MyReactiveObject
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (await _updateView?.Invoke(EViewAction.RoutingRuleSettingWindow, item) == true)
|
||||
var routingRuleSettingViewModel = new RoutingRuleSettingViewModel(item);
|
||||
if (await AppManager.Instance.WindowDialog.ShowDialogAsync(routingRuleSettingViewModel) == true)
|
||||
{
|
||||
await RefreshRoutingItems();
|
||||
IsModified = true;
|
||||
@@ -145,7 +147,7 @@ public class RoutingSettingViewModel : MyReactiveObject
|
||||
NoticeManager.Instance.Enqueue(ResUI.PleaseSelectRules);
|
||||
return;
|
||||
}
|
||||
if (await _updateView?.Invoke(EViewAction.ShowYesNo, null) == false)
|
||||
if (await ShowYesNoInteraction.Handle(ResUI.RemoveServer) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user