Ejemplo n.º 1
0
        public void AddAssociation(
            string extension,
            string description,
            string editorClass,
            SaveEditorCallback saveEditorCallback)
        {
            var association = new SaveFileAssociation()
            {
                Extension          = extension,
                Description        = description,
                EditorClass        = editorClass,
                SaveEditorCallback = saveEditorCallback,
            };

            AddAssociation(association);
        }
Ejemplo n.º 2
0
 public bool TryGetSaveEditorCallback(
     string path,
     out SaveEditorCallback saveEditor)
 {
     if (Associations.TryGetValue(
             path,
             out var association))
     {
         saveEditor = association.SaveEditorCallback;
         return(true);
     }
     else
     {
         saveEditor = null;
         return(false);
     }
 }
Ejemplo n.º 3
0
        public void SaveFile(
            IEditor editor,
            string path,
            SaveEditorCallback saveEditor)
        {
            if (editor is null)
            {
                throw new ArgumentNullException(nameof(editor));
            }

            if (saveEditor is null)
            {
                throw new ArgumentNullException(nameof(saveEditor));
            }

            if (!TrySaveEditor(editor, path, saveEditor))
            {
                return;
            }

            editor.Path = path;
            OnEditorSaved(new EditorEventArgs(editor));
        }