mirror of
https://github.com/2dust/v2rayN.git
synced 2026-09-28 17:42:09 +03:00
Refactor NoticeHandler
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using Splat;
|
||||
using System.Reactive;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
@@ -15,7 +14,7 @@ namespace ServiceLib.ViewModels
|
||||
public SubEditViewModel(SubItem subItem, Func<EViewAction, object?, Task<bool>>? updateView)
|
||||
{
|
||||
_config = AppHandler.Instance.Config;
|
||||
_noticeHandler = Locator.Current.GetService<NoticeHandler>();
|
||||
|
||||
_updateView = updateView;
|
||||
|
||||
if (subItem.id.IsNullOrEmpty())
|
||||
@@ -38,18 +37,18 @@ namespace ServiceLib.ViewModels
|
||||
string remarks = SelectedSource.remarks;
|
||||
if (Utils.IsNullOrEmpty(remarks))
|
||||
{
|
||||
_noticeHandler?.Enqueue(ResUI.PleaseFillRemarks);
|
||||
NoticeHandler.Instance.Enqueue(ResUI.PleaseFillRemarks);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ConfigHandler.AddSubItem(_config, SelectedSource) == 0)
|
||||
{
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess);
|
||||
await _updateView?.Invoke(EViewAction.CloseWindow, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
_noticeHandler?.Enqueue(ResUI.OperationFailed);
|
||||
NoticeHandler.Instance.Enqueue(ResUI.OperationFailed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user