- Timestamp:
- 07/18/14 13:44:53 (10 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll 10 11 HeuristicLab 3.3.5.1.ReSharper.user 11 12 HeuristicLab 3.3.6.0.ReSharper.user 12 13 HeuristicLab.4.5.resharper.user 13 14 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development 14 16 HeuristicLab.resharper.user 15 17 ProtoGen.exe … … 17 19 _ReSharper.HeuristicLab 18 20 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests 19 22 _ReSharper.HeuristicLab.ExtLibs 20 23 bin 21 24 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HiveStatistics/sources/HeuristicLab.Optimizer/3.3/FileManager.cs
r11203 r11205 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System; 23 23 using System.Collections.Generic; 24 using System. Linq;24 using System.IO; 25 25 using System.Windows.Forms; 26 26 using HeuristicLab.Common; 27 using HeuristicLab.Core; 27 28 using HeuristicLab.MainForm; 28 29 using HeuristicLab.PluginInfrastructure; … … 98 99 SaveAs(view); 99 100 else { 100 ((MainForm.WindowsForms.MainForm)MainFormManager.MainForm).SetAppStartingCursor();101 Set EnabledStateOfContentViews(content, false);101 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().SetAppStartingCursor(); 102 SetSaveOperationProgressInContentViews(content, true); 102 103 ContentManager.SaveAsync(content, content.Filename, true, SavingCompleted); 103 104 } … … 120 121 saveFileDialog.FilterIndex = 2; 121 122 } 122 saveFileDialog.FileName = string.IsNullOrEmpty(content.Filename) ? "Item" : content.Filename; 123 124 INamedItem namedItem = content as INamedItem; 125 string suggestedFileName = string.Empty; 126 if (!string.IsNullOrEmpty(content.Filename)) suggestedFileName = content.Filename; 127 else if (namedItem != null) suggestedFileName = namedItem.Name; 128 else suggestedFileName = "Item"; 129 130 saveFileDialog.FileName = suggestedFileName; 123 131 124 132 if (saveFileDialog.ShowDialog() == DialogResult.OK) { 125 ((MainForm.WindowsForms.MainForm)MainFormManager.MainForm).SetAppStartingCursor();126 Set EnabledStateOfContentViews(content, false);133 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().SetAppStartingCursor(); 134 SetSaveOperationProgressInContentViews(content, true, saveFileDialog.FileName); 127 135 if (saveFileDialog.FilterIndex == 1) { 128 136 ContentManager.SaveAsync(content, saveFileDialog.FileName, false, SavingCompleted); … … 135 143 private static void SavingCompleted(IStorableContent content, Exception error) { 136 144 try { 137 SetEnabledStateOfContentViews(content, true);138 145 if (error != null) throw error; 139 146 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().UpdateTitle(); … … 143 150 } 144 151 finally { 145 ((MainForm.WindowsForms.MainForm)MainFormManager.MainForm).ResetAppStartingCursor(); 152 SetSaveOperationProgressInContentViews(content, false); 153 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().ResetAppStartingCursor(); 146 154 } 147 155 } 148 156 149 private static void Set EnabledStateOfContentViews(IStorableContent content, bool enabled) {157 private static void SetSaveOperationProgressInContentViews(IStorableContent content, bool showProgress, string fileName = null) { 150 158 HeuristicLab.MainForm.WindowsForms.MainForm mainForm = MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>(); 151 159 #region Mono Compatibility 152 160 // removed the InvokeRequired check because of Mono 153 161 mainForm.Invoke((Action)delegate { 154 var views = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v.Content == content).ToList(); 155 views.ForEach(v => v.Enabled = enabled); 162 if (showProgress) { 163 mainForm.AddOperationProgressToContent(content, string.Format("Saving to file \"{0}\"...", Path.GetFileName(fileName ?? content.Filename))); 164 } else 165 mainForm.RemoveOperationProgressFromContent(content); 156 166 }); 157 167 #endregion
Note: See TracChangeset
for help on using the changeset viewer.