Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/19/10 06:19:16 (15 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on operators, engines, and optimization
Location:
trunk/sources/HeuristicLab.Core.Views/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/EngineView.Designer.cs

    r2826 r2834  
    5454      this.startButton = new System.Windows.Forms.Button();
    5555      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    56       this.newProblemButton = new System.Windows.Forms.Button();
    57       this.openProblemButton = new System.Windows.Forms.Button();
    58       this.saveProblemButton = new System.Windows.Forms.Button();
    5956      this.newOperatorGraphButton = new System.Windows.Forms.Button();
    6057      this.openOperatorGraphButton = new System.Windows.Forms.Button();
     
    6461      this.operatorGraphViewHost = new HeuristicLab.Core.Views.ViewHost();
    6562      this.globalScopeTabPage = new System.Windows.Forms.TabPage();
    66       this.problemTabPage = new System.Windows.Forms.TabPage();
    67       this.problemViewHost = new HeuristicLab.Core.Views.ViewHost();
    6863      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    6964      this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
     
    7166      this.operatorGraphTabPage.SuspendLayout();
    7267      this.globalScopeTabPage.SuspendLayout();
    73       this.problemTabPage.SuspendLayout();
    7468      this.SuspendLayout();
    7569      //
     
    142136      this.startButton.Click += new System.EventHandler(this.startButton_Click);
    143137      //
    144       // newProblemButton
    145       //
    146       this.newProblemButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.NewDocument;
    147       this.newProblemButton.Location = new System.Drawing.Point(6, 6);
    148       this.newProblemButton.Name = "newProblemButton";
    149       this.newProblemButton.Size = new System.Drawing.Size(24, 24);
    150       this.newProblemButton.TabIndex = 0;
    151       this.toolTip.SetToolTip(this.newProblemButton, "Create New Problem");
    152       this.newProblemButton.UseVisualStyleBackColor = true;
    153       this.newProblemButton.Click += new System.EventHandler(this.newProblemButton_Click);
    154       //
    155       // openProblemButton
    156       //
    157       this.openProblemButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Open;
    158       this.openProblemButton.Location = new System.Drawing.Point(36, 6);
    159       this.openProblemButton.Name = "openProblemButton";
    160       this.openProblemButton.Size = new System.Drawing.Size(24, 24);
    161       this.openProblemButton.TabIndex = 1;
    162       this.toolTip.SetToolTip(this.openProblemButton, "Open Problem");
    163       this.openProblemButton.UseVisualStyleBackColor = true;
    164       this.openProblemButton.Click += new System.EventHandler(this.openProblemButton_Click);
    165       //
    166       // saveProblemButton
    167       //
    168       this.saveProblemButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Save;
    169       this.saveProblemButton.Location = new System.Drawing.Point(66, 6);
    170       this.saveProblemButton.Name = "saveProblemButton";
    171       this.saveProblemButton.Size = new System.Drawing.Size(24, 24);
    172       this.saveProblemButton.TabIndex = 2;
    173       this.toolTip.SetToolTip(this.saveProblemButton, "Save Problem");
    174       this.saveProblemButton.UseVisualStyleBackColor = true;
    175       this.saveProblemButton.Click += new System.EventHandler(this.saveProblemButton_Click);
    176       //
    177138      // newOperatorGraphButton
    178139      //
     
    215176      this.tabControl.Controls.Add(this.operatorGraphTabPage);
    216177      this.tabControl.Controls.Add(this.globalScopeTabPage);
    217       this.tabControl.Controls.Add(this.problemTabPage);
    218178      this.tabControl.Location = new System.Drawing.Point(0, 0);
    219179      this.tabControl.Name = "tabControl";
     
    258218      this.globalScopeTabPage.Text = "Global Scope";
    259219      this.globalScopeTabPage.UseVisualStyleBackColor = true;
    260       //
    261       // problemTabPage
    262       //
    263       this.problemTabPage.Controls.Add(this.saveProblemButton);
    264       this.problemTabPage.Controls.Add(this.openProblemButton);
    265       this.problemTabPage.Controls.Add(this.newProblemButton);
    266       this.problemTabPage.Controls.Add(this.problemViewHost);
    267       this.problemTabPage.Location = new System.Drawing.Point(4, 22);
    268       this.problemTabPage.Name = "problemTabPage";
    269       this.problemTabPage.Padding = new System.Windows.Forms.Padding(3);
    270       this.problemTabPage.Size = new System.Drawing.Size(794, 584);
    271       this.problemTabPage.TabIndex = 2;
    272       this.problemTabPage.Text = "Problem";
    273       this.problemTabPage.UseVisualStyleBackColor = true;
    274       //
    275       // problemViewHost
    276       //
    277       this.problemViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    278                   | System.Windows.Forms.AnchorStyles.Left)
    279                   | System.Windows.Forms.AnchorStyles.Right)));
    280       this.problemViewHost.Content = null;
    281       this.problemViewHost.Location = new System.Drawing.Point(6, 36);
    282       this.problemViewHost.Name = "problemViewHost";
    283       this.problemViewHost.Size = new System.Drawing.Size(782, 542);
    284       this.problemViewHost.TabIndex = 3;
    285       this.problemViewHost.ViewType = null;
    286220      //
    287221      // openFileDialog
     
    315249      this.operatorGraphTabPage.ResumeLayout(false);
    316250      this.globalScopeTabPage.ResumeLayout(false);
    317       this.problemTabPage.ResumeLayout(false);
    318251      this.ResumeLayout(false);
    319252      this.PerformLayout();
     
    332265    protected System.Windows.Forms.TabControl tabControl;
    333266    protected System.Windows.Forms.TabPage globalScopeTabPage;
    334     protected System.Windows.Forms.TabPage problemTabPage;
    335     protected ViewHost problemViewHost;
    336     protected System.Windows.Forms.Button newProblemButton;
    337     protected System.Windows.Forms.Button saveProblemButton;
    338     protected System.Windows.Forms.Button openProblemButton;
    339267    protected System.Windows.Forms.OpenFileDialog openFileDialog;
    340268    protected System.Windows.Forms.SaveFileDialog saveFileDialog;
  • trunk/sources/HeuristicLab.Core.Views/3.3/EngineView.cs

    r2826 r2834  
    6262    protected override void DeregisterContentEvents() {
    6363      Content.OperatorGraphChanged -= new EventHandler(Content_OperatorGraphChanged);
    64       Content.ProblemChanged -= new EventHandler(Content_ProblemChanged);
    6564      Content.Prepared -= new EventHandler(Content_Prepared);
    6665      Content.Started -= new EventHandler(Content_Started);
     
    7877      base.RegisterContentEvents();
    7978      Content.OperatorGraphChanged += new EventHandler(Content_OperatorGraphChanged);
    80       Content.ProblemChanged += new EventHandler(Content_ProblemChanged);
    8179      Content.Prepared += new EventHandler(Content_Prepared);
    8280      Content.Started += new EventHandler(Content_Started);
     
    9795        operatorGraphViewHost.Enabled = false;
    9896        scopeView.Enabled = false;
    99         newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = false;
    100         problemViewHost.Enabled = false;
    10197        startButton.Enabled = resetButton.Enabled = false;
    10298        executionTimeTextBox.Enabled = false;
     
    107103        scopeView.Content = Content.GlobalScope;
    108104        scopeView.Enabled = true;
    109         newProblemButton.Enabled = openProblemButton.Enabled = true;
    110         saveProblemButton.Enabled = Content.Problem != null;
    111         problemViewHost.Content = Content.Problem;
    112         problemViewHost.Enabled = true;
    113105        startButton.Enabled = !Content.Finished;
    114106        resetButton.Enabled = true;
     
    124116      else
    125117        operatorGraphViewHost.Content = Content.OperatorGraph;
    126     }
    127     protected void Content_ProblemChanged(object sender, EventArgs e) {
    128       if (InvokeRequired)
    129         Invoke(new EventHandler(Content_ProblemChanged), sender, e);
    130       else {
    131         saveProblemButton.Enabled = Content.Problem != null;
    132         problemViewHost.Content = Content.Problem;
    133       }
    134118    }
    135119    protected virtual void Content_Prepared(object sender, EventArgs e) {
     
    140124        operatorGraphViewHost.Enabled = true;
    141125        scopeView.Enabled = true;
    142         newProblemButton.Enabled = openProblemButton.Enabled = true;
    143         saveProblemButton.Enabled = Content.Problem != null;
    144         problemViewHost.Enabled = true;
    145126        startButton.Enabled = !Content.Finished;
    146127        stopButton.Enabled = false;
     
    157138        operatorGraphViewHost.Enabled = false;
    158139        scopeView.Enabled = false;
    159         newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = false;
    160         problemViewHost.Enabled = false;
    161140        startButton.Enabled = false;
    162141        stopButton.Enabled = true;
     
    172151        operatorGraphViewHost.Enabled = true;
    173152        scopeView.Enabled = true;
    174         newProblemButton.Enabled = openProblemButton.Enabled = true;
    175         saveProblemButton.Enabled = Content.Problem != null;
    176         problemViewHost.Enabled = true;
    177153        startButton.Enabled = !Content.Finished;
    178154        stopButton.Enabled = false;
     
    230206      }
    231207    }
    232     protected void newProblemButton_Click(object sender, EventArgs e) {
    233       if (typeSelectorDialog == null) {
    234         typeSelectorDialog = new TypeSelectorDialog();
    235       }
    236       typeSelectorDialog.Caption = "Select Problem";
    237       typeSelectorDialog.TypeSelector.Configure(typeof(IProblem), false, false);
    238 
    239       if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
    240         Content.Problem = (IProblem)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
    241       }
    242     }
    243     protected void openProblemButton_Click(object sender, EventArgs e) {
    244       openFileDialog.Title = "Open Problem";
    245       if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
    246         IProblem problem = null;
    247         try {
    248           problem = XmlParser.Deserialize(openFileDialog.FileName) as IProblem;
    249         }
    250         catch (Exception ex) {
    251           Auxiliary.ShowErrorMessageBox(ex);
    252         }
    253         if (problem == null)
    254           MessageBox.Show(this, "Selected file does not contain a problem.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error);
    255         else
    256           Content.Problem = problem;
    257       }
    258     }
    259     protected void saveProblemButton_Click(object sender, EventArgs e) {
    260       saveFileDialog.Title = "Save Problem";
    261       if (saveFileDialog.ShowDialog(this) == DialogResult.OK) {
    262         try {
    263           if (saveFileDialog.FilterIndex == 1)
    264             XmlGenerator.Serialize(Content.Problem, saveFileDialog.FileName, 0);
    265           else
    266             XmlGenerator.Serialize(Content.Problem, saveFileDialog.FileName, 9);
    267         }
    268         catch (Exception ex) {
    269           Auxiliary.ShowErrorMessageBox(ex);
    270         }
    271       }
    272     }
    273208    protected virtual void startButton_Click(object sender, EventArgs e) {
    274209      Content.Start();
  • trunk/sources/HeuristicLab.Core.Views/3.3/HeuristicLab.Core.Views-3.3.csproj

    r2805 r2834  
    131131      <DependentUpon>OperatorTreeView.cs</DependentUpon>
    132132    </Compile>
    133     <Compile Include="ProblemView.cs">
    134       <SubType>UserControl</SubType>
    135     </Compile>
    136     <Compile Include="ProblemView.Designer.cs">
    137       <DependentUpon>ProblemView.cs</DependentUpon>
    138     </Compile>
    139133    <Compile Include="TypeSelectorDialog.cs">
    140134      <SubType>Form</SubType>
Note: See TracChangeset for help on using the changeset viewer.