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 | internal class CreateTargetVariationExperiment : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {
|
---|
10 | public override string Name {
|
---|
11 | get { return "Create Target Variation &Experiment"; }
|
---|
12 | }
|
---|
13 | public override IEnumerable<string> Structure {
|
---|
14 | get { return new string[] { "&Edit" }; }
|
---|
15 | }
|
---|
16 | public override int Position {
|
---|
17 | get { return 2300; }
|
---|
18 | }
|
---|
19 | public override string ToolTipText {
|
---|
20 | get { return "Create an experiment for varying the target variable"; }
|
---|
21 | }
|
---|
22 |
|
---|
23 | protected override void OnToolStripItemSet(EventArgs e) {
|
---|
24 | ToolStripItem.Enabled = false;
|
---|
25 | }
|
---|
26 | protected override void OnActiveViewChanged(object sender, EventArgs e) {
|
---|
27 | IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
|
---|
28 | ToolStripItem.Enabled = (activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked;
|
---|
29 | }
|
---|
30 |
|
---|
31 | public override void Execute() {
|
---|
32 | IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
|
---|
33 | if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked)
|
---|
34 | {
|
---|
35 | var experiment = TargetVariation.CreateVariableCombinations((IAlgorithm) activeView.Content);
|
---|
36 | MainFormManager.MainForm.ShowContent(experiment);
|
---|
37 | }
|
---|
38 | }
|
---|
39 | }
|
---|
40 | }
|
---|