/// <summary> /// 创建映射字典实例 /// </summary> /// <param name="type">导出类型</param> public static IDictionary <string, PropertySetting> CreateInstance(Type type) { if (MappingDict.TryGetValue(type, out var dict)) { return(dict); } dict = new Dictionary <string, PropertySetting>(); foreach (var propertyInfo in type.GetProperties()) { var setting = new PropertySetting(); if (propertyInfo.HasIgnore()) { setting.Ignored = true; } if (HasDynamicColumn(propertyInfo)) { setting.IsDynamicColumn = true; } SetColumnName(propertyInfo, setting); SetFormatter(propertyInfo, setting); SetScale(propertyInfo, setting); SetValueMapping(propertyInfo, setting); dict[propertyInfo.Name] = setting; } MappingDict[type] = dict; return(dict); }
public override void Init(params object[] args) { base.Init(args); //propertySetting = args[0] as PropertySetting; singlePropertyData = args[0] as SinglePropertyData; propertySetting = DataTable.FindPropertySetting(singlePropertyData.PropertyId); }
/// <summary> /// 初始化属性 /// </summary> public void InitProperty(PropertyData propertyData) { propertyData.ExamPropertyDataList.Clear(); propertyData.ExamPropertyIdList.Clear(); propertyData.PropertyIdList.Clear(); propertyData.PropertyDataList.Clear(); ///先把初始随机的属性赋值 for (int i = 0; i < DataTable._propertyList.Count; i++) { PropertySetting setting = DataTable._propertyList[i]; //若是初始随机的属性,则按照配置表随机一个值 if (setting.isInitRdm == "1") { SinglePropertyData singlePro = new SinglePropertyData(); singlePro.PropertyLimit = setting.haveLimit.ToInt32(); singlePro.PropertyId = setting.id.ToInt32(); string[] rdmRange = setting.newRdmRange.Split('|'); int val = RandomManager.Next(rdmRange[0].ToInt32(), rdmRange[1].ToInt32()); propertyData.PropertyIdList.Add(setting.id.ToInt32()); singlePro.PropertyNum = val; propertyData.PropertyDataList.Add(singlePro); } } RefreshProperty(propertyData); }
public PropertySetting GetGridDynamicColumnSetting(Func <IUnitOfWork> lazyLoadedUnitOfWork, string gridName, object instance) { var setting = new PropertySetting(); var gridColumn = _gridDynamicColumns.SingleOrDefault(grid => grid.Key == gridName); if (gridColumn.Value != null) { if (gridColumn.Value.TimeStamp.AddHours(1) >= DateTime.Now) { return new PropertySetting { AdditionPropertyDictionary = GetDynamicFieldAndAssignValue(lazyLoadedUnitOfWork, gridName, instance), Properties = gridColumn.Value.StaticColumns, } } ; GridDynamicColumn dynamicColumn; _gridDynamicColumns.TryRemove(gridName, out dynamicColumn); return(new PropertySetting { AdditionPropertyDictionary = GetDynamicFieldAndAssignValue(lazyLoadedUnitOfWork, gridName, instance), Properties = gridColumn.Value.StaticColumns, }); } setting.AdditionPropertyDictionary = GetDynamicFieldAndAssignValue(lazyLoadedUnitOfWork, gridName, instance); setting.Properties = _gridDynamicColumns.Single(o => o.Key == gridName).Value.StaticColumns; return(setting); }
/// <summary> /// Initializes a new instance of the <see cref="PropertySettingHelper"/> class. /// </summary> /// <param name="properties">The properties.</param> public PropertySettingHelper(PropertySetting[] properties) { this.properties = new Dictionary<string, PropertySetting>(); foreach (PropertySetting property in properties) { this.properties.Add(property.propertyName, property); } }
private void SetZIndex(RadElement element, int zIndex) { PropertySetting setting = new PropertySetting( VisualElement.ZIndexProperty, zIndex ); setting.ApplyValue(element); }
/// <summary> /// 设置格式化字符串 /// </summary> /// <param name="propertyInfo">属性信息</param> /// <param name="setting">属性设置</param> private static void SetFormatter(PropertyInfo propertyInfo, PropertySetting setting) { var attribute = propertyInfo.GetCustomAttribute <DataFormatAttribute>(); if (attribute != null) { setting.Formatter = attribute.CustomFormat; } }
/// <summary> /// 通过setting获取属性数值 /// </summary> /// <param name="propertySetting"></param> /// <returns></returns> int GetRdmProperty(PropertyIdType id) { PropertySetting propertySetting = DataTable.FindPropertySetting((int)id); string[] rdmRange = propertySetting.newRdmRange.Split('|'); int val = RandomManager.Next(rdmRange[0].ToInt32(), rdmRange[1].ToInt32()); return(val); }
/// <summary> /// 初始化人物属性 /// </summary> /// <param name="propertyData"></param> /// <param name="idType"></param> /// <param name="propertyNum"></param> public void InitSingleProperty(PropertyData propertyData, PropertyIdType idType, float propertyNum, bool isExamBattle) { PropertySetting setting = DataTable.FindPropertySetting((int)idType); //PropertyData propertyData = new PropertyData(); //如果属性为-1 说明是考试属性 从property表读取 if (isExamBattle) { //TestEnemyNumerialSetting examSetting = DataTable.FindTestNumerial((int)idType)); ////考试数值需要和等级挂钩 //SinglePropertyData examPro = new SinglePropertyData(); //examPro.PropertyId = (int)idType; //examPro.PropertyNum = propertyNum; //examPro.PropertyLimit = -1; //curExamProperty不应该在这里赋值 而应该在考试时赋值 //propertyData.CurExamPropertyIdList.Add((int)idType); //propertyData.CurExamPropertyDataList.Add(examPro); if (propertyData.ExamPropertyIdList.Contains((int)idType)) { int index = propertyData.ExamPropertyIdList.IndexOf((int)idType); propertyData.ExamPropertyDataList[index].PropertyNum = propertyNum; } else { SinglePropertyData initsinglePropertyData = new SinglePropertyData(); initsinglePropertyData.PropertyId = (int)idType; initsinglePropertyData.PropertyNum = propertyNum; initsinglePropertyData.PropertyLimit = -1; propertyData.ExamPropertyIdList.Add((int)idType); propertyData.ExamPropertyDataList.Add(initsinglePropertyData); } } else { if (propertyData.PropertyIdList.Contains((int)idType)) { int index = propertyData.PropertyIdList.IndexOf((int)idType); propertyData.PropertyDataList[index].PropertyNum = propertyNum; } else { SinglePropertyData singlePropertyData = new SinglePropertyData(); singlePropertyData.PropertyId = (int)idType; singlePropertyData.PropertyNum = propertyNum; singlePropertyData.PropertyLimit = setting.haveLimit.ToInt32(); propertyData.PropertyIdList.Add((int)idType); propertyData.PropertyDataList.Add(singlePropertyData); } } //return singlePropertyData; }
private void InitializeVisibilityModifierValue(IPropertySetting setting) { PropertySetting propSetting = setting as PropertySetting; if (propSetting == null || !(propSetting.Value is ElementVisibility)) { return; } this.visibilityModifierValue = (ElementVisibility)propSetting.Value; }
///// <summary> ///// 学习升级 ///// </summary> //void OnUpgrade() //{ // InitSingleProperty(playerPeople.protoData.PropertyData, PropertyIdType.Hp, DataTable.FindTestNumerialByLevel(playerPeople.protoData.PropertyData.Level).hp.ToFloat(), true); // InitSingleProperty(playerPeople.protoData.PropertyData, PropertyIdType.Attack, DataTable.FindTestNumerialByLevel(playerPeople.protoData.PropertyData.Level).attack.ToFloat(), true); // InitSingleProperty(playerPeople.protoData.PropertyData, PropertyIdType.Defense, DataTable.FindTestNumerialByLevel(playerPeople.protoData.PropertyData.Level).defense.ToFloat(), true); // InitSingleProperty(playerPeople.protoData.PropertyData, PropertyIdType.CritNum, DataTable.FindTestNumerialByLevel(playerPeople.protoData.PropertyData.Level).crit.ToFloat(), true); // InitSingleProperty(playerPeople.protoData.PropertyData, PropertyIdType.Speed, DataTable.FindTestNumerialByLevel(playerPeople.protoData.PropertyData.Level).attackSpeed.ToFloat(), true); // InitSingleProperty(playerPeople.protoData.PropertyData, PropertyIdType.CritRate, DataTable.FindTestNumerialByLevel(playerPeople.protoData.PropertyData.Level).critRate.ToFloat(), true); // InitSingleProperty(playerPeople.protoData.PropertyData, PropertyIdType.SkillAdd, DataTable.FindTestNumerialByLevel(playerPeople.protoData.PropertyData.Level).skillHurtAdd.ToFloat(), true); // InitSingleProperty(playerPeople.protoData.PropertyData, PropertyIdType.StudyCharm, DataTable.FindTestNumerialByLevel(playerPeople.protoData.PropertyData.Level).studyCharm.ToFloat(), false); // InitSingleProperty(playerPeople.protoData.PropertyData, PropertyIdType.StudyDefense, DataTable.FindTestNumerialByLevel(playerPeople.protoData.PropertyData.Level).studyDefense.ToFloat(), false); // InitSingleProperty(playerPeople.protoData.PropertyData, PropertyIdType.PhysicalCharm, DataTable.FindTestNumerialByLevel(playerPeople.protoData.PropertyData.Level).physicalCharm.ToFloat(), false); // InitSingleProperty(playerPeople.protoData.PropertyData, PropertyIdType.PhysicalDefense, DataTable.FindTestNumerialByLevel(playerPeople.protoData.PropertyData.Level).physicalDefense.ToFloat(), false); // InitSingleProperty(playerPeople.protoData.PropertyData, PropertyIdType.ArtCharm, DataTable.FindTestNumerialByLevel(playerPeople.protoData.PropertyData.Level).artCharm.ToFloat(), false); // InitSingleProperty(playerPeople.protoData.PropertyData, PropertyIdType.ArtDefense, DataTable.FindTestNumerialByLevel(playerPeople.protoData.PropertyData.Level).artDefense.ToFloat(), false); //} /// <summary> /// 得到学习分数 /// </summary> public void GetStudyScore() { //CurScore += 30; //int init PropertySetting pro = DataTable.FindPropertySetting((int)PropertyIdType.Study); //AddProperty(PropertyIdType.Study, 30); EventCenter.Broadcast(TheEventType.GetStudyScore, "获得" + pro.name); //GameObject.Find("SinglePropertyView/txt_num").GetComponent<Text>().SetText(CurScore.ToString()); //PanelManager.Instance.OpenSingle<FlyTxtView>(GameObject.Find("DeskPanel/trans_proChangeParent").transform,"获得知识+30"); }
/// <summary> /// 设置列名 /// </summary> /// <param name="propertyInfo">属性信息</param> /// <param name="setting">属性设置</param> private static void SetColumnName(PropertyInfo propertyInfo, PropertySetting setting) { var attribute = propertyInfo.GetCustomAttribute <ColumnNameAttribute>(); if (attribute != null) { setting.Title = attribute.Name; return; } setting.Title = propertyInfo.Name; }
/// <summary> /// 设置保留小数位数 /// </summary> /// <param name="propertyInfo">属性信息</param> /// <param name="setting">属性设置</param> private static void SetScale(PropertyInfo propertyInfo, PropertySetting setting) { if (!Types.IsNumericType(Reflections.GetUnderlyingType(propertyInfo.PropertyType))) { return; } var attribute = propertyInfo.GetCustomAttribute <DecimalScaleAttribute>(); if (attribute != null) { setting.DecimalScale = attribute.Scale; } }
private static void SetElementOpacity(RadElement element, double value, Animations flags) { if ((flags & Animations.Opacity) == 0 || element == null) { return; } PropertySetting setting = new PropertySetting( VisualElement.OpacityProperty, value); setting.ApplyValue(element); }
public AwardData(AwardType type, int id, int num) { this.awardType = type; this.id = id; this.num = num; switch (type) { case AwardType.Property: PropertySetting setting = DataTable.FindPropertySetting(id); sprt = ResourceManager.Instance.GetObj <Sprite>(ConstantVal.propertyIconFolderPath + setting.iconName); break; } }
public virtual void SetClock(DateTime value) { this.angleSeconds = (float)(value.Second * 6); this.angleMinutes = (float)(value.Minute * 6); this.angleHour = (float)(value.Hour * 30) + (float)value.Minute * 0.5f; new PropertySetting(RadElement.AngleTransformProperty, (object)this.angleSeconds).ApplyValue((RadObject)this.secondsArrow); new PropertySetting(RadElement.AngleTransformProperty, (object)this.angleMinutes).ApplyValue((RadObject)this.minutesArrow); PropertySetting propertySetting = new PropertySetting(RadElement.AngleTransformProperty, (object)this.angleHour); if ((double)this.angleHour % 360.0 == (double)this.hoursArrow.AngleTransform % 360.0) { return; } propertySetting.ApplyValue((RadObject)this.hoursArrow); }
/// <summary> /// 通过从配置表解析出来的结构改变属性 /// </summary> /// <param name="pro"></param> /// <param name="proChange"></param> public void InitPropertyChangeWithNumerial(PropertyData propertyData, List <List <float> > proChange) { for (int i = 0; i < proChange.Count; i++) { List <float> single = proChange[i]; int theId = (int)single[0]; float theNum = single[1]; PropertySetting setting = DataTable.FindPropertySetting(theId); SinglePropertyData singlePro = new SinglePropertyData(); singlePro.PropertyLimit = setting.haveLimit.ToInt32(); singlePro.PropertyId = theId; ////若不是随等级变化,则按照配置表随机一个值 //if (setting.isChangeWithLevel != "1") //{ // string[] rdmRange = setting.newRdmRange.Split('|'); // int val = RandomManager.Next(rdmRange[0].ToInt32(), rdmRange[1].ToInt32()); // theNum = val; //} singlePro.PropertyNum = theNum; if (setting.isExamBattle == "1") { if (propertyData.ExamPropertyIdList.Contains(theId)) { int index = propertyData.ExamPropertyIdList.IndexOf(theId); propertyData.ExamPropertyDataList[index].PropertyNum = theNum; } else { propertyData.ExamPropertyIdList.Add(theId); propertyData.ExamPropertyDataList.Add(singlePro); } } else { if (propertyData.PropertyIdList.Contains(theId)) { int index = propertyData.PropertyIdList.IndexOf(theId); propertyData.PropertyDataList[index].PropertyNum = theNum; } else { propertyData.PropertyIdList.Add(theId); propertyData.PropertyDataList.Add(singlePro); } } } }
public virtual void ForceUpdate() { PropertySetting propertySetting = new PropertySetting(CarouselItemsContainer.CarouselLocationProperty, (object)3.25777); for (int index = 0; index < this.currentRange.Length; ++index) { int indexFromItemIndex = this.GetChildIndexFromItemIndex(this.mapper.MapFromRangeIndex(this.currentRange.ToRangeIndex(index))); if (indexFromItemIndex == -1) { return; } int num = (int)this.Children[indexFromItemIndex].ResetValue(CarouselItemsContainer.CarouselLocationProperty, ValueResetFlags.Animation); propertySetting.ApplyValue((RadObject)this.Children[indexFromItemIndex]); } this.UpdateCarousel(); }
private void SetElementZIndex(RadElement element, Point3D pos, Animations flags) { if (!this.zIndexFromPath) { return; } int zIndex = (int)(pos.Z * zIndexScale); PropertySetting setting = new PropertySetting( VisualElement.ZIndexProperty, zIndex ); setting.ApplyValue(element); }
public override void OnOpenIng() { base.OnOpenIng(); PropertyData propertyData = RoleManager.Instance._CurGameInfo.PlayerPeople.PropertyData; int count = propertyData.PropertyIdList.Count; for (int i = 0; i < count; i++) { int id = propertyData.PropertyIdList[i]; SinglePropertyData singleData = propertyData.PropertyDataList[i]; PropertySetting setting = DataTable.FindPropertySetting(id); if (setting.showInStatusPanel == "1") { PanelManager.Instance.OpenSingle <StatusPropertyView>(trans_grid, singleData); } } }
private void SetNewStateImage(Image newImage) { chaingingImageInternally = true; if (newImage != null) { //avoid setting property locally //to be able to respond to changes from theme PropertySetting setting = new PropertySetting( RadButtonItem.ImageProperty, newImage ); setting.ApplyValue(this); } chaingingImageInternally = false; }
//List<SingleExamEnemy> curExamEnemyList= /// <summary> /// 开始考试 /// </summary> public void StartExam(ExamSetting examSetting) { //扣除体力 string[] costArr = examSetting.cost.Split('|'); PropertyIdType theId = (PropertyIdType)costArr[0].ToInt32(); int num = costArr[1].ToInt32(); SinglePropertyData pro = RoleManager.Instance.FindSinglePropertyData(theId); PropertySetting propertySetting = DataTable.FindPropertySetting(pro.PropertyId); if (RoleManager.Instance.FindSinglePropertyData(theId).PropertyNum < num) { PanelManager.Instance.OpenFloatWindow(propertySetting.name + "不足"); } else { RoleManager.Instance.DeProperty(theId, num); GenerateExam(examSetting); } }
private static void SetElementBounds(RadElement element, Point value, Animations flags) { if ((flags & Animations.Location) == 0 || element == null) { return; } Point position = value; Point itemCenter = ((CarouselContentItem)element).Center; position.Offset(-itemCenter.X, -itemCenter.Y); element.Bounds = new Rectangle(position, element.Bounds.Size); PropertySetting setting = new PropertySetting( VisualElement.BoundsProperty, new Rectangle(value, element.Bounds.Size) ); setting.ApplyValue(element); }
private static void SetElementScale(RadElement element, SizeF value, Animations flags) { if ((flags & Animations.Scale) == 0) { return; } if (element == null) { return; } RadElement visual = ((CarouselContentItem)element).HostedItem; PropertySetting setting = new PropertySetting( VisualElement.ScaleTransformProperty, value ); setting.ApplyValue(visual); }
public virtual void ForceUpdate() { const double pathCenterOffset = 3.25777; PropertySetting pos = new PropertySetting(CarouselItemsContainer.CarouselLocationProperty, pathCenterOffset); for (int i = 0; i < this.currentRange.Length; i++) { int index = this.GetChildIndexFromItemIndex( this.mapper.MapFromRangeIndex(this.currentRange.ToRangeIndex(i)) ); if (index == -1) { return; //throw new Exception("Reached item that is not pre-processed!"); } this.Children[index].ResetValue(CarouselItemsContainer.CarouselLocationProperty, ValueResetFlags.Animation); pos.ApplyValue(this.Children[index]); } this.UpdateCarousel(); }
public static void LoadFile(string path, bool append = true) { if (!append) { sConfigs.Clear(); } if (File.Exists(path)) { ObjectConfig currentConfig = null; string currentParamRefId = string.Empty; Type currentParamType = null; IList currentParamList = null; RefListObjectSetting currentParamRefList = null; string currentPropertyName = string.Empty; Regex reInt = new Regex("^[0-9]*$", RegexOptions.None); Regex reDouble = new Regex("^[0-9\\.]*$", RegexOptions.None); XmlUtils.Iterate(path, (XmlNodeInfo nodeInfo) => { if (nodeInfo.Path == "/objects/object") { if (!nodeInfo.IsEndNode) { string attrId = nodeInfo.GetAttribute("id"); if (attrId == null) { throw new Exception("id属性是必须的" + ": " + path + " line " + nodeInfo.Line); } else if (string.IsNullOrWhiteSpace(attrId)) { throw new Exception("id属性不能为空" + ": " + path + " line " + nodeInfo.Line); } string attrClass = nodeInfo.GetAttribute("class"); if (attrClass == null) { throw new Exception("class属性是必须的" + ": " + path + " line " + nodeInfo.Line); } else if (string.IsNullOrWhiteSpace(attrClass)) { throw new Exception("class属性不能为空" + ": " + path + " line " + nodeInfo.Line); } currentConfig = new ObjectConfig(); currentConfig.Id = attrId; currentConfig.Class = attrClass; sConfigs.AddOrUpdate(attrId.ToLower(), currentConfig, (oldKey, oldValue) => { return(currentConfig); }); } else { currentConfig = null; } } else if (nodeInfo.Path == "/objects/object/constructor-arg" || nodeInfo.Path == "/objects/object/property") { if (!nodeInfo.IsEndNode) { if (nodeInfo.Path == "/objects/object/property") { currentPropertyName = nodeInfo.GetAttribute("name"); if (string.IsNullOrWhiteSpace(currentPropertyName)) { throw new Exception("name属性不能为空" + ": " + path + " line " + nodeInfo.Line); } } currentParamRefId = nodeInfo.GetAttribute("ref"); if (string.IsNullOrWhiteSpace(currentParamRefId)) { string typeName = nodeInfo.GetAttribute("type"); if (typeName != null) { if (!string.IsNullOrWhiteSpace(typeName)) { if (!typeName.Contains(".")) { //System下的简单数据类型 currentParamType = Type.GetType("System." + typeName, true, true); } else { //用户自定义类型 currentParamType = AssemblyUtils.GetType(typeName); } } else { throw new Exception("type属性不能为空" + ": " + path + " line " + nodeInfo.Line); } } else { currentParamType = null; } } } else { currentParamRefId = string.Empty; currentParamType = null; currentPropertyName = string.Empty; } } else if (nodeInfo.Path == "/objects/object/constructor-arg/@text") { if (string.IsNullOrWhiteSpace(currentParamRefId)) { string paramValue = nodeInfo.Text.Trim(); handleListValue(currentConfig.ConstructorParams, paramValue, currentParamType, path, nodeInfo.Line); } else { int index = currentConfig.ConstructorParams.Count + currentConfig.RefConstructorParams.Count; currentConfig.RefConstructorParams.Add(new RefObjectSetting(currentParamRefId, index)); } //TODO 对象构造支持更多的参数类型 Hashtable、Dictionary、HashSet等 } else if (nodeInfo.Path == "/objects/object/property/@text") { if (string.IsNullOrWhiteSpace(currentParamRefId)) { string propertyValue = nodeInfo.Text.Trim(); PropertySetting propSetting = new PropertySetting(currentPropertyName, propertyValue); currentConfig.Properties.Add(propSetting); } else { PropertySetting propSetting = new PropertySetting(currentPropertyName); propSetting.RefId = currentParamRefId; currentConfig.Properties.Add(propSetting); } } else if (nodeInfo.Path == "/objects/object/constructor-arg/list" || nodeInfo.Path == "/objects/object/constructor-arg/array") { if (!nodeInfo.IsEndNode) { bool isUserType = false; string typeName = nodeInfo.GetAttribute("type"); if (typeName != null) { if (!string.IsNullOrWhiteSpace(typeName)) { if (!typeName.Contains(".")) { //System下的简单数据类型 currentParamType = Type.GetType("System." + typeName, true, true); } else { //用户自定义类型 currentParamType = AssemblyUtils.GetType(typeName); isUserType = !currentParamType.IsEnum; } } else { throw new Exception("type属性不能为空" + ": " + path + " line " + nodeInfo.Line); } Type geneType = typeof(List <>); Type implType = geneType.MakeGenericType(currentParamType); ConstructorInfo ci = implType.GetConstructor(new Type[] { }); currentParamList = ci.Invoke(new Object[] { }) as IList; } else { currentParamType = Type.GetType("System.Object", true, true); currentParamList = new List <object>(); } if (isUserType) { int index = currentConfig.ConstructorParams.Count + currentConfig.RefConstructorParams.Count; bool isArray = nodeInfo.Path == "/objects/object/constructor-arg/array"; currentParamRefList = new RefListObjectSetting(index, currentParamList, isArray); } } else { if (currentParamRefList == null) { if (nodeInfo.Path == "/objects/object/constructor-arg/list") { currentConfig.ConstructorParams.Add(currentParamList); } else if (nodeInfo.Path == "/objects/object/constructor-arg/array") { Array argArray = Array.CreateInstance(currentParamType, currentParamList.Count); currentParamList.CopyTo(argArray, 0); currentConfig.ConstructorParams.Add(argArray); } } else { currentConfig.RefConstructorParams.Add(currentParamRefList); } currentParamType = null; currentParamList = null; currentParamRefList = null; } } else if (nodeInfo.Path == "/objects/object/constructor-arg/list/value" || nodeInfo.Path == "/objects/object/constructor-arg/array/value") { if (!nodeInfo.IsEndNode) { if (currentParamRefList != null) { currentParamRefId = nodeInfo.GetAttribute("ref"); if (!string.IsNullOrWhiteSpace(currentParamRefId)) { currentParamRefList.ItemList.Add(currentParamRefId); } else { throw new Exception("ref属性不能为空" + ": " + path + " line " + nodeInfo.Line); } } } else { currentParamRefId = string.Empty; } } else if (nodeInfo.Path == "/objects/object/constructor-arg/list/value/@text" || nodeInfo.Path == "/objects/object/constructor-arg/array/value/@text") { if (currentParamRefList == null) { string paramValue = nodeInfo.Text.Trim(); handleListValue(currentParamList, paramValue, currentParamType, path, nodeInfo.Line); } } return(true); }); } }
} // Collect // ---------------------------------------------------------------------- private void Collect( DependencyObject currentObject, bool recursive ) { foreach ( object child in LogicalTreeHelper.GetChildren( currentObject ) ) { DependencyObject dependencyObject = child as DependencyObject; if ( dependencyObject == null ) { continue; } FrameworkElement frameworkElement = child as FrameworkElement; if ( frameworkElement != null ) { // ReSharper disable UseMethodIsInstanceOfType bool add = elementType.IsAssignableFrom( frameworkElement.GetType() ); // ReSharper restore UseMethodIsInstanceOfType if ( add && string.IsNullOrEmpty( frameworkElement.Name ) ) { add = false; Debug.WriteLine( "PropertySettingCollector: missing name for framework element " + frameworkElement ); } if ( add && !OnCollectingSetting( frameworkElement ) ) { add = false; } if ( add ) { string settingName = string.Concat( frameworkElement.Name, ".", propertyName ); PropertySetting propertySetting = new PropertySetting( settingName, frameworkElement, propertyName ); propertySetting.DefaultValue = propertySetting.Value; ApplicationSettings.Settings.Add( propertySetting ); } } if ( recursive ) { Collect( dependencyObject, true ); } } } // Collect
/// <summary> /// Gets the box modules asking for creation. /// </summary> /// <param name="localePrefs">The localization preferences.</param> /// <param name="boxModule">The box module.</param> /// <returns> /// Array of <see cref="T:Ferda.Modules.ModuleAskingForCreation"> /// Modules Asking For Creation</see>. /// </returns> public override ModulesAskingForCreation[] GetModulesAskingForCreation(string[] localePrefs, BoxModuleI boxModule) { Dictionary<string, ModulesAskingForCreation> modulesAFC = this.getModulesAskingForCreationNonDynamic(localePrefs); List<ModulesAskingForCreation> result = new List<ModulesAskingForCreation>(); ModulesAskingForCreation moduleAFC; ModulesConnection moduleConnection; ModuleAskingForCreation singleModuleAFC; PropertySetting propertySetting; Ferda.ModulesManager.BoxModuleProjectInformationPrx projectInfoPrx = boxModule.Manager.getProjectInformation(); string label = projectInfoPrx.getUserLabel(boxModule.StringIceIdentity); //TODO switch column type: ValueSubTypeEnum columnValueSubType = ((ColumnFunctionsI)boxModule.FunctionsIObj).GetColumnSubType(); //ValueSubTypeEnum columnValueSubType = (ValueSubTypeEnum)(Enum.Parse(typeof(ValueSubTypeEnum), boxModule.GetPropertyString("ValueSubType"))); foreach (string moduleAFCName in modulesAFC.Keys) { moduleAFC = modulesAFC[moduleAFCName]; moduleConnection = new ModulesConnection(); singleModuleAFC = new ModuleAskingForCreation(); switch (moduleAFCName) { case "MultiColumn": //TODO MultiColumn is not implemented yet. //moduleConnection.socketName = "Column"; //singleModuleAFC.newBoxModuleIdentifier = // Ferda.Modules.Boxes.DataMiningCommon.MultiColumn.MultiColumnBoxInfo.typeIdentifier; continue; case "Attribute": case "EachValueOneCategoryAttribute": case "EquifrequencyIntervalsAttribute": case "EquidistantIntervalsAttribute": if (moduleAFCName == "Attribute") { singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.Attributes.Attribute.AttributeBoxInfo.typeIdentifier; } if (moduleAFCName == "EachValueOneCategoryAttribute") { singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.Attributes.EachValueOneCategoryAttribute.EachValueOneCategoryAttributeBoxInfo.typeIdentifier; } if (moduleAFCName == "EquifrequencyIntervalsAttribute") { if (!Ferda.Modules.Helpers.Data.Column.IsColumSubTypeCardinal(columnValueSubType) || columnValueSubType == ValueSubTypeEnum.DateTimeType) continue; singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.Attributes.EquifrequencyIntervalsAttribute.EquifrequencyIntervalsAttributeBoxInfo.typeIdentifier; } if (moduleAFCName == "EquidistantIntervalsAttribute") { if ((columnValueSubType == ValueSubTypeEnum.Unknown) || (columnValueSubType == ValueSubTypeEnum.DateTimeType) //|| (columnValueSubType == ValueSubTypeEnum.TimeType) || (columnValueSubType == ValueSubTypeEnum.BooleanType)) continue; singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.Attributes.EquidistantIntervalsAttribute.EquidistantIntervalsAttributeBoxInfo.typeIdentifier; } moduleConnection.socketName = "ColumnOrDerivedColumn"; propertySetting = new PropertySetting(); propertySetting.propertyName = "NameInLiterals"; propertySetting.value = new Ferda.Modules.StringTI(label); singleModuleAFC.propertySetting = new PropertySetting[] { propertySetting }; break; default: throw Ferda.Modules.Exceptions.SwitchCaseNotImplementedError(moduleAFCName); } moduleConnection.boxModuleParam = boxModule.MyProxy; singleModuleAFC.modulesConnection = new ModulesConnection[] { moduleConnection }; singleModuleAFC.newBoxModuleUserLabel = new string[] { label }; moduleAFC.newModules = new ModuleAskingForCreation[] { singleModuleAFC }; result.Add(moduleAFC); } return result.ToArray(); }
/// <summary> /// 初始化一个<see cref="PropertyConfiguration"/>类型的实例 /// </summary> /// <param name="propertySetting">属性设置</param> public PropertyConfiguration(IPropertySetting propertySetting) { _propertySetting = propertySetting as PropertySetting; }
public void CreateAnimation(VisualElement element, CarouselPathAnimationData data, int frames, int delay) { double fromValue = 0; double toValue = 0; if (data.SpecialHandling) { double value = (double)element.GetValue(CarouselItemsContainer.CarouselLocationProperty); fromValue = double.IsNaN(value) ? 0 : value; ValueMapper.MapperRange range = this.ranges.GetTarget(data.To.Value); if (data.From == null || double.IsNegativeInfinity(data.From.Value)) { fromValue -= range.Length; } else { fromValue += range.Length; } data.From = null; } else { if (data.From == null) { double value = (double)element.GetValue(CarouselItemsContainer.CarouselLocationProperty); //ValueMapper.MapperRange range = this.ranges.GetTarget(data.To.Value); fromValue = double.IsNaN(value) ? 0 : value; } else { fromValue = this.ranges.MapInTarget(data.From.Value); data.From = null; } } if (data.To == null) { data.To = double.PositiveInfinity; //throw new Exception("Wrong target value for animation!"); } //else { toValue = this.ranges.MapInTarget(data.To.Value); } if (fromValue != toValue) { PropertySetting pos = new PropertySetting(CarouselItemsContainer.CarouselLocationProperty, fromValue ); pos.ApplyValue(element); } AnimatedPropertySetting animation = new AnimatedPropertySetting(CarouselItemsContainer.CarouselLocationProperty, fromValue, toValue, frames, delay ); data.CurrentAnimation = animation; }
/// <summary> /// Gets the <see cref="T:Ferda.Modules.PropertySetting"/> /// for the specified property (<c>propertyName</c>). /// </summary> /// <param name="propertyName">Name of the property.</param> /// <returns> /// The <see cref="T:Ferda.Modules.PropertySetting"/> i.e. /// value and name of the specified property. /// </returns> public PropertySetting GetPropertySetting(string propertyName) { PropertySetting result = new PropertySetting(); result.propertyName = propertyName; result.value = getProperty(propertyName); return result; }
} // Collect // ---------------------------------------------------------------------- private void Collect( Control.ControlCollection children, bool recursive ) { foreach ( Control control in children ) { bool add = control.GetType().IsAssignableFrom( elementType ); string controlId = null; if ( add ) { controlId = GetControlId( control ); if ( string.IsNullOrEmpty( controlId ) ) { add = false; Debug.WriteLine( "PropertySettingCollector: missing id for control " + control ); } } if ( add && !OnCollectingSetting( control ) ) { add = false; } if ( add ) { string settingName = string.Concat( controlId, ".", propertyName ); PropertySetting propertySetting = new PropertySetting( settingName, control, propertyName ); propertySetting.DefaultValue = propertySetting.Value; ApplicationSettings.Settings.Add( propertySetting ); } if ( recursive && control.Controls.Count > 0 ) { Collect( control.Controls, true ); } } } // Collect
/// <summary> /// Gets the quantifiers setting. /// </summary> /// <param name="boxModule">The box module.</param> /// <param name="socketName">Name of the socket.</param> /// <returns>Setting of quantifiers.</returns> public static QuantifierSettingStruct[] GetQuantifiersSetting(BoxModuleI boxModule, string socketName) { List<QuantifierSettingStruct> result = new List<QuantifierSettingStruct>(); List<PropertySetting> propertySetting = new List<PropertySetting>(); PropertySetting property; QuantifierSettingStruct item; foreach (BoxModulePrx prx in SocketConnections.GetBoxModulePrxs(boxModule, socketName, false)) { propertySetting.Clear(); foreach (PropertyInfo propertyInfo in prx.getMyFactory().getProperties()) { property = new PropertySetting(); property.propertyName = propertyInfo.name; property.value = prx.getProperty(property.propertyName); propertySetting.Add(property); } item = new QuantifierSettingStruct(); item.setting = propertySetting.ToArray(); item.typeIdentifier = prx.getMyFactory().getMyFactoryCreator().getIdentifier(); result.Add(item); } return result.ToArray(); }
public PropertyConfiguration(PropertySetting propertySetting) => PropertySetting = propertySetting;
public void RefreshProperties() { PropertySetting.SelectedObject = _Properties; PropertySetting.ExpandAllGridItems(); }
internal PropertyConfiguration(PropertySetting propertySetting) => PropertySetting = propertySetting;
/// <summary> /// Gets the box modules asking for creation. /// </summary> /// <param name="localePrefs">The localization preferences.</param> /// <param name="boxModule">The box module.</param> /// <returns> /// Array of <see cref="T:Ferda.Modules.ModuleAskingForCreation"> /// Modules Asking For Creation</see>. /// </returns> public override ModulesAskingForCreation[] GetModulesAskingForCreation(string[] localePrefs, BoxModuleI boxModule) { Dictionary<string, ModulesAskingForCreation> modulesAFC = this.getModulesAskingForCreationNonDynamic(localePrefs); List<ModulesAskingForCreation> result = new List<ModulesAskingForCreation>(); ModulesAskingForCreation moduleAFC; ModulesConnection moduleConnection; ModuleAskingForCreation singleModuleAFC; List<ModuleAskingForCreation> allColumnModulesAFC = new List<ModuleAskingForCreation>(); // I presuppose that item with key "Column" is before item with key "AllColumns" foreach (string moduleAFCName in modulesAFC.Keys) { moduleAFC = modulesAFC[moduleAFCName]; switch (moduleAFCName) { case "Column": DataMatrixFunctionsI Func = (DataMatrixFunctionsI)boxModule.FunctionsIObj; string[] columnsNames = null; try { columnsNames = Func.getColumnsNames(); } catch (Ferda.Modules.BoxRuntimeError) { } if (columnsNames != null && columnsNames.Length > 0) { moduleConnection = new ModulesConnection(); moduleConnection.socketName = "DataMatrixOrMultiColumn"; moduleConnection.boxModuleParam = boxModule.MyProxy; foreach (string columnName in columnsNames) { ModulesAskingForCreation newMAFC = new ModulesAskingForCreation(); newMAFC.label = moduleAFC.label.Replace("@Name", columnName); newMAFC.hint = moduleAFC.hint.Replace("@Name", columnName); newMAFC.help = moduleAFC.help; singleModuleAFC = new ModuleAskingForCreation(); singleModuleAFC.modulesConnection = new ModulesConnection[] { moduleConnection }; ; singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.Column.ColumnBoxInfo.typeIdentifier; PropertySetting propertySetting = new PropertySetting(); propertySetting.propertyName = "Name"; propertySetting.value = new Ferda.Modules.StringTI(columnName); singleModuleAFC.propertySetting = new PropertySetting[] { propertySetting }; allColumnModulesAFC.Add(singleModuleAFC); newMAFC.newModules = new ModuleAskingForCreation[] { singleModuleAFC }; result.Add(newMAFC); } } break; case "DerivedColumn": moduleConnection = new ModulesConnection(); singleModuleAFC = new ModuleAskingForCreation(); moduleConnection.socketName = "DataMatrix"; moduleConnection.boxModuleParam = boxModule.MyProxy; singleModuleAFC.modulesConnection = new ModulesConnection[] { moduleConnection }; singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.DerivedColumn.DerivedColumnBoxInfo.typeIdentifier; moduleAFC.newModules = new ModuleAskingForCreation[] { singleModuleAFC }; result.Add(moduleAFC); break; case "AllColumns": if (allColumnModulesAFC.Count <= 1) continue; moduleConnection = new ModulesConnection(); moduleConnection.socketName = "DataMatrixOrMultiColumn"; moduleConnection.boxModuleParam = boxModule.MyProxy; moduleAFC.newModules = allColumnModulesAFC.ToArray(); result.Add(moduleAFC); break; default: throw Ferda.Modules.Exceptions.SwitchCaseNotImplementedError(moduleAFCName); } } return result.ToArray(); }
/// <summary> /// Gets the setting for new attribute box. /// </summary> /// <param name="categoriesStruct">The categories struct.</param> /// <param name="xCategory">The x category.</param> /// <param name="includeNullCategory">The include null category.</param> /// <param name="nameInLiterals">The name in literals.</param> /// <returns>Property settings for new derived attribute box module.</returns> public static PropertySetting[] GetSettingForNewAttributeBox(CategoriesStruct categoriesStruct, string xCategory, string includeNullCategory, string nameInLiterals) { PropertySetting categoriesProperty = new PropertySetting(); categoriesProperty.propertyName = "Categories"; categoriesProperty.value = new CategoriesTI(categoriesStruct); /* PropertySetting countOfCategoriesProperty = new PropertySetting(); countOfCategoriesProperty.propertyName = "CountOfCategories"; countOfCategoriesProperty.result = new Ferda.Modules.LongTI(countOfCategories); */ PropertySetting xCategoryProperty = new PropertySetting(); xCategoryProperty.propertyName = "XCategory"; xCategoryProperty.value = new Ferda.Modules.StringTI(xCategory); PropertySetting includeNullProperty = new PropertySetting(); includeNullProperty.propertyName = "IncludeNullCategory"; includeNullProperty.value = new Ferda.Modules.StringTI(includeNullCategory); PropertySetting nameInLiteralsProperty = new PropertySetting(); nameInLiteralsProperty.propertyName = "NameInLiterals"; nameInLiteralsProperty.value = new Ferda.Modules.StringTI(nameInLiterals); return new PropertySetting[] { categoriesProperty, xCategoryProperty, includeNullProperty, nameInLiteralsProperty }; }