public bool TryGetCreator( IEditor editor, out Func <IEditor, Form> createEditorForm) { if (editor is null) { throw new ArgumentNullException(nameof(editor)); } return(EditorFormCreator.TryGetValue( editor.GetType(), out createEditorForm)); }
public bool TryGetCreator( Type type, out Func <IEditor, Form> createEditorForm) { if (type.GetInterface(nameof(IEditor)) is null) { throw new InvalidCastException(); } return(EditorFormCreator.TryGetValue( type, out createEditorForm)); }
public void AddCreatorFunction( Type type, Func <IEditor, Form> createEditorForm) { if (type is null) { throw new ArgumentNullException(nameof(type)); } if (createEditorForm is null) { throw new ArgumentNullException(nameof(createEditorForm)); } if (!typeof(IEditor).IsAssignableFrom(type)) { throw new ArgumentException(); } EditorFormCreator.Add(type, createEditorForm); }