Changeset 9851
- Timestamp:
- 08/06/13 12:15:20 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimizer/3.3/FileManager.cs
r9849 r9851 99 99 else { 100 100 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().SetAppStartingCursor(); 101 Set EnabledStateOfContentViews(content, false);101 SetSaveOperationProgressInContentViews(content, true); 102 102 ContentManager.SaveAsync(content, content.Filename, true, SavingCompleted); 103 103 } … … 124 124 if (saveFileDialog.ShowDialog() == DialogResult.OK) { 125 125 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().SetAppStartingCursor(); 126 Set EnabledStateOfContentViews(content, false);126 SetSaveOperationProgressInContentViews(content, true, saveFileDialog.FileName); 127 127 if (saveFileDialog.FilterIndex == 1) { 128 128 ContentManager.SaveAsync(content, saveFileDialog.FileName, false, SavingCompleted); … … 142 142 } 143 143 finally { 144 Set EnabledStateOfContentViews(content, true);144 SetSaveOperationProgressInContentViews(content, false); 145 145 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().ResetAppStartingCursor(); 146 146 } 147 147 } 148 148 149 private static void Set EnabledStateOfContentViews(IStorableContent content, bool enabled) {149 private static void SetSaveOperationProgressInContentViews(IStorableContent content, bool showProgress, string fileName = null) { 150 150 HeuristicLab.MainForm.WindowsForms.MainForm mainForm = MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>(); 151 151 #region Mono Compatibility 152 152 // removed the InvokeRequired check because of Mono 153 153 mainForm.Invoke((Action)delegate { 154 if (enabled) 154 if (showProgress) { 155 var progress = new Progress(string.Format("Saving file \"{0}\"...", Path.GetFileName(fileName ?? content.Filename))); 156 mainForm.AddOperationProgressToContent(content, progress); 157 } else 155 158 mainForm.RemoveOperationProgressFromContent(content); 156 else157 mainForm.AddOperationProgressToContent(content, new Progress(string.Format("Saving file \"{0}\"...", Path.GetFileName(content.Filename))));158 159 }); 159 160 #endregion
Note: See TracChangeset
for help on using the changeset viewer.