Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/08/10 00:20:29 (15 years ago)
Author:
swagner
Message:

Refactored enabling and disabling of save buttons and menu items to prevent saving of running algorithms (#685)

Location:
trunk/sources/HeuristicLab.Optimizer/3.3/ToolBarItems
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimizer/3.3/ToolBarItems/SaveAllToolBarItem.cs

    r2960 r2961  
    2424using System.Linq;
    2525using System.Windows.Forms;
    26 using HeuristicLab.Core;
    27 using HeuristicLab.Core.Views;
    2826using HeuristicLab.MainForm;
    2927
     
    4745    }
    4846    protected override void OnActiveViewChanged(object sender, EventArgs e) {
    49       var views = from v in MainFormManager.MainForm.Views
    50                   where v is IContentView
    51                   where ((v is ItemView) && ((ItemView)v).EnableFileOperations) || (!(v is ItemView))
     47      var views = from v in MainFormManager.MainForm.Views.OfType<IContentView>()
     48                  where v.SaveEnabled
    5249                  select v;
    5350      ToolStripItem.Enabled = views.FirstOrDefault() != null;
  • trunk/sources/HeuristicLab.Optimizer/3.3/ToolBarItems/SaveToolBarItem.cs

    r2960 r2961  
    2323using System.Drawing;
    2424using System.Windows.Forms;
    25 using HeuristicLab.Core;
    26 using HeuristicLab.Core.Views;
    2725using HeuristicLab.MainForm;
    2826
     
    4745    protected override void OnActiveViewChanged(object sender, EventArgs e) {
    4846      IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
    49       bool enable = activeView != null;
    50       ItemView itemView = MainFormManager.MainForm.ActiveView as ItemView;
    51       if ((enable) && (itemView != null)) enable = itemView.EnableFileOperations;
    52       ToolStripItem.Enabled = enable;
     47      ToolStripItem.Enabled = (activeView != null) && (activeView.SaveEnabled);
    5348    }
    5449
Note: See TracChangeset for help on using the changeset viewer.