Changeset 4435 for trunk/sources/HeuristicLab.Optimizer
- Timestamp:
- 09/19/10 19:43:05 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimizer/3.3/FileManager.cs
r4245 r4435 93 93 else { 94 94 ((OptimizerMainForm)MainFormManager.MainForm).SetAppStartingCursor(); 95 var views = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v.Content == content).ToList(); 96 views.ForEach(v => v.ReadOnly = true); 97 views.ForEach(v => v.Locked = true); 95 SetEnabledStateOfContentViews(content, false); 98 96 ContentManager.SaveAsync(content, content.Filename, true, SavingCompleted); 99 97 } … … 120 118 if (saveFileDialog.ShowDialog() == DialogResult.OK) { 121 119 ((OptimizerMainForm)MainFormManager.MainForm).SetAppStartingCursor(); 122 var views = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v.Content == content).ToList(); 123 views.ForEach(v => v.ReadOnly = true); 124 views.ForEach(v => v.Locked = true); 120 SetEnabledStateOfContentViews(content, false); 125 121 if (saveFileDialog.FilterIndex == 1) { 126 122 ContentManager.SaveAsync(content, saveFileDialog.FileName, false, SavingCompleted); … … 133 129 private static void SavingCompleted(IStorableContent content, Exception error) { 134 130 try { 135 var views = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v.Content == content).ToList(); 136 views.ForEach(v => v.ReadOnly = false); 137 views.ForEach(v => v.Locked = false); 131 SetEnabledStateOfContentViews(content, true); 138 132 if (error != null) throw error; 139 133 MainFormManager.GetMainForm<OptimizerMainForm>().UpdateTitle(); … … 146 140 } 147 141 } 142 143 private static void SetEnabledStateOfContentViews(IStorableContent content, bool enabled) { 144 OptimizerMainForm mainForm = MainFormManager.GetMainForm<OptimizerMainForm>(); 145 if (mainForm.InvokeRequired) 146 mainForm.Invoke((Action<IStorableContent, bool>)SetEnabledStateOfContentViews, content, enabled); 147 else { 148 var views = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v.Content == content).ToList(); 149 views.ForEach(v => v.Enabled = enabled); 150 } 151 } 148 152 } 149 153 }
Note: See TracChangeset
for help on using the changeset viewer.