private void AddNewTableButton_Click(object sender, EventArgs e) { List <string> classes = new List <string>(); foreach (UserClassDefinition d in mUserClassDefinitions.mUserClasses) { classes.Add(d.Name); } PropertyList list = new PropertyList(); NewTableOptions options = new NewTableOptions(); list.AddMetaDataForProp("NewTableOptions", "UserClass", "SimpleEnumeration", classes.ToArray()); list.SetTypeEditor("NewTableOptions", "UserClass", typeof(EnumeratedProperty)); list.SelectedObject = options; if (ContentMessageBox.ShowMessage(this, list, "Create a new table") == DialogResult.OK) { foreach (UserClassDefinition d in mUserClassDefinitions.mUserClasses) { if (options.UserClass == d.Name) { TableData table = new TableData(options.Name, d); mTables.mTables.Add(table); mCurrentTable = table; mCurrentSchema = d; UpdateUI(); break; } } } //TableData table = new TableData( }
private void ImportColumnButton_Click(object sender, EventArgs e) { List <string> classes = new List <string>(); foreach (UserClassFieldDefinition d in mCurrentSchema.Fields) { classes.Add(d.Name); } PropertyList list = new PropertyList(); ImportColumn import = new ImportColumn(); list.AddMetaDataForProp("ImportColumn", "Type", "SimpleEnumeration", classes.ToArray()); list.SetTypeEditor("ImportColumn", "Type", typeof(EnumeratedProperty)); list.SetTypeEditor("ImportColumn", "Data", typeof(StringListProperty)); list.SelectedObject = import; if (ContentMessageBox.ShowMessage(this, list, "Import a column of data") == DialogResult.OK) { if (import.Data == null) { return; } for (int i = 0; i < mCurrentSchema.Fields.Count; i++) { if (mCurrentSchema.Fields[i].Name == import.Type) { for (int j = 0; j < import.Data.Count; j++) { if (mCurrentTable.mData.Count <= j) { mCurrentTable.AddRow(); } string[] row = mCurrentTable.mData[j]; row[i] = import.Data[j]; } UpdateUI(); return; } } } }