private void OnFileClosed() { OnPropertyChanged(nameof(IsFileOpen)); Log.Info("File closed."); FileClosed?.Invoke(this, EventArgs.Empty); }
private void StopTrackingOldFiles(IList e) { foreach (ISEFile file in e) { if (FileClosed != null) { FileClosed.Invoke(this, new ViewPathEventArgs(file.FullPath)); } } }
public void CloseFile() { var localFilePath = this.filePath; FileClosing?.Invoke(this, new FileClosingEventArgs(localFilePath)); this.filePath = null; this.memory = null; FileClosed?.Invoke(this, new FileClosedEventArgs(localFilePath)); }
/// <summary> /// Closes the file /// </summary> /// <param name="File">File to close</param> public virtual void CloseFile(FileViewModel file) { if (file != null) { var args = new FileClosingEventArgs(); args.File = file; FileClosing?.Invoke(this, args); if (!args.Cancel) { for (var i = OpenFiles.Count - 1; i >= 0; i--) { if (ReferenceEquals(OpenFiles[i], file)) { OpenFiles[i].Dispose(); var openFilesCount = OpenFiles.Count; try { OpenFiles.RemoveAt(i); } catch (NullReferenceException) { // There's been a bug in a dependency where OpenFiles.RemoveAt fails because of UI stuff. // If the same exception is encountered, and the file has actually been removed, then ignore it. if (openFilesCount <= OpenFiles.Count) // OpenFiles.Count should have decreased by 1. If it has not, then throw the exception. { throw; } } } } if (ReferenceEquals(file, SelectedFile)) { SelectedFile = null; } FileClosed?.Invoke(this, new FileClosedEventArgs { File = file.Model }); } } }
public void Dispose() { Dispose(true); GC.SuppressFinalize(this); FileClosed?.Invoke(this, new FileClosedArgs(_filename)); }
public static void OnFileClosed() { FileClosed?.Invoke(); }