private void abilityToolStripMenuItem_Click(object sender, EventArgs e) { //Abilities are assigned to Type = 3 CreateObjectDialog dialog = new CreateObjectDialog(CreateObjectDialog.DotaType.Ability); dialog.ShowDialog(); if (dialog.DialogResult == DialogResult.OK) { RefreshTreeView(); } }
private void unitToolStripMenuItem_Click(object sender, EventArgs e) { //Units are assigned to Type = 2 CreateObjectDialog dialog = new CreateObjectDialog(CreateObjectDialog.DotaType.Unit); dialog.ShowDialog(); if (dialog.DialogResult == DialogResult.OK) { RefreshTreeView(); } }
public override object CreateObjectInstance(Type objectType) { object obj = null; if (objectType.IsAbstract || objectType.IsInterface || objectType == typeof(object)) { CreateObjectDialog createDialog = new CreateObjectDialog(); createDialog.BaseType = objectType; createDialog.ShowNamespaces = objectType == typeof(object); DialogResult result = createDialog.ShowDialog(); if (result == DialogResult.OK) { obj = createDialog.SelectedType.CreateInstanceOf(); } } return(obj ?? base.CreateObjectInstance(objectType)); }