public void DnFinished(FileIOEventArgs e) { if (e.isSucceed) { try { Image p = Image.FromFile(e.LocalFilePath); if (pictureBox1.InvokeRequired) { Invoke(new Action(delegate { pictureBox1.BackgroundImage = p; })); } } catch (Exception Ex) { e.ErrDescription = Ex.Message; e.isSucceed = false; } } if (!e.isSucceed) { if (pictureBox1.InvokeRequired) { Invoke(new Action(delegate { pictureBox1.BackgroundImage = Resources.DefaultUserImage; })); } MessageBox.Show("尝试获取用户头像失败," + e.ErrDescription); } }
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 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 } }
public void SaveFileRequest_Handler(object sender, FileIOEventArgs e) { try { TheEditor.SaveFile(e.Path); } catch (Exception ex) { Log.Exception(ex); ShowException(ex, "The file could not be saved."); SetTimedStatusText("Error saving file.", duration: 10); #if !DEBUG return; #else throw; #endif } }
public void CloseFileRequest_Handler(object sender, FileIOEventArgs e) { if (IsDirty && !e.SuppressPrompting) { PromptSaveChanges((r) => { if (r != MessageBoxResult.Cancel) { if (r == MessageBoxResult.Yes) { SaveFile(); } ClearDirty(); CloseFile(); } }); return; } TheEditor.CloseFile(); }