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/MenuItems
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/SaveAllMenuItem.cs

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

    r2960 r2961  
    2323using System.Collections.Generic;
    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
  • trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/SaveMenuItem.cs

    r2960 r2961  
    2424using System.Drawing;
    2525using System.Windows.Forms;
    26 using HeuristicLab.Core;
    27 using HeuristicLab.Core.Views;
    2826using HeuristicLab.MainForm;
    2927
     
    5149    protected override void OnActiveViewChanged(object sender, EventArgs e) {
    5250      IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
    53       bool enable = activeView != null;
    54       ItemView itemView = MainFormManager.MainForm.ActiveView as ItemView;
    55       if ((enable) && (itemView != null)) enable = itemView.EnableFileOperations;
    56       ToolStripItem.Enabled = enable;
     51      ToolStripItem.Enabled = (activeView != null) && (activeView.SaveEnabled);
    5752    }
    5853
Note: See TracChangeset for help on using the changeset viewer.