private static ConfigInputOutput GetInputOutput(int id) { /*********************** 代码块解释 ********************************* * 此文档说明四种配置模式下的:输入视图及输出视图,以及相应的方法: * * ConfigDefaultView: * 输入:通过某类型代码反射生成的默认视图。 * GetDefaultView(needConfig: false, needCustomization: false) * 输出:主干版本中某类型的默认视图。 * GetDefaultView(needConfig: true, needCustomization: false) * * ConfigExtendView: * 输入:主干版本中某类型的默认视图。 * GetDefaultView(needConfig: true, needCustomization: false) * 输出:主干版本中某类型的自定义扩展视图。 * GetExtendView(valueName, needConfig: true, needCustomization: false) * * CustomizeDefaultView: * 输入:主干版本中某类型的默认视图。 * GetDefaultView(needConfig: true, needCustomization: false) * 输出:分支版本中某类型的默认视图。 * GetDefaultView(needConfig: true, needCustomization: true) * * CustomizeExtendView: * 输入:主干版本中某类型的自定义扩展视图。 * GetExtendView(valueName, needConfig: true, needCustomization: false) * 输出:分支版本中某类型的自定义扩展视图。 * GetExtendView(valueName, needConfig: true, needCustomization: true) **********************************************************************/ var viewId = TryGetViewUniqueId(id); var res = new ConfigInputOutput() { OutputBlockConfigKey = new BlockConfigKey() { EntityType = viewId.EntityType, ExtendView = viewId.ViewName } }; if (!RafyEnvironment.BranchProvider.HasBranch) { res.OutputBlockConfigKey.Type = BlockConfigType.Config; //ConfigDefaultView/ConfigExtendView res.InputView = UIModel.Views.Create(viewId.EntityType, viewId.ViewName, null); } else { res.OutputBlockConfigKey.Type = BlockConfigType.Customization; //CustomizeDefaultView,CustomizeExtendView res.InputView = UIModel.Views.Create(viewId.EntityType, viewId.ViewName, BlockConfigType.Config); } return(res); }
private void SerializeCommands(ConfigInputOutput io, BlockConfig blockConfig) { bool isWeb = RafyEnvironment.Location.IsWebUI; foreach (var cmdChanged in this.ViewConfigurationCommandList) { //查找或添加一个新的属性配置项。 bool exsits = true; var cmdCfg = blockConfig.Commands.FirstOrDefault(p => p.Name == cmdChanged.Name); if (cmdCfg == null) { cmdCfg = new BlockCommandConfig() { Name = cmdChanged.Name }; exsits = false; } //重算所有属性值。 if (isWeb) { var cmdVM = io.InputView.AsWebView().Commands.Find(cmdChanged.Name); cmdCfg.Label = cmdChanged.Label != cmdVM.Label ? cmdChanged.Label : null; cmdCfg.IsVisible = cmdChanged.IsVisible != cmdVM.IsVisible ? (bool?)cmdChanged.IsVisible : null; } else { var cmdVM = io.InputView.AsWPFView().Commands.Find(cmdChanged.Name); cmdCfg.Label = cmdChanged.Label != cmdVM.Label ? cmdChanged.Label : null; cmdCfg.IsVisible = cmdChanged.IsVisible != cmdVM.IsVisible ? (bool?)cmdChanged.IsVisible : null; } //如果配置项有用,则加入到列表中,否则应该从列表中移除。 if (cmdCfg.IsChanged()) { if (!exsits) { blockConfig.Commands.Add(cmdCfg); } } else { if (exsits) { blockConfig.Commands.Remove(cmdCfg); } } } }
private void SerializeEntityProperties(ConfigInputOutput io, BlockConfig blockConfig) { var properties = blockConfig.EntityProperties; foreach (var propertyChanged in this.ViewConfigurationPropertyList) { //查找或添加一个新的属性配置项。 bool exsits = true; var propertyCfg = properties.FirstOrDefault(p => p.Name == propertyChanged.Name); if (propertyCfg == null) { propertyCfg = new BlockPropertyConfig() { Name = propertyChanged.Name }; exsits = false; } //重算所有属性值。 var propertyVM = io.InputView.Property(propertyChanged.Name); var siw = (ShowInWhere)propertyChanged.ShowInWhere; propertyCfg.ShowInWhere = siw != propertyVM.ShowInWhere ? (ShowInWhere?)siw : null; propertyCfg.OrderNo = propertyChanged.OrderNo != propertyVM.OrderNo ? (double?)propertyChanged.OrderNo : null; propertyCfg.Label = propertyChanged.Label != propertyVM.Label ? propertyChanged.Label : null; //如果配置项有用,则加入到列表中,否则应该从列表中移除。 if (propertyCfg.IsChanged()) { if (!exsits) { properties.Add(propertyCfg); } } else { if (exsits) { properties.Remove(propertyCfg); } } } }
private void SerializeProperties(ConfigInputOutput io, BlockConfig blockConfig) { if (io.InputView is WebEntityViewMeta) { blockConfig.PageSize = (this.PageSize != io.InputView.AsWebView().PageSize) ? (int?)this.PageSize : null; } var hasGroup = !string.IsNullOrEmpty(this.GroupBy); if (io.InputView.GroupBy == null) { blockConfig.GroupBy = hasGroup ? this.GroupBy : null; } else { if (hasGroup) { blockConfig.GroupBy = io.InputView.GroupBy.Name != this.GroupBy ? this.GroupBy : null; } else { blockConfig.GroupBy = BlockConfig.NullString; } } }
private static ConfigInputOutput GetInputOutput(int id) { /*********************** 代码块解释 ********************************* * 此文档说明四种配置模式下的:输入视图及输出视图,以及相应的方法: * * ConfigDefaultView: * 输入:通过某类型代码反射生成的默认视图。 * GetDefaultView(needConfig: false, needCustomization: false) * 输出:主干版本中某类型的默认视图。 * GetDefaultView(needConfig: true, needCustomization: false) * * ConfigExtendView: * 输入:主干版本中某类型的默认视图。 * GetDefaultView(needConfig: true, needCustomization: false) * 输出:主干版本中某类型的自定义扩展视图。 * GetExtendView(valueName, needConfig: true, needCustomization: false) * * CustomizeDefaultView: * 输入:主干版本中某类型的默认视图。 * GetDefaultView(needConfig: true, needCustomization: false) * 输出:分支版本中某类型的默认视图。 * GetDefaultView(needConfig: true, needCustomization: true) * * CustomizeExtendView: * 输入:主干版本中某类型的自定义扩展视图。 * GetExtendView(valueName, needConfig: true, needCustomization: false) * 输出:分支版本中某类型的自定义扩展视图。 * GetExtendView(valueName, needConfig: true, needCustomization: true) **********************************************************************/ var viewId = TryGetViewUniqueId(id); var res = new ConfigInputOutput() { OutputBlockConfigKey = new BlockConfigKey() { EntityType = viewId.EntityType, ExtendView = viewId.ViewName } }; if (!RafyEnvironment.BranchProvider.HasBranch) { res.OutputBlockConfigKey.Type = BlockConfigType.Config; //ConfigDefaultView/ConfigExtendView res.InputView = UIModel.Views.Create(viewId.EntityType, viewId.ViewName, null); } else { res.OutputBlockConfigKey.Type = BlockConfigType.Customization; //CustomizeDefaultView,CustomizeExtendView res.InputView = UIModel.Views.Create(viewId.EntityType, viewId.ViewName, BlockConfigType.Config); } return res; }