Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PluginInfrastructure Refactoring/HeuristicLab.Optimizer/3.3/ToolBarItems/SaveAllToolBarItem.cs @ 2591

Last change on this file since 2591 was 2555, checked in by swagner, 15 years ago

Continued work on Optimizer (#770)

File size: 1.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows.Forms;
6using System.Drawing;
7using HeuristicLab.MainForm;
8using HeuristicLab.MainForm.WindowsForms;
9using HeuristicLab.Common.Resources;
10using HeuristicLab.Core;
11using HeuristicLab.Core.Views;
12
13namespace HeuristicLab.Optimizer {
14  internal class SaveAllToolBarItem : HeuristicLab.MainForm.WindowsForms.ToolBarItemBase, IOptimizerUserInterfaceItemProvider {
15    public override string Name {
16      get { return "Save All"; }
17    }
18    public override string ToolTipText {
19      get { return "Save All Files"; }
20    }
21    public override int Position {
22      get { return 40; }
23    }
24    public override Image Image {
25      get { return Resources.SaveAllIcon; }
26    }
27
28    public override void MainFormInitialized(object sender, EventArgs e) {
29      ToolStripItem.Enabled = false;
30    }
31    public override void ActiveViewChanged(object sender, EventArgs e) {
32      var views = from v in MainFormManager.MainForm.Views
33                  where v is IItemView
34                  where CreatableAttribute.IsCreatable(((IItemView)v).Item.GetType())
35                  select v;
36      ToolStripItem.Enabled = views.FirstOrDefault() != null;
37    }
38
39    public override void Execute() {
40      FileManager.SaveAll();
41    }
42  }
43}
Note: See TracBrowser for help on using the repository browser.