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