Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 11964 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
RevLine 
[4188]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    }
[4214]14    public bool IsSingleObjective {
15      get;
16      private set;
17    }
[4188]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    }
[4214]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    }
[4188]46
47    public ProblemWizardForm() {
48      InitializeComponent();
[5704]49      IsSingleObjective = singleObjectiveRadioButton.Checked;
50      IsMultiObjective = multiObjectiveRadioButton.Checked;
[4214]51      EvaluatorType = evaluatorTypeTextBox.Text;
52      SolutionCreatorType = solutionCreatorTypeTextBox.Text;
[5704]53      nextButton.Enabled = IsSingleObjective || IsMultiObjective;
54      finishButton.Enabled = nextButton.Enabled;
[4188]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;
[5704]71      IsSingleObjective = singleObjectiveRadioButton.Checked;
72      IsMultiObjective = multiObjectiveRadioButton.Checked;
[4214]73      ParameterProperties = parametersControl.GetParameterProperties("public");
[4188]74      Properties = parametersControl.GetProperties("public");
75      ParameterInitializers = parametersControl.GetInitializers();
[4214]76
[5704]77      if (IsSingleObjective) {
[5878]78        ProblemTypeImplementation = "SingleObjectiveHeuristicOptimizationProblem<" + EvaluatorType + ", " + SolutionCreatorType + ">";
[4214]79      } else if (IsMultiObjective) {
[5878]80        ProblemTypeImplementation = "MultiObjectiveHeuristicOptimizationProblem<" + EvaluatorType + ", " + SolutionCreatorType + ">";
[4214]81      }
82    }
83
[4188]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    }
[4214]97
[5704]98    private void singleObjectiveRadioButton_CheckedChanged(object sender, EventArgs e) {
99      IsSingleObjective = singleObjectiveRadioButton.Checked;
[4214]100      nextButton.Enabled = IsSingleObjective || IsMultiObjective;
101      finishButton.Enabled = nextButton.Enabled;
102    }
[5704]103    private void multiObjectiveRadioButton_CheckedChanged(object sender, EventArgs e) {
104      IsMultiObjective = multiObjectiveRadioButton.Checked;
[4214]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    }
[4188]120  }
121}
Note: See TracBrowser for help on using the repository browser.