public void RevertFileRequest_Handler(object sender, FileIOEventArgs e) { if (IsDirty && !e.SuppressPrompting) { PromptConfirmRevert((r) => { if (r == MessageBoxResult.Yes) { ClearDirty(); RevertFile(); } }); return; } m_isRevertingFile = true; Log.Info("Reverting file..."); Tabs.Where(t => t.Visibility == TabPageVisibility.WhenFileIsOpen).ToList().ForEach(t => t.Unload()); TheEditor.CloseFile(); TheEditor.OpenFile(TheSettings.MostRecentFile); Tabs.Where(t => t.Visibility == TabPageVisibility.WhenFileIsOpen).ToList().ForEach(t => t.Load()); Tabs.Where(t => t.Visibility == TabPageVisibility.WhenFileIsOpen).ToList().ForEach(t => t.Update()); Log.Info("File reverted."); m_isRevertingFile = false; }
public void OpenSelectedItem() { CancelSearch(); if (SelectedFile != null) { TheEditor.OpenFile(SelectedFile.Path); } }
public void OpenFileRequest_Handler(object sender, FileIOEventArgs e) { if (TheEditor.IsFileOpen) { if (IsDirty && !e.SuppressPrompting) { PromptSaveChanges((r) => { if (r != MessageBoxResult.Cancel) { if (r == MessageBoxResult.Yes) { SaveFile(); } ClearDirty(); OpenFile(TheSettings.LastFileAccessed); } }); return; } CloseFile(); } try { TheEditor.OpenFile(e.Path); } catch (Exception ex) { Log.Exception(ex); if (ex is InvalidDataException) { ShowError("The file is not a valid GTA:LCS save file."); return; } ShowException(ex, "The file could not be opened."); #if !DEBUG return; #else throw; #endif } }