/// <summary> /// 开始加载页面 /// </summary> /// <param name="msg"></param> void StartLoadPanel <T>(MsgBase msg) { Menu_View.IsEnabled = true; //加载页面布局后,启用布局菜单项 ViewModelLocator.instence.Main.WindowActionList.Clear(); //清空原本窗口显示列表 LoadMenu(); //加载菜单项 MsgCenter.SendMsg(new MsgBase(AllAppMsg.MenuLoadComplete)); }
void SaveLayout(string LayoutName) { if (!string.IsNullOrEmpty(LayoutName)) { XmlLayoutSerializer serializer = new XmlLayoutSerializer(WorkingArea); //创建序列化器 serializer.Serialize(FileFolder.LinkPath(AppController.GetInstence().appPath, "Frame", FrameController.GetInstence().frameName, "Layout") + LayoutName + ".xml"); //根据路径储存布局 MsgCenter.SendMsg(new MsgVar <string>(AllAppMsg.SaveUserVisible, LayoutName)); } }
/// <summary> /// 加载应用程序数据 /// </summary> void LoadAppData() { mainAppData = new RWXml(appPath, "AppData.xml"); //加载AppData foreach (var path in mainAppData.GetDoubleLayerElements("Load")) //遍历加载所有AppData中的Load信息 { foreach (var file in path.Value) { AllAppData.Add(file.Value, new RXml(appPath + path.Key, file.Key + ".xml")); } } MsgCenter.SendMsg(new MsgBase(AllAppMsg.AppLoadComplete));//程序加载完成 }
public void LoadPanel() { foreach (var panel in FrameController.GetInstence().AllPanelInfo)//创建VM时,添加LayoutItem { switch (panel.Value.panelType) { case PanelType.Page: LayoutPageViewModel tmpPage = new LayoutPageViewModel(panel.Value); pages.Add(tmpPage); break; case PanelType.Window: LayoutWindowViewModel tmpWindow = new LayoutWindowViewModel(panel.Value); windows.Add(tmpWindow); break; } } MsgCenter.SendMsg(new MsgVar <string>(AllAppMsg.LoadLayout, "Last")); }
/// <summary> /// 加载所有的页面结构 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="msg"></param> void StartLoadPanelStruct <T>(MsgBase msg) { //读取所有的页面属性 foreach (string panel in mainFrameData.GetOneElementAllContent("Panel")) { PanelInfo tmpPanel = new PanelInfo() { name = panel, panelType = (PanelType)Enum.Parse(typeof(PanelType), mainFrameData.GetContent("Panel", panel, "PanelType")), package = mainFrameData.GetContent("Panel", panel, "Package"), type = mainFrameData.GetContent("Panel", panel, "Type"), link = mainFrameData.GetOneElementAllContent("Panel", panel, "Link"), feature = mainFrameData.GetOneElementAllContent("Panel", panel, "Feature"), }; allPanelInfo.Add(panel, tmpPanel); CreatePanel(tmpPanel); } MsgCenter.SendMsg(new MsgBase(AllAppMsg.PanelCreateComplete));//框架加载结束 }
void LoadLayout(string LayoutName) { if (!string.IsNullOrEmpty(LayoutName)) { using (AppController.GetInstence().LoadLayoutState.SetScope()) { MsgCenter.SendMsg(new MsgVar <string>(AllAppMsg.LoadUserVisible, LayoutName)); List <string> tmp = new List <string>(ViewModelLocator.instence.Main.WindowActionList.Keys); foreach (string t in tmp) { ViewModelLocator.instence.Main.WindowActionList[t] = true; } MsgCenter.SendMsg(new MsgVar <string>(AllAppMsg.LoadUserVisible, LayoutName)); XmlLayoutSerializer serializer = new XmlLayoutSerializer(WorkingArea);//创建序列化器 serializer.Deserialize(FileFolder.LinkPath(AppController.GetInstence().appPath, "Frame", FrameController.GetInstence().frameName, "Layout") + LayoutName + ".xml"); } } }
/// <summary> /// 加载一个模板 /// </summary> void LoadTemplate <T>(MsgBase msg) { MsgVar <string> tmpMsg = (MsgVar <string>)msg; frameName = tmpMsg.parameter; //加载框架信息 mainFrameData = new RXml(AppController.GetInstence().appPath + "Frame/" + frameName, "FrameData.xml"); foreach (var path in mainFrameData.GetDoubleLayerElements("Load", "Xml")) { foreach (var file in path.Value) { allFrameData.Add(file.Value, new RXml(AppController.GetInstence().appPath + "Frame/" + frameName + "/" + path.Key, file.Key + ".xml")); } } //加载框架所需的包 foreach (var package in mainFrameData.GetAllElementContent("Load", "Package")) { FramePackage p = new FramePackage(package.Value); allPackage.Add(package.Key, p); } MsgCenter.SendMsg(new MsgBase(AllAppMsg.FrameLoadComplete)); }
public void ViewFunction(string t) { MsgCenter.SendMsg(new MsgVarKv <string, string>(AllAppMsg.ViewModelToView, viewModelName, t)); }