private void NewScriptable() { if (!ConfirmClose()) { return; } classSelector.Types = Constructor.RegisteredTypes.Where((t) => !t.IsAbstract && typeof(IScriptable).IsAssignableFrom(t)); classSelector.StartPosition = FormStartPosition.CenterParent; if (classSelector.ShowDialog() != DialogResult.OK) { return; } SetScriptable(Constructor.Construct(classSelector.SelectedType) as IScriptable, null); }
private Json.DataObject CreateInstance(Type type, ClassSelector selector) { Json.DataObject obj = null; if (type.IsAbstract) { if (selector.Types == null) { selector.Types = Constructor.RegisteredTypes.Where((t) => !t.IsAbstract && type.IsAssignableFrom(t)); } selector.StartPosition = FormStartPosition.CenterParent; if (selector.ShowDialog() == DialogResult.OK && selector.SelectedType != null) { obj = Constructor.Construct(selector.SelectedType); } } else { obj = Constructor.Construct(type); } return(obj); }