Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/tools/Templates/HeuristicLab.VS2010Wizards/ProblemWizardForm.cs @ 7403

Last change on this file since 7403 was 5878, checked in by abeham, 14 years ago

#567

  • Considered new base class names SingleObjectiveHeuristicOptimizationProblem<T, U> and MultiObjectiveHeuristicOptimizationProblem<T, U>
  • Updated template files
File size: 4.1 KB
Line 
1using System;
2using System.Windows.Forms;
3
4namespace HeuristicLab.VS2010Wizards {
5  public partial class ProblemWizardForm : Form {
6    public string ProblemName {
7      get;
8      private set;
9    }
10    public string ProblemDescription {
11      get;
12      private set;
13    }
14    public bool IsSingleObjective {
15      get;
16      private set;
17    }
18    public bool IsMultiObjective {
19      get;
20      private set;
21    }
22    public string ParameterProperties {
23      get;
24      private set;
25    }
26    public string Properties {
27      get;
28      private set;
29    }
30    public string ParameterInitializers {
31      get;
32      private set;
33    }
34    public string EvaluatorType {
35      get;
36      private set;
37    }
38    public string SolutionCreatorType {
39      get;
40      private set;
41    }
42    public string ProblemTypeImplementation {
43      get;
44      private set;
45    }
46
47    public ProblemWizardForm() {
48      InitializeComponent();
49      IsSingleObjective = singleObjectiveRadioButton.Checked;
50      IsMultiObjective = multiObjectiveRadioButton.Checked;
51      EvaluatorType = evaluatorTypeTextBox.Text;
52      SolutionCreatorType = solutionCreatorTypeTextBox.Text;
53      nextButton.Enabled = IsSingleObjective || IsMultiObjective;
54      finishButton.Enabled = nextButton.Enabled;
55    }
56
57    private void finishButton_Click(object sender, System.EventArgs e) {
58      SetProperties();
59      DialogResult = System.Windows.Forms.DialogResult.OK;
60      Close();
61    }
62
63    private void cancelButton_Click(object sender, System.EventArgs e) {
64      DialogResult = System.Windows.Forms.DialogResult.Cancel;
65      Close();
66    }
67
68    private void SetProperties() {
69      ProblemName = problemNameTextBox.Text;
70      ProblemDescription = problemDescriptionTextBox.Text;
71      IsSingleObjective = singleObjectiveRadioButton.Checked;
72      IsMultiObjective = multiObjectiveRadioButton.Checked;
73      ParameterProperties = parametersControl.GetParameterProperties("public");
74      Properties = parametersControl.GetProperties("public");
75      ParameterInitializers = parametersControl.GetInitializers();
76
77      if (IsSingleObjective) {
78        ProblemTypeImplementation = "SingleObjectiveHeuristicOptimizationProblem<" + EvaluatorType + ", " + SolutionCreatorType + ">";
79      } else if (IsMultiObjective) {
80        ProblemTypeImplementation = "MultiObjectiveHeuristicOptimizationProblem<" + EvaluatorType + ", " + SolutionCreatorType + ">";
81      }
82    }
83
84    private void nextButton_Click(object sender, EventArgs e) {
85      page1Panel.Visible = false;
86      page2Panel.Visible = true;
87      nextButton.Enabled = false;
88      previousButton.Enabled = true;
89    }
90
91    private void previousButton_Click(object sender, EventArgs e) {
92      page2Panel.Visible = false;
93      page1Panel.Visible = true;
94      previousButton.Enabled = false;
95      nextButton.Enabled = true;
96    }
97
98    private void singleObjectiveRadioButton_CheckedChanged(object sender, EventArgs e) {
99      IsSingleObjective = singleObjectiveRadioButton.Checked;
100      nextButton.Enabled = IsSingleObjective || IsMultiObjective;
101      finishButton.Enabled = nextButton.Enabled;
102    }
103    private void multiObjectiveRadioButton_CheckedChanged(object sender, EventArgs e) {
104      IsMultiObjective = multiObjectiveRadioButton.Checked;
105      nextButton.Enabled = IsSingleObjective || IsMultiObjective;
106      finishButton.Enabled = nextButton.Enabled;
107    }
108    private void problemNameTextBox_TextChanged(object sender, EventArgs e) {
109      ProblemName = problemNameTextBox.Text.Trim();
110      nextButton.Enabled = ProblemName != string.Empty;
111    }
112    private void evaluatorTypeTextBox_TextChanged(object sender, EventArgs e) {
113      EvaluatorType = evaluatorTypeTextBox.Text.Trim();
114      nextButton.Enabled = EvaluatorType != string.Empty;
115    }
116    private void solutionCreatorTypeTextBox_TextChanged(object sender, EventArgs e) {
117      SolutionCreatorType = solutionCreatorTypeTextBox.Text.Trim();
118      nextButton.Enabled = SolutionCreatorType != string.Empty;
119    }
120  }
121}
Note: See TracBrowser for help on using the repository browser.