public bool TryGetOpenEditorCallback( string path, out OpenEditorCallback openEditor) { return Associations.TryGetValue( path, out openEditor); }
public void OpenFile( IWin32Window owner, string path, OpenEditorCallback openEditor) { Owner = owner; OpenFile(path, openEditor); }
public void AddAssociation( string extension, string description, string editorClass, OpenEditorCallback openEditorCallback) { OpenWithForm.AddAssociation( extension, description, editorClass, openEditorCallback); }
public void OpenFile(OpenEditorCallback openEditor) { var files = UIChooseFiles(); if (files is null) { return; } foreach (var file in files) { OpenFile(file, openEditor); } }
protected virtual bool TryOpenFile( string path, OpenEditorCallback openEditor, out IEditor editor) { if (openEditor is null) { editor = null; return false; } loop: try { editor = openEditor(path); } catch (IOException ex) { if (ExceptionHandler is null) { throw ex; } if (ExceptionHandler.ShowExceptionAndRetry(ex)) { goto loop; } else { editor = null; return false; } } catch (Exception ex) { if (ExceptionHandler is null) { throw ex; } ExceptionHandler.ShowException(ex); editor = null; return false; } return true; }
public void AddAssociation( string extension, string description, string editorClass, OpenEditorCallback openEditorCallback) { var association = new OpenFileAssociation() { Extension = extension, Description = description, EditorClass = editorClass, OpenEditorCallback = openEditorCallback, }; AddAssociation(association); }
public void OpenFile(string path, OpenEditorCallback openEditor) { if (openEditor is null) { throw new ArgumentNullException( nameof(openEditor)); } if (!TryOpenFile(path, openEditor, out var editor)) { return; } if (editor is null) { return; } OnEditorOpened(new EditorEventArgs(editor)); }
public void AddAssociation( string extension, OpenEditorCallback openEditorCallback) { Associations.Add(extension, openEditorCallback); }
public void OpenFile(IWin32Window owner, OpenEditorCallback openEditor) { Owner = owner; OpenFile(openEditor); }