/// <summary> /// 创建一个页面 /// </summary> /// <param name="name"></param> Control CreatePanel(PanelInfo info) { Control panel = allPackage[info.package].GetElement(info.type); allPanel.Add(info.name, panel); panel.DataContext = allPackage[info.package].GetElement(info.type + "ViewModel", info.name); return(panel); }
public LayoutWindowViewModel(PanelInfo targetStruct) : base(targetStruct) { this.RegistSelf(AllAppMsg.SaveUserVisible, SaveUserVisible <MsgBase>); this.RegistSelf(AllAppMsg.LoadUserVisible, LoadUserVisible <MsgBase>); ViewModelLocator.instence.Main.ActiveDocumentChanged += (sender, e) => { ActiveDocumentChangedCallback((e as VarEventArgs <PanelInfo>).parameter.name); }; ViewModelLocator.instence.Main.WindowActionList.CollectionChanged += ChangeVisible; }
/// <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));//框架加载结束 }
public LayoutPanelViewModelBase(PanelInfo info) { viewModelName = info.name; panelInfo = info; }
public LayoutPageViewModel(PanelInfo targetStruct) : base(targetStruct) { }