1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Windows.Forms;
|
---|
4 | using HeuristicLab.MainForm;
|
---|
5 | using HeuristicLab.Optimization;
|
---|
6 | using HeuristicLab.Optimizer;
|
---|
7 |
|
---|
8 | namespace HeuristicLab.VariableInteractionNetworks
|
---|
9 | {
|
---|
10 | internal class CreateTargetVariationExperiment : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider
|
---|
11 | {
|
---|
12 | public override string Name
|
---|
13 | {
|
---|
14 | get { return "Create Target Variation &Experiment"; }
|
---|
15 | }
|
---|
16 | public override IEnumerable<string> Structure
|
---|
17 | {
|
---|
18 | get { return new string[] { "&Edit" }; }
|
---|
19 | }
|
---|
20 | public override int Position
|
---|
21 | {
|
---|
22 | get { return 2300; }
|
---|
23 | }
|
---|
24 | public override string ToolTipText
|
---|
25 | {
|
---|
26 | get { return "Create an experiment for varying the target variable"; }
|
---|
27 | }
|
---|
28 |
|
---|
29 | protected override void OnToolStripItemSet(EventArgs e)
|
---|
30 | {
|
---|
31 | ToolStripItem.Enabled = false;
|
---|
32 | }
|
---|
33 | protected override void OnActiveViewChanged(object sender, EventArgs e)
|
---|
34 | {
|
---|
35 | IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
|
---|
36 | ToolStripItem.Enabled = (activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked;
|
---|
37 | }
|
---|
38 |
|
---|
39 | public override void Execute()
|
---|
40 | {
|
---|
41 | IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
|
---|
42 | if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked)
|
---|
43 | {
|
---|
44 | using (CreateTargetVariationExperimentDialog dialog = new CreateTargetVariationExperimentDialog((IAlgorithm)activeView.Content))
|
---|
45 | {
|
---|
46 | if (dialog.ShowDialog() == DialogResult.OK) MainFormManager.MainForm.ShowContent(dialog.Experiment);
|
---|
47 | }
|
---|
48 | }
|
---|
49 | }
|
---|
50 | }
|
---|
51 | } |
---|