//----------------------------------------------------------------------------- // Constructor //----------------------------------------------------------------------------- public PropertyGridControl(EditorControl editorControl, PropertyGrid propertyGrid) { this.editorControl = editorControl; this.propertyGrid = propertyGrid; propertiesContainer = new PropertiesContainer(null); propertyGrid.SelectedObject = propertiesContainer; // Create property editor types. typeEditors = new Dictionary <string, CustomPropertyEditor>(); typeEditors["sprite"] = new ResourcePropertyEditor <Sprite>(); typeEditors["animation"] = new ResourcePropertyEditor <Animation>(); typeEditors["collision_model"] = new ResourcePropertyEditor <CollisionModel>(); typeEditors["song"] = new ResourcePropertyEditor <Song>(); typeEditors["sound"] = new ResourcePropertyEditor <Sound>(); typeEditors["zone"] = new ResourcePropertyEditor <Zone>(); typeEditors["reward"] = new RewardPropertyEditor(editorControl.RewardManager); typeEditors["text_message"] = new TextMessagePropertyEditor(); typeEditors["script"] = new ScriptPropertyEditor(); typeEditors["sprite_index"] = new SpriteIndexComboBox(); typeEditors["direction"] = new DirectionPropertyEditor(); typeEditors["angle"] = null; typeEditors["enum"] = new EnumComboBox(); typeEditors["enum_flags"] = null; typeEditors["dungeon"] = new DungeonPropertyEditor(); typeEditors["level"] = new LevelPropertyEditor(); /* * // Initialize property type editors. * foreach (KeyValuePair<string, CustomPropertyEditor> entry in typeEditors) { * if (entry.Value != null) * entry.Value.Initialize(this); * }*/ }
public static IPropertiesContainer ReadProperties(string content, string id) { PropertiesContainer properties = new PropertiesContainer(id); StringReader reader = new StringReader(content); ParseStream(reader, properties); return(properties); }
public static IPropertiesContainer ReadProperties(Stream stream, string id) { PropertiesContainer properties = new PropertiesContainer(id); StreamReader streamReader = new StreamReader(stream); ParseStream(streamReader, properties); return(properties); }
/// <summary> /// collapse test actions /// </summary> public void CollapseProperties() { PropertiesContainer.WaitUntilExists(5); PropertiesContainer.FakeAttributeStyle = "display: block;"; if (PropertiesContainer.GetAttribute("style").Trim().ToLower().Contains("block")) { PropertiesLink.Click(); } }
/// <summary> /// expand test actions /// </summary> public void ExpandProperties() { PropertiesContainer.WaitUntilExists(5); PropertiesContainer.FakeAttributeStyle = "display: none;"; if (PropertiesContainer.GetAttribute("style").Trim().ToLower().Contains("none")) { PropertiesLink.Click(); } }
private void ObservableCollectionInPropertiesChanged(object sender, NotifyCollectionChangedEventArgs e) { PropertiesContainer.RemoveProperty(Key); if (this.Count == 0) { return; } PropertiesContainer.SetProperty(Key, this.ToList()); }
public override void SetValue(PropertiesContainer container, TValue value) { if (ValueEquals(GetValue(container), value)) { return; } container.m_FieldValues[Index].Value = value; container.VersionStorage?.IncrementVersion(this, container); }
public override TValue GetValue(PropertiesContainer container) { var r = container.m_FieldValues[Index].Value; if (null == r || typeof(TValue) != r.GetType()) { return(default(TValue)); } return((TValue)r); }
public override TValue GetValue(PropertiesContainer container) { var value = container.m_FieldValues[Index].Value; if (!(value is TValue)) { return(default(TValue)); } return((TValue)value); }
public UTinyObject(IRegistry registry, UTinyType.Reference type, IVersionStorage versionStorage = null, bool refresh = true) { Registry = registry; m_SharedVersionStorage = versionStorage; m_Properties = new PropertiesContainer(this); m_Type = type; if (refresh) { Refresh(); } }
public Condition FillConditionData(int subgroupId, int sourceMaterialId, int sourceId, int groupId, int conditionId, IMaterialsContextUow context) { string sessionId = System.Web.HttpContext.Current.Session["TotalMateriaSession"].ToString(); IService service = new TotalMateriaService(); IPlusService servicePLUS = new TMPlusService(); Condition condition = null; if (groupId == 806) { PropertiesContainer mechanical = servicePLUS.GetMechanicalPLUSPropertiesFromService(sessionId, sourceMaterialId, subgroupId); IList <TabConditionAndData> mechanicalCondition = mechanical.Model.Where(m => m.ConditionId == conditionId).ToList(); condition = new Condition(); condition.Properties = new List <Property>(); foreach (var item in mechanicalCondition) { condition.ConditionName = item.Condition; condition.ConditionId = item.ConditionId; foreach (var prop in item.DataForCondition) { foreach (var row in prop.Rows) { string tempString = ""; if (!string.IsNullOrEmpty(row.Item3)) { if (tempString != "") { tempString += "; " + row.Item3; } else { tempString += row.Item3; } } if (tempString != "") { tempString += "; " + row.Item2; } else { tempString += row.Item2; } condition.Properties.Add(new Property() { SourcePropertyId = prop.PropertyId, PropertyName = prop.Header.ToLower(), OrigUnit = prop.Unit.Replace("(", "").Replace(")", ""), OrigValue = row.Item1, OrigValueText = tempString }); } } condition.Properties = condition.Properties.OrderBy(s => s.PropertyName).ToList(); int count = 0; foreach (var prop in condition.Properties) { var st = context.EquivalentProperties.AllAsNoTracking.Where(s => s.SourcePropertyId == prop.SourcePropertyId && s.SourceId == 3).FirstOrDefault(); if (st != null) { prop.PropertyId = st.PropertyId; prop.SourcePropertyId = st.SourcePropertyId; prop.PropertyName = st.Name; prop.ValueId = count; count = count + 1; } else { prop.ValueId = count; count = count + 1; } } } } else { PropertiesContainer physical = servicePLUS.GetPhysicalPropertiesPLUSFromService(sessionId, sourceMaterialId); IList <TabConditionAndData> physicalCondition = physical.Model.Where(m => m.ConditionId == conditionId).ToList(); condition = new Condition(); condition.Properties = new List <Property>(); foreach (var item in physicalCondition) { condition.ConditionName = item.Condition; condition.ConditionId = item.ConditionId; foreach (var prop in item.DataForCondition) { foreach (var row in prop.Rows) { string tempString = ""; if (!string.IsNullOrEmpty(row.Item3)) { if (tempString != "") { tempString += "; " + row.Item3; } else { tempString += row.Item3; } } if (tempString != "") { tempString += "; " + row.Item2; } else { tempString += row.Item2; } condition.Properties.Add(new Property() { SourcePropertyId = prop.PropertyId, PropertyName = prop.Header.ToLower(), OrigUnit = prop.Unit.Replace("(", "").Replace(")", ""), OrigValue = row.Item1, OrigValueText = tempString }); } } condition.Properties = condition.Properties.OrderBy(s => s.PropertyName).ToList(); int count = 0; foreach (var prop in condition.Properties) { var st = context.EquivalentProperties.AllAsNoTracking.Where(s => s.SourcePropertyId == prop.SourcePropertyId && s.SourceId == 3).FirstOrDefault(); if (st != null) { prop.PropertyId = st.PropertyId; prop.SourcePropertyId = st.SourcePropertyId; prop.PropertyName = st.Name; prop.ValueId = count; count = count + 1; } else { prop.ValueId = count; count = count + 1; } } } } return(condition); }
public override void SetValue(PropertiesContainer container, TValue value) { container.VersionStorage?.IncrementVersion(this, container); container.m_DynamicValues[Name] = value; }
public override TValue GetValue(PropertiesContainer container) { return((TValue)container.m_DynamicValues[Name]); }
public override void SetValue(PropertiesContainer container, TValue value) { container.VersionStorage?.IncrementVersion(this, container); container.m_FieldValues[Index].Value = value; }
public void Get() { List <PropertiesContainer> properties = new List <PropertiesContainer>(); string sql = "dbo.reg_FormVersionOne_Get"; SqlConnection cnn = new SqlConnection(ConnectionStrings.sqlUsers); SqlCommand cmd = new SqlCommand(sql, cnn); SqlDataReader rdr = null; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@UserId_ID", this.userId).SqlDbType = SqlDbType.Int; try { cnn.Open(); rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection); if (rdr.HasRows) { rdr.Read(); this.SeekSex = Convert.ToInt32(rdr.GetByte(0)); this.Height = Convert.ToInt32(rdr.GetByte(1)); this.City = rdr.GetInt32(2); rdr.NextResult(); while (rdr.Read()) { PropertiesContainer p = new PropertiesContainer(); p.PropertyId = Convert.ToInt32(rdr.GetInt16(0)); p.CategoryId = Convert.ToInt32(rdr.GetByte(1)); properties.Add(p); } } } catch (SqlException e) { //this.error = true; //this.AddErrorMessage(e.Message); } catch (Exception ex) { //this.error = true; //this.AddErrorMessage(ex.Message); } finally { if (!(rdr == null)) { rdr.Close(); rdr.Dispose(); } cnn.Close(); cmd.Dispose(); cnn.Dispose(); } for (int i = 0; i < properties.Count; i++) { switch ((Categories)properties[i].CategoryId) { case Categories.Relationship: this.Relationship.Add(properties[i].PropertyId); break; case Categories.FashionStyle: this.FashionStyle.Add(properties[i].PropertyId); break; case Categories.Drinking: this.Drinking = properties[i].PropertyId; break; case Categories.Smoking: this.Smoking = properties[i].PropertyId; break; } } }
public void Get() { List <PropertiesContainer> properties = new List <PropertiesContainer>(); string sql = "dbo.reg_FormVersionThree_Get"; SqlConnection cnn = new SqlConnection(ConnectionStrings.sqlUsers); SqlCommand cmd = new SqlCommand(sql, cnn); SqlDataReader rdr = null; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@UserId_ID", this.userId).SqlDbType = SqlDbType.Int; try { cnn.Open(); rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection); if (rdr.HasRows) { rdr.Read(); this.Introduction = rdr.GetString(0); } rdr.NextResult(); if (rdr.HasRows) { while (rdr.Read()) { PropertiesContainer p = new PropertiesContainer(); p.PropertyId = Convert.ToInt32(rdr.GetInt16(0)); p.CategoryId = Convert.ToInt32(rdr.GetSqlByte(1)); properties.Add(p); } } } catch (SqlException e) { } catch (Exception ex) { } finally { if (!(rdr == null)) { rdr.Close(); rdr.Dispose(); } cnn.Close(); cmd.Dispose(); cnn.Dispose(); } for (int i = 0; i < properties.Count; i++) { switch ((Categories)properties[i].CategoryId) { case Categories.FreeTimeFavorite: this.FreeTimeFavorite.Add(properties[i].PropertyId); break; case Categories.Hobbies: this.Hobbies.Add(properties[i].PropertyId); break; } } }