Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.MainForm.Test/3.2/ButtonItems/SaveToolStripButtonItem.cs @ 2254

Last change on this file since 2254 was 2254, checked in by mkommend, 15 years ago

added ability for toolstripitems to listen for specific events (ticket #716)

File size: 1.2 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5
6namespace HeuristicLab.MainForm.Test {
7  public class SaveToolStripButtonItem : ToolStripButtonItemBase, ITestUserInterfaceItemProvider {
8    public override int Position {
9      get { return 30; }
10    }
11
12    public override string Name {
13      get { return "Save"; }
14    }
15
16    public override System.Drawing.Image Image {
17      get { return HeuristicLab.Common.Resources.Resources.SaveIcon; }
18    }
19
20    public override void Execute(IMainForm mainform) {
21      new SaveAction().Execute(mainform);
22    }
23
24    public override bool ListenActiveViewChanged {
25      get { return true; }
26    }
27
28    public override void ActiveViewChanged(object sender, EventArgs e) {
29      IMainForm mainform = (IMainForm)sender;
30      if (mainform.ActiveView == null)
31        this.ToolStripItem.Enabled = false;
32      else
33        this.ToolStripItem.Enabled = !(mainform.ActiveView is FormView);
34    }
35
36    public override bool ListenViewStateChanged {
37      get { return true; }
38    }
39
40    public override void ViewStateChanged(object sender, EventArgs e) {
41      this.ToolStripItem.Enabled = !this.ToolStripItem.Enabled;
42    }
43  }
44}
Note: See TracBrowser for help on using the repository browser.