Changeset 7013


Ignore:
Timestamp:
11/17/11 14:09:13 (11 years ago)
Author:
ascheibe
Message:

#1652 implemented reviewing comments:

  • deleted resource files
  • moved UpdateTitle and OnInitialized code to Optimizer*MainForm
Location:
trunk/sources
Files:
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs

    r6935 r7013  
    2323using System.Collections.Generic;
    2424using System.Linq;
    25 using System.Reflection;
    2625using System.Windows.Forms;
    2726using HeuristicLab.Common;
     
    3433    private int appStartingCursors;
    3534    private int waitingCursors;
    36     private string title;
    3735
    3836    protected MainForm()
     
    177175    }
    178176
    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;
    185     }
     177    protected virtual void OnInitialized(EventArgs e) { }
     178
     179    public virtual void UpdateTitle() { }
    186180
    187181    private void FormActivated(object sender, EventArgs e) {
     
    498492    }
    499493    #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     }
    514494  }
    515495}
  • trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj

    r6999 r7013  
    120120    <EmbeddedResource Include="Documents\VNS_TSP.hl" />
    121121    <EmbeddedResource Include="Documents\PSO_Schwefel.hl" />
    122     <EmbeddedResource Include="MainFormTypeSelectionDialog.resx">
    123       <DependentUpon>MainFormTypeSelectionDialog.cs</DependentUpon>
    124     </EmbeddedResource>
    125     <EmbeddedResource Include="OptimizerDockingMainForm.resx">
    126       <DependentUpon>OptimizerDockingMainForm.cs</DependentUpon>
    127     </EmbeddedResource>
    128122    <None Include="Plugin.cs.frame" />
    129123    <Compile Include="OptimizerSingleDocumentMainForm.cs">
  • trunk/sources/HeuristicLab.Optimizer/3.3/OptimizerDockingMainForm.cs

    r6935 r7013  
    2323using System.ComponentModel;
    2424using System.Linq;
     25using System.Reflection;
    2526using System.Windows.Forms;
    2627using HeuristicLab.Common;
     
    3233namespace HeuristicLab.Optimizer {
    3334  internal partial class OptimizerDockingMainForm : DockingMainForm {
     35    private string title;
    3436
    3537    private Clipboard<IItem> clipboard;
     
    5355    protected override void OnInitialized(EventArgs e) {
    5456      base.OnInitialized(e);
     57
     58      AssemblyFileVersionAttribute version = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).
     59                                         Cast<AssemblyFileVersionAttribute>().FirstOrDefault();
     60      title = "HeuristicLab Optimizer";
     61      if (version != null) title += " " + version.Version;
     62      Title = title;
    5563
    5664      ContentManager.Initialize(new PersistenceContentManager());
     
    96104      UpdateTitle();
    97105    }
     106
     107    public override void UpdateTitle() {
     108      if (InvokeRequired)
     109        Invoke(new Action(UpdateTitle));
     110      else {
     111        IContentView activeView = ActiveView as IContentView;
     112        if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IStorableContent)) {
     113          IStorableContent content = (IStorableContent)activeView.Content;
     114          Title = title + " [" + (string.IsNullOrEmpty(content.Filename) ? "Unsaved" : content.Filename) + "]";
     115        } else {
     116          Title = title;
     117        }
     118      }
     119    }
    98120  }
    99121}
  • trunk/sources/HeuristicLab.Optimizer/3.3/OptimizerMultipleDocumentMainForm.cs

    r6935 r7013  
    2323using System.ComponentModel;
    2424using System.Linq;
     25using System.Reflection;
    2526using System.Windows.Forms;
    2627using HeuristicLab.Common;
     
    3233namespace HeuristicLab.Optimizer {
    3334  internal partial class OptimizerMultipleDocumentMainForm : MultipleDocumentMainForm {
     35    private string title;
    3436
    3537    private Clipboard<IItem> clipboard;
     
    5355    protected override void OnInitialized(EventArgs e) {
    5456      base.OnInitialized(e);
     57
     58      AssemblyFileVersionAttribute version = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).
     59                                         Cast<AssemblyFileVersionAttribute>().FirstOrDefault();
     60      title = "HeuristicLab Optimizer";
     61      if (version != null) title += " " + version.Version;
     62      Title = title;
    5563
    5664      ContentManager.Initialize(new PersistenceContentManager());
     
    96104      UpdateTitle();
    97105    }
     106
     107    public override void UpdateTitle() {
     108      if (InvokeRequired)
     109        Invoke(new Action(UpdateTitle));
     110      else {
     111        IContentView activeView = ActiveView as IContentView;
     112        if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IStorableContent)) {
     113          IStorableContent content = (IStorableContent)activeView.Content;
     114          Title = title + " [" + (string.IsNullOrEmpty(content.Filename) ? "Unsaved" : content.Filename) + "]";
     115        } else {
     116          Title = title;
     117        }
     118      }
     119    }
    98120  }
    99121}
  • trunk/sources/HeuristicLab.Optimizer/3.3/OptimizerSingleDocumentMainForm.cs

    r6935 r7013  
    2323using System.ComponentModel;
    2424using System.Linq;
     25using System.Reflection;
    2526using System.Windows.Forms;
    2627using HeuristicLab.Common;
     
    3233namespace HeuristicLab.Optimizer {
    3334  internal partial class OptimizerSingleDocumentMainForm : SingleDocumentMainForm {
     35    private string title;
    3436
    3537    private Clipboard<IItem> clipboard;
     
    5355    protected override void OnInitialized(EventArgs e) {
    5456      base.OnInitialized(e);
     57
     58      AssemblyFileVersionAttribute version = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).
     59                                         Cast<AssemblyFileVersionAttribute>().FirstOrDefault();
     60      title = "HeuristicLab Optimizer";
     61      if (version != null) title += " " + version.Version;
     62      Title = title;
    5563
    5664      ContentManager.Initialize(new PersistenceContentManager());
     
    96104      UpdateTitle();
    97105    }
     106
     107    public override void UpdateTitle() {
     108      if (InvokeRequired)
     109        Invoke(new Action(UpdateTitle));
     110      else {
     111        IContentView activeView = ActiveView as IContentView;
     112        if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IStorableContent)) {
     113          IStorableContent content = (IStorableContent)activeView.Content;
     114          Title = title + " [" + (string.IsNullOrEmpty(content.Filename) ? "Unsaved" : content.Filename) + "]";
     115        } else {
     116          Title = title;
     117        }
     118      }
     119    }
    98120  }
    99121}
Note: See TracChangeset for help on using the changeset viewer.