/// <summary> /// 加载所有dll完成并在主页面显示 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void loadMainPage_LoadCompleted(object sender, EventArgs e) { FrameworkElement MenuUIElement = null; string pageObjName = string.Empty; try { MainPagePartManager loadmain = sender as MainPagePartManager; asmMain = loadmain.asmMain; pageObjName = strSystemType.Replace(".xap", "") + ".Views" + menuInfo.URLADDRESS.Replace("/", "."); MenuUIElement = asmMain.CreateInstance(pageObjName) as FrameworkElement; Context.allChildSystemAssembly.Add(strSystemType, asmMain); Context.CacheMenuUIElement.Add(menuInfo.MENUCODE, MenuUIElement); //AppContext.AppHost.SetRootVisual(MainPage); } catch (Exception ex) { SMT.SAAS.Main.CurrentContext.AppContext.logAndShow("打开的菜单类为" + pageObjName + " 异常:" + ex.ToString()); } finally { if (OnSystemLoadXapPacketCompleted != null) { LoadModuleEventArgs arg = new LoadModuleEventArgs(MenuUIElement, menuInfo, null); this.OnSystemLoadXapPacketCompleted(null, arg); } } }
/// <summary> /// 更新下载所有dll完毕 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void MainPageManeger_UpdateDllCompleted(object sender, EventArgs e) { #region 自动登录系统 try { MainPageManeger.RunWorkerLoadAssemblyPart(); } catch (Exception ex) { SMT.SAAS.Main.CurrentContext.AppContext.logAndShow(" 自动登录系统出错:" + ex.ToString()); if (OnSystemLoadXapPacketCompleted != null) { LoadModuleEventArgs arg = new LoadModuleEventArgs(null, menuInfo, null); this.OnSystemLoadXapPacketCompleted(null, arg); } } #endregion }
/// <summary> /// 加载子系统完成事件 /// </summary> /// <param name="MenuCode"></param> public void LoadChildSystemModule(string MenuCode) { var entityMenu = (from ent in Context.CacheMenuAll where ent.MENUCODE == MenuCode select ent).FirstOrDefault(); menuInfo = entityMenu; var systemTypeDic = (from ent in Context.CacheSystemType where ent.DICTIONARYVALUE.Value.ToString() == entityMenu.SYSTEMTYPE select ent).FirstOrDefault(); strSystemType = systemTypeDic.SYSTEMNEED; MainPageManeger.LoadXapName = systemTypeDic.SYSTEMNEED; if (Context.allChildSystemAssembly.ContainsKey(systemTypeDic.SYSTEMNEED)) { FrameworkElement MenuPage; if (Context.CacheMenuUIElement.ContainsKey(menuInfo.MENUCODE)) { MenuPage = Context.CacheMenuUIElement[menuInfo.MENUCODE] as FrameworkElement; } else { asmMain = Context.allChildSystemAssembly[systemTypeDic.SYSTEMNEED] as Assembly; string pageObjName = strSystemType.Replace(".xap", "") + ".Views" + menuInfo.URLADDRESS.Replace("/", "."); MenuPage = asmMain.CreateInstance(pageObjName) as FrameworkElement; Context.CacheMenuUIElement.Add(menuInfo.MENUCODE, MenuPage); } if (OnSystemLoadXapPacketCompleted != null) { LoadModuleEventArgs arg = new LoadModuleEventArgs(MenuPage, menuInfo, null); this.OnSystemLoadXapPacketCompleted(null, arg); } } else { MainPageManeger.VertionFileName = systemTypeDic.SYSTEMNEED + ".xml"; MainPageManeger.dllVersionUpdataCheck(); } }
/// <summary> /// 加载子系统完成事件 /// </summary> /// <param name="MenuCode"></param> public void LoadChildSystemModule(string MenuCode) { var entityMenu = (from ent in Context.CacheMenuAll where ent.MENUCODE == MenuCode select ent).FirstOrDefault(); menuInfo = entityMenu; var systemTypeDic=(from ent in Context.CacheSystemType where ent.DICTIONARYVALUE.Value.ToString() == entityMenu.SYSTEMTYPE select ent).FirstOrDefault(); strSystemType = systemTypeDic.SYSTEMNEED; MainPageManeger.LoadXapName = systemTypeDic.SYSTEMNEED; if (Context.allChildSystemAssembly.ContainsKey(systemTypeDic.SYSTEMNEED)) { FrameworkElement MenuPage; if (Context.CacheMenuUIElement.ContainsKey(menuInfo.MENUCODE)) { MenuPage = Context.CacheMenuUIElement[menuInfo.MENUCODE] as FrameworkElement; } else { asmMain = Context.allChildSystemAssembly[systemTypeDic.SYSTEMNEED] as Assembly; string pageObjName = strSystemType.Replace(".xap", "") + ".Views" + menuInfo.URLADDRESS.Replace("/", "."); MenuPage = asmMain.CreateInstance(pageObjName) as FrameworkElement; Context.CacheMenuUIElement.Add(menuInfo.MENUCODE, MenuPage); } if (OnSystemLoadXapPacketCompleted != null) { LoadModuleEventArgs arg = new LoadModuleEventArgs(MenuPage, menuInfo, null); this.OnSystemLoadXapPacketCompleted(null, arg); } } else { MainPageManeger.VertionFileName = systemTypeDic.SYSTEMNEED + ".xml"; MainPageManeger.dllVersionUpdataCheck(); } }
/// <summary> /// 加载所有dll完成并在主页面显示 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void loadMainPage_LoadCompleted(object sender, EventArgs e) { FrameworkElement MenuUIElement=null; string pageObjName = string.Empty; try { MainPagePartManager loadmain = sender as MainPagePartManager; asmMain = loadmain.asmMain; pageObjName = strSystemType.Replace(".xap", "") + ".Views" + menuInfo.URLADDRESS.Replace("/", "."); MenuUIElement = asmMain.CreateInstance(pageObjName) as FrameworkElement; Context.allChildSystemAssembly.Add(strSystemType, asmMain); Context.CacheMenuUIElement.Add(menuInfo.MENUCODE, MenuUIElement); //AppContext.AppHost.SetRootVisual(MainPage); } catch (Exception ex) { SMT.SAAS.Main.CurrentContext.AppContext.logAndShow("打开的菜单类为" + pageObjName + " 异常:"+ex.ToString()); } finally { if (OnSystemLoadXapPacketCompleted != null) { LoadModuleEventArgs arg = new LoadModuleEventArgs(MenuUIElement, menuInfo, null); this.OnSystemLoadXapPacketCompleted(null, arg); } } }