/// <summary> /// 切换页面 /// </summary> /// <param name="t"></param> private void Excute(HanderMenuModel module) { try { CurrentPage = module.Body; } catch (Exception ex) { Msg.Error(ex); } finally { GC.Collect(); } }
/// <summary> /// 初始化模块组 /// </summary> public async Task <object> LoadModulesAsync() { try { object currentPage = null; ModuleComponent loader = new ModuleComponent(); var _IModule = await Task.Run(() => loader.GetModules()); if (_IModule == null) { return(null); } int cked = 0; foreach (var m in _IModule.OrderBy(s => s.Sort)) { bool Checked = false; if (cked == 0) { Checked = true; } cked++; HanderMenuModel handerMenu = new HanderMenuModel() { HeaderName = m.Name, HeaderIcon = m.ICON, IsChecked = Checked }; var ass = Assembly.GetExecutingAssembly(); if (ass.CreateInstance(m.ModuleNameSpace) is IModel dialog) { dialog.BindDefaultModel(m.Sort); if (currentPage == null) { currentPage = dialog.GetView(); } handerMenu.Body = dialog.GetView(); } _ModulMenus.Add(handerMenu); } GC.Collect(); return(await Task.FromResult(currentPage)); } catch (Exception ex) { throw ex; } }