private bool EditData() { UserDataParser parser = new UserDataParser(); parser.UserDataName = SelectedData.Name; parser.Type = SelectedData.Type.ToString(); switch (SelectedData.Type) { case H3DMetaDataType.UnicodeString: case H3DMetaDataType.ASCIIString: parser.LoadValues(SelectedData.GetValueStringArray()); break; case H3DMetaDataType.Single: parser.LoadValues(SelectedData.GetValueFloatArray()); break; case H3DMetaDataType.Integer: parser.LoadValues(SelectedData.GetValueIntArray()); break; } if (parser.ShowDialog() == DialogResult.OK) { SelectedData.Name = parser.UserDataName; if (parser.Type == "Single") { SelectedData.SetValue(parser.GetFloats()); } if (parser.Type == "Int32") { SelectedData.SetValue(parser.GetInts()); } if (parser.Type == "String") { SelectedData.SetValue(parser.GetStringASCII()); } if (parser.Type == "WString") { SelectedData.SetValue(parser.GetStringUnicode()); } return(true); } return(false); }
private void btnAdd_Click(object sender, EventArgs e) { if (MetaData == null) { MetaData = new H3DMetaData(); } H3DMetaDataValue userDataNew = new H3DMetaDataValue(); userDataNew.Type = H3DMetaDataType.Integer; userDataNew.SetValue(new int[0]); SelectedData = userDataNew; bool IsEdited = EditData(); if (IsEdited) { MetaData.Add(SelectedData); LoadUserData(SelectedData); } }