/// <summary> /// 把环绕块生成控件并加入到 Regions 中。 /// </summary> /// <param name="surrounders"></param> /// <param name="mainView"></param> /// <param name="regions"></param> private void SurroundersToRegions(IList <AggtBlocks> surrounders, LogicalView mainView, RegionContainer regions) { foreach (var surrounder in surrounders) { var surBlock = surrounder.MainBlock as SurrounderBlock; var surrounderType = surBlock.SurrounderType; var surrounderView = this.CreateSurrounderView(mainView, surBlock); //为 Surrouder 生成它的聚合控件 var surrounderControl = this.GenerateCompoundControl(surrounder, surrounderView); regions.Add(surrounderType, surrounderControl); } }
/// <summary> /// 为聚合对象生成组合控件。 /// </summary> /// <param name="aggt"> /// 需要生成聚合控件的聚合对象元数据 /// </param> /// <param name="mainView"> /// 已经生成好的聚合对象 aggt 中的“根”对象所对应的 LogicalView。 /// </param> /// <returns></returns> private ControlResult GenerateCompoundControl(AggtBlocks aggt, LogicalView mainView) { var regions = new RegionContainer(aggt); //如果不要查询面板,则需要生成主区域 var viewInfo = aggt.MainBlock.ViewMeta; regions.Add(TraditionalRegions.Main, AutoUIHelper.CreateBusyControlResult(mainView)); if (mainView.CommandsContainer != null) { regions.Add(TraditionalRegions.CommandsContainer, new ControlResult(mainView.CommandsContainer, mainView)); } //Surrounders this.SurroundersToRegions(aggt.Surrounders, mainView, regions); //Children this.ChildrenToRegions(aggt.Children, mainView, regions); //Layout var layout = CreateLayoutMethod(aggt); var result = layout.Arrange(regions); //在 View 中保存最终布局完成的控件。 mainView.LayoutControl = result; //返回布局后的整个控件。 var ui = new ControlResult(result, mainView, aggt); if (this.GesturesLocation == GesturesLocation.Layout) { this.CreateCommandBindings(ui.Control, ui.MainView); } return(ui); }
/// <summary> /// 把环绕块生成控件并加入到 Regions 中。 /// </summary> /// <param name="surrounders"></param> /// <param name="mainView"></param> /// <param name="regions"></param> private void SurroundersToRegions(IList<AggtBlocks> surrounders, LogicalView mainView, RegionContainer regions) { foreach (var surrounder in surrounders) { var surBlock = surrounder.MainBlock as SurrounderBlock; var surrounderType = surBlock.SurrounderType; var surrounderView = this.CreateSurrounderView(mainView, surBlock); //为 Surrouder 生成它的聚合控件 var surrounderControl = this.GenerateCompoundControl(surrounder, surrounderView); regions.Add(surrounderType, surrounderControl); } }
/// <summary> /// 为聚合对象生成组合控件。 /// </summary> /// <param name="aggt"> /// 需要生成聚合控件的聚合对象元数据 /// </param> /// <param name="mainView"> /// 已经生成好的聚合对象 aggt 中的“根”对象所对应的 LogicalView。 /// </param> /// <returns></returns> private ControlResult GenerateCompoundControl(AggtBlocks aggt, LogicalView mainView) { var regions = new RegionContainer(aggt); //如果不要查询面板,则需要生成主区域 var viewInfo = aggt.MainBlock.ViewMeta; regions.Add(TraditionalRegions.Main, AutoUIHelper.CreateBusyControlResult(mainView)); if (mainView.CommandsContainer != null) { regions.Add(TraditionalRegions.CommandsContainer, new ControlResult(mainView.CommandsContainer, mainView)); } //Surrounders this.SurroundersToRegions(aggt.Surrounders, mainView, regions); //Children this.ChildrenToRegions(aggt.Children, mainView, regions); //Layout var layout = CreateLayoutMethod(aggt); var result = layout.Arrange(regions); //在 View 中保存最终布局完成的控件。 mainView.LayoutControl = result; //返回布局后的整个控件。 var ui = new ControlResult(result, mainView, aggt); if (this.GesturesLocation == GesturesLocation.Layout) { this.CreateCommandBindings(ui.Control, ui.MainView); } return ui; }