Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/04/10 05:22:47 (14 years ago)
Author:
swagner
Message:

Continued work on algorithm batch processing (#947).

Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.Designer.cs

    r3226 r3262  
    5757      this.resultsView = new HeuristicLab.Optimization.Views.ResultCollectionView();
    5858      this.startButton = new System.Windows.Forms.Button();
    59       this.stopButton = new System.Windows.Forms.Button();
     59      this.pauseButton = new System.Windows.Forms.Button();
    6060      this.resetButton = new System.Windows.Forms.Button();
    6161      this.executionTimeLabel = new System.Windows.Forms.Label();
     
    6363      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    6464      this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
     65      this.stopButton = new System.Windows.Forms.Button();
    6566      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    6667      this.tabControl.SuspendLayout();
     
    211212      this.startButton.Click += new System.EventHandler(this.startButton_Click);
    212213      //
    213       // stopButton
    214       //
    215       this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    216       this.stopButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Pause;
    217       this.stopButton.Location = new System.Drawing.Point(30, 458);
    218       this.stopButton.Name = "stopButton";
    219       this.stopButton.Size = new System.Drawing.Size(24, 24);
    220       this.stopButton.TabIndex = 6;
    221       this.toolTip.SetToolTip(this.stopButton, "Pause Algorithm");
    222       this.stopButton.UseVisualStyleBackColor = true;
    223       this.stopButton.Click += new System.EventHandler(this.stopButton_Click);
     214      // pauseButton
     215      //
     216      this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     217      this.pauseButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Pause;
     218      this.pauseButton.Location = new System.Drawing.Point(30, 458);
     219      this.pauseButton.Name = "pauseButton";
     220      this.pauseButton.Size = new System.Drawing.Size(24, 24);
     221      this.pauseButton.TabIndex = 6;
     222      this.toolTip.SetToolTip(this.pauseButton, "Pause Algorithm");
     223      this.pauseButton.UseVisualStyleBackColor = true;
     224      this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click);
    224225      //
    225226      // resetButton
     
    227228      this.resetButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    228229      this.resetButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Restart;
    229       this.resetButton.Location = new System.Drawing.Point(60, 458);
     230      this.resetButton.Location = new System.Drawing.Point(90, 458);
    230231      this.resetButton.Name = "resetButton";
    231232      this.resetButton.Size = new System.Drawing.Size(24, 24);
    232       this.resetButton.TabIndex = 7;
     233      this.resetButton.TabIndex = 8;
    233234      this.toolTip.SetToolTip(this.resetButton, "Reset Algorithm");
    234235      this.resetButton.UseVisualStyleBackColor = true;
     
    242243      this.executionTimeLabel.Name = "executionTimeLabel";
    243244      this.executionTimeLabel.Size = new System.Drawing.Size(83, 13);
    244       this.executionTimeLabel.TabIndex = 8;
     245      this.executionTimeLabel.TabIndex = 9;
    245246      this.executionTimeLabel.Text = "&Execution Time:";
    246247      //
     
    252253      this.executionTimeTextBox.ReadOnly = true;
    253254      this.executionTimeTextBox.Size = new System.Drawing.Size(137, 20);
    254       this.executionTimeTextBox.TabIndex = 9;
     255      this.executionTimeTextBox.TabIndex = 10;
    255256      //
    256257      // openFileDialog
     
    269270      this.saveFileDialog.Title = "Save Problem";
    270271      //
     272      // stopButton
     273      //
     274      this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     275      this.stopButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Stop;
     276      this.stopButton.Location = new System.Drawing.Point(60, 458);
     277      this.stopButton.Name = "stopButton";
     278      this.stopButton.Size = new System.Drawing.Size(24, 24);
     279      this.stopButton.TabIndex = 7;
     280      this.toolTip.SetToolTip(this.stopButton, "Stop Algorithm");
     281      this.stopButton.UseVisualStyleBackColor = true;
     282      this.stopButton.Click += new System.EventHandler(this.stopButton_Click);
     283      //
    271284      // AlgorithmView
    272285      //
     
    275288      this.Controls.Add(this.tabControl);
    276289      this.Controls.Add(this.startButton);
    277       this.Controls.Add(this.stopButton);
     290      this.Controls.Add(this.pauseButton);
    278291      this.Controls.Add(this.executionTimeTextBox);
    279292      this.Controls.Add(this.executionTimeLabel);
     293      this.Controls.Add(this.stopButton);
    280294      this.Controls.Add(this.resetButton);
    281295      this.Name = "AlgorithmView";
    282296      this.Size = new System.Drawing.Size(679, 482);
    283297      this.Controls.SetChildIndex(this.resetButton, 0);
     298      this.Controls.SetChildIndex(this.stopButton, 0);
    284299      this.Controls.SetChildIndex(this.executionTimeLabel, 0);
    285300      this.Controls.SetChildIndex(this.executionTimeTextBox, 0);
    286       this.Controls.SetChildIndex(this.stopButton, 0);
     301      this.Controls.SetChildIndex(this.pauseButton, 0);
    287302      this.Controls.SetChildIndex(this.startButton, 0);
    288303      this.Controls.SetChildIndex(this.tabControl, 0);
     
    312327    protected System.Windows.Forms.Button openProblemButton;
    313328    protected System.Windows.Forms.Button startButton;
    314     protected System.Windows.Forms.Button stopButton;
     329    protected System.Windows.Forms.Button pauseButton;
    315330    protected System.Windows.Forms.Button resetButton;
    316331    protected System.Windows.Forms.Label executionTimeLabel;
     
    320335    protected System.Windows.Forms.TabPage resultsTabPage;
    321336    protected HeuristicLab.Optimization.Views.ResultCollectionView resultsView;
     337    protected System.Windows.Forms.Button stopButton;
    322338
    323339  }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs

    r3261 r3262  
    2424using System.Windows.Forms;
    2525using HeuristicLab.Common;
     26using HeuristicLab.Core;
    2627using HeuristicLab.Core.Views;
    2728using HeuristicLab.MainForm;
     
    3738  public partial class AlgorithmView : NamedItemView {
    3839    private TypeSelectorDialog problemTypeSelectorDialog;
    39     private int executionTimeCounter;
    4040
    4141    public new IAlgorithm Content {
     
    7575    protected override void DeregisterContentEvents() {
    7676      Content.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred);
     77      Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged);
    7778      Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged);
    7879      Content.Prepared -= new EventHandler(Content_Prepared);
    7980      Content.ProblemChanged -= new EventHandler(Content_ProblemChanged);
    80       Content.RunningChanged -= new EventHandler(Content_RunningChanged);
    8181      base.DeregisterContentEvents();
    8282    }
     
    8484      base.RegisterContentEvents();
    8585      Content.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred);
     86      Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged);
    8687      Content.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged);
    8788      Content.Prepared += new EventHandler(Content_Prepared);
    8889      Content.ProblemChanged += new EventHandler(Content_ProblemChanged);
    89       Content.RunningChanged += new EventHandler(Content_RunningChanged);
    9090    }
    9191
    9292    protected override void OnContentChanged() {
    9393      base.OnContentChanged();
    94       stopButton.Enabled = false;
    9594      if (Content == null) {
    9695        parameterCollectionView.Content = null;
     
    9897        resultsView.Content = null;
    9998        tabControl.Enabled = false;
    100         startButton.Enabled = resetButton.Enabled = false;
     99        startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
    101100        executionTimeTextBox.Text = "-";
    102101        executionTimeTextBox.Enabled = false;
     
    108107        resultsView.Content = Content.Results.AsReadOnly();
    109108        tabControl.Enabled = true;
    110         startButton.Enabled = !Content.Finished;
    111         resetButton.Enabled = true;
    112         UpdateExecutionTimeTextBox();
     109        EnableDisableButtons();
     110        executionTimeTextBox.Text = Content.ExecutionTime.ToString();
    113111        executionTimeTextBox.Enabled = true;
    114112      }
     
    116114
    117115    protected override void OnClosed(FormClosedEventArgs e) {
    118       if (Content != null) Content.Stop();
     116      if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) Content.Stop();
    119117      base.OnClosed(e);
    120118    }
    121119
    122120    #region Content Events
    123     protected virtual void Content_Prepared(object sender, EventArgs e) {
    124       if (InvokeRequired)
    125         Invoke(new EventHandler(Content_Prepared), sender, e);
    126       else {
    127         executionTimeCounter = 0;
    128         resultsView.Content = Content.Results.AsReadOnly();
    129         startButton.Enabled = !Content.Finished;
    130         UpdateExecutionTimeTextBox();
    131       }
    132     }
    133121    protected virtual void Content_ProblemChanged(object sender, EventArgs e) {
    134122      if (InvokeRequired)
     
    140128      }
    141129    }
    142     protected virtual void Content_RunningChanged(object sender, EventArgs e) {
    143       if (InvokeRequired)
    144         Invoke(new EventHandler(Content_RunningChanged), sender, e);
     130    protected virtual void Content_Prepared(object sender, EventArgs e) {
     131      if (InvokeRequired)
     132        Invoke(new EventHandler(Content_Prepared), sender, e);
     133      else
     134        resultsView.Content = Content.Results.AsReadOnly();
     135    }
     136    protected virtual void Content_ExecutionStateChanged(object sender, EventArgs e) {
     137      if (InvokeRequired)
     138        Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
    145139      else {
    146         SaveEnabled = !Content.Running;
    147         parameterCollectionView.Enabled = !Content.Running;
    148         newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = !Content.Running;
    149         problemViewHost.Enabled = !Content.Running;
    150         resultsView.Enabled = !Content.Running;
    151         startButton.Enabled = !Content.Running && !Content.Finished;
    152         stopButton.Enabled = Content.Running;
    153         resetButton.Enabled = !Content.Running;
    154         UpdateExecutionTimeTextBox();
     140        SaveEnabled = Content.ExecutionState != ExecutionState.Started;
     141        parameterCollectionView.Enabled = Content.ExecutionState != ExecutionState.Started;
     142        newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = Content.ExecutionState != ExecutionState.Started;
     143        problemViewHost.Enabled = Content.ExecutionState != ExecutionState.Started;
     144        resultsView.Enabled = Content.ExecutionState != ExecutionState.Started;
     145        EnableDisableButtons();
    155146      }
    156147    }
    157148    protected virtual void Content_ExecutionTimeChanged(object sender, EventArgs e) {
    158       executionTimeCounter++;
    159       if ((executionTimeCounter >= 100) || !Content.Running) {
    160         executionTimeCounter = 0;
    161         UpdateExecutionTimeTextBox();
    162       }
     149      if (InvokeRequired)
     150        Invoke(new EventHandler(Content_ExecutionTimeChanged), sender, e);
     151      else
     152        executionTimeTextBox.Text = Content.ExecutionTime.ToString();
    163153    }
    164154    protected virtual void Content_ExceptionOccurred(object sender, EventArgs<Exception> e) {
     
    238228      Content.Start();
    239229    }
     230    protected virtual void pauseButton_Click(object sender, EventArgs e) {
     231      Content.Pause();
     232    }
    240233    protected virtual void stopButton_Click(object sender, EventArgs e) {
    241234      Content.Stop();
     
    247240
    248241    #region Helpers
    249     protected virtual void UpdateExecutionTimeTextBox() {
    250       if (InvokeRequired)
    251         Invoke(new Action(UpdateExecutionTimeTextBox));
    252       else
    253         executionTimeTextBox.Text = Content.ExecutionTime.ToString();
     242    private void EnableDisableButtons() {
     243      startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused);
     244      pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started;
     245      stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused);
     246      resetButton.Enabled = Content.ExecutionState != ExecutionState.Started;
    254247    }
    255248    #endregion
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.Designer.cs

    r3225 r3262  
    9898      //
    9999      this.startButton.Location = new System.Drawing.Point(0, 525);
     100      this.toolTip.SetToolTip(this.startButton, "Start/Resume Algorithm");
     101      //
     102      // pauseButton
     103      //
     104      this.pauseButton.Location = new System.Drawing.Point(30, 525);
     105      this.toolTip.SetToolTip(this.pauseButton, "Pause Algorithm");
     106      //
     107      // resetButton
     108      //
     109      this.resetButton.Location = new System.Drawing.Point(90, 525);
     110      this.toolTip.SetToolTip(this.resetButton, "Reset Algorithm");
     111      //
     112      // executionTimeLabel
     113      //
     114      this.executionTimeLabel.Location = new System.Drawing.Point(487, 532);
     115      this.executionTimeLabel.TabIndex = 10;
     116      //
     117      // executionTimeTextBox
     118      //
     119      this.executionTimeTextBox.Location = new System.Drawing.Point(576, 529);
     120      this.executionTimeTextBox.TabIndex = 11;
     121      //
     122      // resultsTabPage
     123      //
     124      this.resultsTabPage.Size = new System.Drawing.Size(705, 441);
     125      //
     126      // resultsView
     127      //
     128      this.resultsView.Size = new System.Drawing.Size(693, 429);
    100129      //
    101130      // stopButton
    102131      //
    103       this.stopButton.Location = new System.Drawing.Point(30, 525);
    104       //
    105       // resetButton
    106       //
    107       this.resetButton.Location = new System.Drawing.Point(60, 525);
    108       //
    109       // executionTimeLabel
    110       //
    111       this.executionTimeLabel.Location = new System.Drawing.Point(487, 532);
    112       this.executionTimeLabel.TabIndex = 9;
    113       //
    114       // executionTimeTextBox
    115       //
    116       this.executionTimeTextBox.Location = new System.Drawing.Point(576, 529);
    117       this.executionTimeTextBox.TabIndex = 10;
    118       //
    119       // resultsTabPage
    120       //
    121       this.resultsTabPage.Size = new System.Drawing.Size(705, 441);
    122       //
    123       // resultsView
    124       //
    125       this.resultsView.Size = new System.Drawing.Size(693, 429);
     132      this.stopButton.Location = new System.Drawing.Point(60, 525);
     133      this.toolTip.SetToolTip(this.stopButton, "Stop Algorithm");
    126134      //
    127135      // nameTextBox
     
    147155      //
    148156      this.createUserDefinedAlgorithmButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    149       this.createUserDefinedAlgorithmButton.Location = new System.Drawing.Point(90, 525);
     157      this.createUserDefinedAlgorithmButton.Location = new System.Drawing.Point(150, 525);
    150158      this.createUserDefinedAlgorithmButton.Name = "createUserDefinedAlgorithmButton";
    151159      this.createUserDefinedAlgorithmButton.Size = new System.Drawing.Size(254, 24);
    152       this.createUserDefinedAlgorithmButton.TabIndex = 8;
     160      this.createUserDefinedAlgorithmButton.TabIndex = 9;
    153161      this.createUserDefinedAlgorithmButton.Text = "&Create User Defined Algorithm";
    154162      this.toolTip.SetToolTip(this.createUserDefinedAlgorithmButton, "Create User Defined Algorithm from this Algorithm");
     
    164172      this.engineComboBox.Location = new System.Drawing.Point(55, 6);
    165173      this.engineComboBox.Name = "engineComboBox";
    166       this.engineComboBox.Size = new System.Drawing.Size(644, 21);
     174      this.engineComboBox.Size = new System.Drawing.Size(610, 21);
    167175      this.engineComboBox.TabIndex = 1;
    168176      this.engineComboBox.SelectedIndexChanged += new System.EventHandler(this.engineComboBox_SelectedIndexChanged);
     
    189197      this.engineViewHost.Location = new System.Drawing.Point(6, 33);
    190198      this.engineViewHost.Name = "engineViewHost";
    191       this.engineViewHost.Size = new System.Drawing.Size(693, 402);
     199      this.engineViewHost.Size = new System.Drawing.Size(659, 335);
    192200      this.engineViewHost.TabIndex = 2;
    193201      this.engineViewHost.ViewType = null;
     
    200208      this.Name = "EngineAlgorithmView";
    201209      this.Size = new System.Drawing.Size(713, 549);
     210      this.Controls.SetChildIndex(this.stopButton, 0);
    202211      this.Controls.SetChildIndex(this.createUserDefinedAlgorithmButton, 0);
    203212      this.Controls.SetChildIndex(this.resetButton, 0);
     213      this.Controls.SetChildIndex(this.pauseButton, 0);
    204214      this.Controls.SetChildIndex(this.executionTimeLabel, 0);
    205215      this.Controls.SetChildIndex(this.executionTimeTextBox, 0);
    206       this.Controls.SetChildIndex(this.stopButton, 0);
    207216      this.Controls.SetChildIndex(this.startButton, 0);
    208217      this.Controls.SetChildIndex(this.tabControl, 0);
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.cs

    r3261 r3262  
    9898    }
    9999
    100     protected override void Content_RunningChanged(object sender, EventArgs e) {
     100    protected override void Content_ExecutionStateChanged(object sender, EventArgs e) {
    101101      if (InvokeRequired)
    102         Invoke(new EventHandler(Content_RunningChanged), sender, e);
     102        Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
    103103      else {
    104         createUserDefinedAlgorithmButton.Enabled = !Content.Running;
    105         engineComboBox.Enabled = !Content.Running;
    106         engineViewHost.Enabled = !Content.Running;
    107         base.Content_RunningChanged(sender, e);
     104        createUserDefinedAlgorithmButton.Enabled = Content.ExecutionState != ExecutionState.Started;
     105        engineComboBox.Enabled = Content.ExecutionState != ExecutionState.Started;
     106        engineViewHost.Enabled = Content.ExecutionState != ExecutionState.Started;
     107        base.Content_ExecutionStateChanged(sender, e);
    108108      }
    109109    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/HeuristicLab.Optimization.Views-3.3.csproj

    r3260 r3262  
    9292      <DependentUpon>AlgorithmView.cs</DependentUpon>
    9393    </Compile>
    94     <Compile Include="BatchRunView.cs">
    95       <SubType>UserControl</SubType>
    96     </Compile>
    97     <Compile Include="BatchRunView.Designer.cs">
    98       <DependentUpon>BatchRunView.cs</DependentUpon>
    99     </Compile>
    10094    <Compile Include="RunCollectionView.cs">
    10195      <SubType>UserControl</SubType>
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.Designer.cs

    r3225 r3262  
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UserDefinedAlgorithmView));
    4847      this.operatorGraphTabPage = new System.Windows.Forms.TabPage();
    4948      this.saveOperatorGraphButton = new System.Windows.Forms.Button();
     
    6665      //
    6766      this.createUserDefinedAlgorithmButton.Enabled = false;
     67      this.createUserDefinedAlgorithmButton.Location = new System.Drawing.Point(150, 525);
     68      this.createUserDefinedAlgorithmButton.TabIndex = 9;
    6869      this.toolTip.SetToolTip(this.createUserDefinedAlgorithmButton, "Create User Defined Algorithm from this Algorithm");
    6970      this.createUserDefinedAlgorithmButton.Visible = false;
     
    9192      //
    9293      this.toolTip.SetToolTip(this.openProblemButton, "Open Problem");
     94      //
     95      // startButton
     96      //
     97      this.toolTip.SetToolTip(this.startButton, "Start/Resume Algorithm");
     98      //
     99      // pauseButton
     100      //
     101      this.toolTip.SetToolTip(this.pauseButton, "Pause Algorithm");
     102      //
     103      // resetButton
     104      //
     105      this.resetButton.Location = new System.Drawing.Point(90, 525);
     106      this.toolTip.SetToolTip(this.resetButton, "Reset Algorithm");
     107      //
     108      // executionTimeLabel
     109      //
     110      this.executionTimeLabel.TabIndex = 10;
     111      //
     112      // executionTimeTextBox
     113      //
     114      this.executionTimeTextBox.TabIndex = 11;
     115      //
     116      // stopButton
     117      //
     118      this.stopButton.Location = new System.Drawing.Point(60, 525);
     119      this.toolTip.SetToolTip(this.stopButton, "Stop Algorithm");
    93120      //
    94121      // nameTextBox
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.cs

    r3261 r3262  
    7575    }
    7676
    77     protected override void Content_RunningChanged(object sender, EventArgs e) {
     77    protected override void Content_ExecutionStateChanged(object sender, EventArgs e) {
    7878      if (InvokeRequired)
    79         Invoke(new EventHandler(Content_RunningChanged), sender, e);
     79        Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
    8080      else {
    81         newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = !Content.Running;
    82         operatorGraphViewHost.Enabled = !Content.Running;
    83         globalScopeView.Enabled = !Content.Running;
    84         base.Content_RunningChanged(sender, e);
     81        newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = Content.ExecutionState != ExecutionState.Started;
     82        operatorGraphViewHost.Enabled = Content.ExecutionState != ExecutionState.Started;
     83        globalScopeView.Enabled = Content.ExecutionState != ExecutionState.Started;
     84        base.Content_ExecutionStateChanged(sender, e);
    8585      }
    8686    }
Note: See TracChangeset for help on using the changeset viewer.