using Prism.Mvvm; using Prism.Regions; using Prism.Services.Dialogs; using SKMC.Api.Client.Model; using SKMC.Api.Client.Access; using SKMC.Api.Client.Views; using SKMC.Api.Common.Exceptions; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SKMC.Api.Client { /// /// 客户端缓存器 /// public abstract class ClientCacher : BindableBase { /// /// UI的区域管理器 /// public IRegionManager RegionManager { get; set; } /// /// UI的对话框管理器 /// public IDialogService DialogService { get; set; } /// /// 角色权限访问接口 /// public IClientRoleAccesser ClientRoleAccesser { get; set; } /// /// 异常窗口的抽象视图模型 /// public ExceptionsViewModel ExceptionsViewModel { get; set; } /// /// 当前登录角色 /// public string CurrentRole { get; set; } /// /// 当前选择的分类 /// public string CurrentCatalog { get; set; } /// /// 分类更改事件 /// public event Action CatalogChanged; /// /// 分类更改动作 /// /// public void CatalogChange(string catalog) { CurrentCatalog = catalog; CatalogChanged?.Invoke(catalog); } //private string _selectView; //public string SelectView //{ // get { return _selectView; } // set { _selectView = value; RaisePropertyChanged(); } //} /// /// 客户端消息集 /// public ObservableCollection ClientMessages { get; set; } = new ObservableCollection(); /// /// 当前未处理的异常 /// public ObservableCollection CurrentExceptions { get; set; } = new ObservableCollection(); /// /// 历史异常记录 /// public ObservableCollection HistoryExceptions { get; set; } = new ObservableCollection(); /// /// 已弹窗的提醒对话框 /// public List ShowCommonDialogs = new List(); /// /// 已弹窗的异常对话框 /// public List ShowExceptionDialogs = new List(); /// /// 界面跳转 /// /// public abstract void Forward(string view); /// /// 弹出通用的对话框 /// /// UI的view层显示名称 /// 参数表 /// 回调函数 /// 是否阻塞控制流程 public abstract string ShowCommonDialog(string viewName, DialogParameters parms, Action callback, bool blocked = true); /// /// 弹出异常对话框 /// /// UI的view层显示名称 /// 异常对象 /// 是否阻塞控制流程 public abstract string ShowExceptionDialog(string viewName, ExceptionShow exception, bool blocked = true); /// /// 查询弹窗是否显示 /// /// /// public abstract bool IsDialogShow(string id); /// /// 关闭指定id的对话框(通知或异常) /// /// public abstract void CloseDialog(string id); /// /// 关闭所有已弹出的对话框(通知或异常) /// public abstract void CloseAllDialogs(); /// /// 清除当前异常 (转移到历史异常中) /// public void ClearExceptions() { HistoryExceptions.AddRange(CurrentExceptions); CurrentExceptions.Clear(); } } }