Beispiel #1
0
        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));
        }
Beispiel #2
0
        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));
        }
Beispiel #3
0
        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);
        }