Changeset 6935
- Timestamp:
- 10/18/11 16:02:58 (13 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs
r6827 r6935 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using System.Reflection; 25 26 using System.Windows.Forms; 26 27 using HeuristicLab.Common; … … 33 34 private int appStartingCursors; 34 35 private int waitingCursors; 36 private string title; 35 37 36 38 protected MainForm() … … 176 178 177 179 protected virtual void OnInitialized(EventArgs e) { 180 AssemblyFileVersionAttribute version = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true). 181 Cast<AssemblyFileVersionAttribute>().FirstOrDefault(); 182 title = "HeuristicLab Optimizer"; 183 if (version != null) title += " " + version.Version; 184 Title = title; 178 185 } 179 186 … … 491 498 } 492 499 #endregion 500 501 public virtual void UpdateTitle() { 502 if (InvokeRequired) 503 Invoke(new Action(UpdateTitle)); 504 else { 505 IContentView activeView = ActiveView as IContentView; 506 if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IStorableContent)) { 507 IStorableContent content = (IStorableContent)activeView.Content; 508 Title = title + " [" + (string.IsNullOrEmpty(content.Filename) ? "Unsaved" : content.Filename) + "]"; 509 } else { 510 Title = title; 511 } 512 } 513 } 493 514 } 494 515 } -
trunk/sources/HeuristicLab.Optimizer/3.3/FileManager.cs
r6827 r6935 131 131 SetEnabledStateOfContentViews(content, true); 132 132 if (error != null) throw error; 133 MainFormManager.GetMainForm< OptimizerDockingMainForm>().UpdateTitle();133 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().UpdateTitle(); 134 134 } 135 135 catch (Exception ex) { … … 142 142 143 143 private static void SetEnabledStateOfContentViews(IStorableContent content, bool enabled) { 144 OptimizerDockingMainForm mainForm = MainFormManager.GetMainForm<OptimizerDockingMainForm>();144 HeuristicLab.MainForm.WindowsForms.MainForm mainForm = MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>(); 145 145 if (mainForm.InvokeRequired) 146 146 mainForm.Invoke((Action<IStorableContent, bool>)SetEnabledStateOfContentViews, content, enabled); -
trunk/sources/HeuristicLab.Optimizer/3.3/OptimizerDockingMainForm.cs
r6827 r6935 23 23 using System.ComponentModel; 24 24 using System.Linq; 25 using System.Reflection;26 25 using System.Windows.Forms; 27 26 using HeuristicLab.Common; … … 33 32 namespace HeuristicLab.Optimizer { 34 33 internal partial class OptimizerDockingMainForm : DockingMainForm { 35 private string title;36 34 37 35 private Clipboard<IItem> clipboard; … … 55 53 protected override void OnInitialized(EventArgs e) { 56 54 base.OnInitialized(e); 57 AssemblyFileVersionAttribute version = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).58 Cast<AssemblyFileVersionAttribute>().FirstOrDefault();59 title = "HeuristicLab Optimizer";60 if (version != null) title += " " + version.Version;61 Title = title;62 55 63 56 ContentManager.Initialize(new PersistenceContentManager()); … … 103 96 UpdateTitle(); 104 97 } 105 106 public void UpdateTitle() {107 if (InvokeRequired)108 Invoke(new Action(UpdateTitle));109 else {110 IContentView activeView = ActiveView as IContentView;111 if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IStorableContent)) {112 IStorableContent content = (IStorableContent)activeView.Content;113 Title = title + " [" + (string.IsNullOrEmpty(content.Filename) ? "Unsaved" : content.Filename) + "]";114 } else {115 Title = title;116 }117 }118 }119 98 } 120 99 } -
trunk/sources/HeuristicLab.Optimizer/3.3/OptimizerMultipleDocumentMainForm.cs
r6827 r6935 23 23 using System.ComponentModel; 24 24 using System.Linq; 25 using System.Reflection;26 25 using System.Windows.Forms; 27 26 using HeuristicLab.Common; … … 33 32 namespace HeuristicLab.Optimizer { 34 33 internal partial class OptimizerMultipleDocumentMainForm : MultipleDocumentMainForm { 35 private string title;36 34 37 35 private Clipboard<IItem> clipboard; … … 55 53 protected override void OnInitialized(EventArgs e) { 56 54 base.OnInitialized(e); 57 AssemblyFileVersionAttribute version = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).58 Cast<AssemblyFileVersionAttribute>().FirstOrDefault();59 title = "HeuristicLab Optimizer";60 if (version != null) title += " " + version.Version;61 Title = title;62 55 63 56 ContentManager.Initialize(new PersistenceContentManager()); … … 103 96 UpdateTitle(); 104 97 } 105 106 public void UpdateTitle() {107 if (InvokeRequired)108 Invoke(new Action(UpdateTitle));109 else {110 IContentView activeView = ActiveView as IContentView;111 if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IStorableContent)) {112 IStorableContent content = (IStorableContent)activeView.Content;113 Title = title + " [" + (string.IsNullOrEmpty(content.Filename) ? "Unsaved" : content.Filename) + "]";114 } else {115 Title = title;116 }117 }118 }119 98 } 120 99 } -
trunk/sources/HeuristicLab.Optimizer/3.3/OptimizerSingleDocumentMainForm.cs
r6827 r6935 23 23 using System.ComponentModel; 24 24 using System.Linq; 25 using System.Reflection;26 25 using System.Windows.Forms; 27 26 using HeuristicLab.Common; … … 33 32 namespace HeuristicLab.Optimizer { 34 33 internal partial class OptimizerSingleDocumentMainForm : SingleDocumentMainForm { 35 private string title;36 34 37 35 private Clipboard<IItem> clipboard; … … 55 53 protected override void OnInitialized(EventArgs e) { 56 54 base.OnInitialized(e); 57 AssemblyFileVersionAttribute version = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).58 Cast<AssemblyFileVersionAttribute>().FirstOrDefault();59 title = "HeuristicLab Optimizer";60 if (version != null) title += " " + version.Version;61 Title = title;62 55 63 56 ContentManager.Initialize(new PersistenceContentManager()); … … 103 96 UpdateTitle(); 104 97 } 105 106 public void UpdateTitle() {107 if (InvokeRequired)108 Invoke(new Action(UpdateTitle));109 else {110 IContentView activeView = ActiveView as IContentView;111 if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IStorableContent)) {112 IStorableContent content = (IStorableContent)activeView.Content;113 Title = title + " [" + (string.IsNullOrEmpty(content.Filename) ? "Unsaved" : content.Filename) + "]";114 } else {115 Title = title;116 }117 }118 }119 98 } 120 99 }
Note: See TracChangeset
for help on using the changeset viewer.