Changeset 6425


Ignore:
Timestamp:
06/16/11 10:56:26 (8 years ago)
Author:
mkommend
Message:

#1555: Refactored optimizer views to derive from common base class IOptimizerView.

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

Legend:

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

    r5832 r6425  
    3434    /// </summary>
    3535    private void InitializeComponent() {
     36      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AlgorithmView));
    3637      this.tabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl();
    3738      this.problemTabPage = new System.Windows.Forms.TabPage();
     
    4647      this.storeAlgorithmInEachRunCheckBox = new System.Windows.Forms.CheckBox();
    4748      this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView();
    48       this.startButton = new System.Windows.Forms.Button();
    49       this.pauseButton = new System.Windows.Forms.Button();
    50       this.resetButton = new System.Windows.Forms.Button();
    51       this.executionTimeLabel = new System.Windows.Forms.Label();
    52       this.executionTimeTextBox = new System.Windows.Forms.TextBox();
    5349      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    54       this.stopButton = new System.Windows.Forms.Button();
    5550      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5651      this.tabControl.SuspendLayout();
     
    6156      this.SuspendLayout();
    6257      //
     58      // startButton
     59      //
     60      this.startButton.Location = new System.Drawing.Point(0, 458);
     61      this.toolTip.SetToolTip(this.startButton, "Start/Resume Experiment");
     62      //
     63      // executionTimeTextBox
     64      //
     65      this.executionTimeTextBox.Location = new System.Drawing.Point(542, 462);
     66      //
     67      // executionTimeLabel
     68      //
     69      this.executionTimeLabel.Location = new System.Drawing.Point(453, 465);
     70      //
     71      // pauseButton
     72      //
     73      this.pauseButton.Location = new System.Drawing.Point(30, 458);
     74      this.toolTip.SetToolTip(this.pauseButton, "Pause Experiment");
     75      //
     76      // stopButton
     77      //
     78      this.stopButton.Location = new System.Drawing.Point(60, 458);
     79      this.toolTip.SetToolTip(this.stopButton, "Stop Experiment");
     80      //
     81      // resetButton
     82      //
     83      this.resetButton.Location = new System.Drawing.Point(90, 458);
     84      this.toolTip.SetToolTip(this.resetButton, "Reset Experiment");
     85      //
    6386      // nameTextBox
    6487      //
     
    7699      this.tabControl.AllowDrop = true;
    77100      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    78                   | System.Windows.Forms.AnchorStyles.Left)
    79                   | System.Windows.Forms.AnchorStyles.Right)));
     101            | System.Windows.Forms.AnchorStyles.Left)
     102            | System.Windows.Forms.AnchorStyles.Right)));
    80103      this.tabControl.Controls.Add(this.problemTabPage);
    81104      this.tabControl.Controls.Add(this.parametersTabPage);
     
    85108      this.tabControl.Name = "tabControl";
    86109      this.tabControl.SelectedIndex = 0;
    87       this.tabControl.Size = new System.Drawing.Size(679, 426);
     110      this.tabControl.Size = new System.Drawing.Size(679, 430);
    88111      this.tabControl.TabIndex = 3;
    89112      //
     
    97120      this.problemTabPage.Name = "problemTabPage";
    98121      this.problemTabPage.Padding = new System.Windows.Forms.Padding(3);
    99       this.problemTabPage.Size = new System.Drawing.Size(671, 400);
     122      this.problemTabPage.Size = new System.Drawing.Size(671, 404);
    100123      this.problemTabPage.TabIndex = 0;
    101124      this.problemTabPage.Text = "Problem";
     
    108131      //
    109132      this.problemViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    110                   | System.Windows.Forms.AnchorStyles.Left)
    111                   | System.Windows.Forms.AnchorStyles.Right)));
     133            | System.Windows.Forms.AnchorStyles.Left)
     134            | System.Windows.Forms.AnchorStyles.Right)));
    112135      this.problemViewHost.Caption = "View";
    113136      this.problemViewHost.Content = null;
     
    116139      this.problemViewHost.Name = "problemViewHost";
    117140      this.problemViewHost.ReadOnly = false;
    118       this.problemViewHost.Size = new System.Drawing.Size(659, 358);
     141      this.problemViewHost.Size = new System.Drawing.Size(659, 362);
    119142      this.problemViewHost.TabIndex = 3;
    120143      this.problemViewHost.ViewsLabelVisible = true;
     
    156179      // parameterCollectionView
    157180      //
     181      this.parameterCollectionView.AllowEditingOfHiddenParameters = true;
    158182      this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    159                   | System.Windows.Forms.AnchorStyles.Left)
    160                   | System.Windows.Forms.AnchorStyles.Right)));
     183            | System.Windows.Forms.AnchorStyles.Left)
     184            | System.Windows.Forms.AnchorStyles.Right)));
    161185      this.parameterCollectionView.Caption = "ParameterCollection View";
    162186      this.parameterCollectionView.Content = null;
     
    181205      //
    182206      this.resultsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    183                   | System.Windows.Forms.AnchorStyles.Left)
    184                   | System.Windows.Forms.AnchorStyles.Right)));
     207            | System.Windows.Forms.AnchorStyles.Left)
     208            | System.Windows.Forms.AnchorStyles.Right)));
    185209      this.resultsView.Caption = "ResultCollection View";
    186210      this.resultsView.Content = null;
     
    222246      //
    223247      this.runsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    224                   | System.Windows.Forms.AnchorStyles.Left)
    225                   | System.Windows.Forms.AnchorStyles.Right)));
     248            | System.Windows.Forms.AnchorStyles.Left)
     249            | System.Windows.Forms.AnchorStyles.Right)));
    226250      this.runsView.Caption = "RunCollection View";
    227251      this.runsView.Content = null;
     
    232256      this.runsView.TabIndex = 0;
    233257      //
    234       // startButton
    235       //
    236       this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    237       this.startButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Play;
    238       this.startButton.Location = new System.Drawing.Point(0, 458);
    239       this.startButton.Name = "startButton";
    240       this.startButton.Size = new System.Drawing.Size(24, 24);
    241       this.startButton.TabIndex = 4;
    242       this.toolTip.SetToolTip(this.startButton, "Start/Resume Algorithm");
    243       this.startButton.UseVisualStyleBackColor = true;
    244       this.startButton.Click += new System.EventHandler(this.startButton_Click);
    245       //
    246       // pauseButton
    247       //
    248       this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    249       this.pauseButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Pause;
    250       this.pauseButton.Location = new System.Drawing.Point(30, 458);
    251       this.pauseButton.Name = "pauseButton";
    252       this.pauseButton.Size = new System.Drawing.Size(24, 24);
    253       this.pauseButton.TabIndex = 5;
    254       this.toolTip.SetToolTip(this.pauseButton, "Pause Algorithm");
    255       this.pauseButton.UseVisualStyleBackColor = true;
    256       this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click);
    257       //
    258       // resetButton
    259       //
    260       this.resetButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    261       this.resetButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Restart;
    262       this.resetButton.Location = new System.Drawing.Point(90, 458);
    263       this.resetButton.Name = "resetButton";
    264       this.resetButton.Size = new System.Drawing.Size(24, 24);
    265       this.resetButton.TabIndex = 7;
    266       this.toolTip.SetToolTip(this.resetButton, "Reset Algorithm");
    267       this.resetButton.UseVisualStyleBackColor = true;
    268       this.resetButton.Click += new System.EventHandler(this.resetButton_Click);
    269       //
    270       // executionTimeLabel
    271       //
    272       this.executionTimeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    273       this.executionTimeLabel.AutoSize = true;
    274       this.executionTimeLabel.Location = new System.Drawing.Point(453, 465);
    275       this.executionTimeLabel.Name = "executionTimeLabel";
    276       this.executionTimeLabel.Size = new System.Drawing.Size(83, 13);
    277       this.executionTimeLabel.TabIndex = 8;
    278       this.executionTimeLabel.Text = "&Execution Time:";
    279       //
    280       // executionTimeTextBox
    281       //
    282       this.executionTimeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    283       this.executionTimeTextBox.Location = new System.Drawing.Point(542, 462);
    284       this.executionTimeTextBox.Name = "executionTimeTextBox";
    285       this.executionTimeTextBox.ReadOnly = true;
    286       this.executionTimeTextBox.Size = new System.Drawing.Size(137, 20);
    287       this.executionTimeTextBox.TabIndex = 9;
    288       //
    289258      // openFileDialog
    290259      //
     
    294263      this.openFileDialog.Title = "Open Problem";
    295264      //
    296       // stopButton
    297       //
    298       this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    299       this.stopButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Stop;
    300       this.stopButton.Location = new System.Drawing.Point(60, 458);
    301       this.stopButton.Name = "stopButton";
    302       this.stopButton.Size = new System.Drawing.Size(24, 24);
    303       this.stopButton.TabIndex = 6;
    304       this.toolTip.SetToolTip(this.stopButton, "Stop Algorithm");
    305       this.stopButton.UseVisualStyleBackColor = true;
    306       this.stopButton.Click += new System.EventHandler(this.stopButton_Click);
    307       //
    308265      // AlgorithmView
    309266      //
     
    311268      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    312269      this.Controls.Add(this.tabControl);
    313       this.Controls.Add(this.startButton);
    314       this.Controls.Add(this.pauseButton);
    315       this.Controls.Add(this.executionTimeTextBox);
    316       this.Controls.Add(this.executionTimeLabel);
    317       this.Controls.Add(this.stopButton);
    318       this.Controls.Add(this.resetButton);
    319270      this.Name = "AlgorithmView";
    320271      this.Size = new System.Drawing.Size(679, 482);
    321       this.Controls.SetChildIndex(this.infoLabel, 0);
    322       this.Controls.SetChildIndex(this.resetButton, 0);
    323       this.Controls.SetChildIndex(this.stopButton, 0);
    324272      this.Controls.SetChildIndex(this.executionTimeLabel, 0);
    325273      this.Controls.SetChildIndex(this.executionTimeTextBox, 0);
     274      this.Controls.SetChildIndex(this.resetButton, 0);
     275      this.Controls.SetChildIndex(this.tabControl, 0);
     276      this.Controls.SetChildIndex(this.stopButton, 0);
    326277      this.Controls.SetChildIndex(this.pauseButton, 0);
    327278      this.Controls.SetChildIndex(this.startButton, 0);
    328       this.Controls.SetChildIndex(this.tabControl, 0);
     279      this.Controls.SetChildIndex(this.infoLabel, 0);
    329280      this.Controls.SetChildIndex(this.nameLabel, 0);
    330281      this.Controls.SetChildIndex(this.nameTextBox, 0);
     
    350301    protected System.Windows.Forms.Button newProblemButton;
    351302    protected System.Windows.Forms.Button openProblemButton;
    352     protected System.Windows.Forms.Button startButton;
    353     protected System.Windows.Forms.Button pauseButton;
    354     protected System.Windows.Forms.Button resetButton;
    355     protected System.Windows.Forms.Label executionTimeLabel;
    356     protected System.Windows.Forms.TextBox executionTimeTextBox;
    357303    protected System.Windows.Forms.OpenFileDialog openFileDialog;
    358304    protected System.Windows.Forms.TabPage resultsTabPage;
    359305    protected HeuristicLab.Optimization.Views.ResultCollectionView resultsView;
    360     protected System.Windows.Forms.Button stopButton;
    361306    protected System.Windows.Forms.TabPage runsTabPage;
    362307    protected RunCollectionView runsView;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs

    r5837 r6425  
    3131
    3232namespace HeuristicLab.Optimization.Views {
    33   /// <summary>
    34   /// The base class for visual representations of algorithms.
    35   /// </summary>
    3633  [View("Algorithm View")]
    3734  [Content(typeof(Algorithm), true)]
    3835  [Content(typeof(IAlgorithm), false)]
    39   public partial class AlgorithmView : NamedItemView {
     36  public partial class AlgorithmView : IOptimizerView {
    4037    private TypeSelectorDialog problemTypeSelectorDialog;
     38    public AlgorithmView() {
     39      InitializeComponent();
     40    }
    4141
    4242    public new IAlgorithm Content {
    4343      get { return (IAlgorithm)base.Content; }
    4444      set { base.Content = value; }
    45     }
    46 
    47     /// <summary>
    48     /// Initializes a new instance of <see cref="ItemBaseView"/>.
    49     /// </summary>
    50     public AlgorithmView() {
    51       InitializeComponent();
    5245    }
    5346
     
    7568
    7669    protected override void DeregisterContentEvents() {
    77       Content.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred);
    78       Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged);
    79       Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged);
    80       Content.Prepared -= new EventHandler(Content_Prepared);
    81       Content.Started -= new EventHandler(Content_Started);
    82       Content.Paused -= new EventHandler(Content_Paused);
    83       Content.Stopped -= new EventHandler(Content_Stopped);
    8470      Content.ProblemChanged -= new EventHandler(Content_ProblemChanged);
    8571      Content.StoreAlgorithmInEachRunChanged -= new EventHandler(Content_StoreAlgorithmInEachRunChanged);
     
    8874    protected override void RegisterContentEvents() {
    8975      base.RegisterContentEvents();
    90       Content.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred);
    91       Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged);
    92       Content.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged);
    93       Content.Prepared += new EventHandler(Content_Prepared);
    94       Content.Started += new EventHandler(Content_Started);
    95       Content.Paused += new EventHandler(Content_Paused);
    96       Content.Stopped += new EventHandler(Content_Stopped);
    9776      Content.ProblemChanged += new EventHandler(Content_ProblemChanged);
    9877      Content.StoreAlgorithmInEachRunChanged += new EventHandler(Content_StoreAlgorithmInEachRunChanged);
     
    10786        runsView.Content = null;
    10887        storeAlgorithmInEachRunCheckBox.Checked = true;
    109         executionTimeTextBox.Text = "-";
    11088      } else {
    111         Locked = ReadOnly = Content.ExecutionState == ExecutionState.Started;
    11289        parameterCollectionView.Content = Content.Parameters;
    11390        problemViewHost.ViewType = null;
     
    11693        runsView.Content = Content.Runs;
    11794        storeAlgorithmInEachRunCheckBox.Checked = Content.StoreAlgorithmInEachRun;
    118         executionTimeTextBox.Text = Content.ExecutionTime.ToString();
    11995      }
    12096    }
     
    129105      runsView.Enabled = Content != null;
    130106      storeAlgorithmInEachRunCheckBox.Enabled = Content != null && !ReadOnly;
    131       executionTimeTextBox.Enabled = Content != null;
    132       SetEnabledStateOfExecutableButtons();
    133107    }
    134108
     
    146120
    147121    #region Content Events
     122    protected override void Content_Prepared(object sender, EventArgs e) {
     123      if (InvokeRequired)
     124        Invoke(new EventHandler(Content_Prepared), sender, e);
     125      else {
     126        base.Content_Prepared(sender, e);
     127        resultsView.Content = Content.Results.AsReadOnly();
     128      }
     129    }
     130
    148131    protected virtual void Content_ProblemChanged(object sender, EventArgs e) {
    149132      if (InvokeRequired)
     
    154137      }
    155138    }
    156     protected virtual void Content_ExecutionStateChanged(object sender, EventArgs e) {
    157       if (InvokeRequired)
    158         Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
    159       else
    160         startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
    161     }
    162     protected virtual void Content_ExecutionTimeChanged(object sender, EventArgs e) {
    163       if (InvokeRequired)
    164         Invoke(new EventHandler(Content_ExecutionTimeChanged), sender, e);
    165       else
    166         executionTimeTextBox.Text = Content == null ? "-" : Content.ExecutionTime.ToString();
    167     }
    168139    protected virtual void Content_StoreAlgorithmInEachRunChanged(object sender, EventArgs e) {
    169140      if (InvokeRequired)
     
    171142      else
    172143        storeAlgorithmInEachRunCheckBox.Checked = Content.StoreAlgorithmInEachRun;
    173     }
    174     protected virtual void Content_Prepared(object sender, EventArgs e) {
    175       if (InvokeRequired)
    176         Invoke(new EventHandler(Content_Prepared), sender, e);
    177       else {
    178         resultsView.Content = Content.Results.AsReadOnly();
    179         ReadOnly = Locked = false;
    180         SetEnabledStateOfExecutableButtons();
    181       }
    182     }
    183     protected virtual void Content_Started(object sender, EventArgs e) {
    184       if (InvokeRequired)
    185         Invoke(new EventHandler(Content_Started), sender, e);
    186       else {
    187         ReadOnly = Locked = true;
    188         SetEnabledStateOfExecutableButtons();
    189       }
    190     }
    191     protected virtual void Content_Paused(object sender, EventArgs e) {
    192       if (InvokeRequired)
    193         Invoke(new EventHandler(Content_Paused), sender, e);
    194       else {
    195         ReadOnly = Locked = false;
    196         SetEnabledStateOfExecutableButtons();
    197       }
    198     }
    199     protected virtual void Content_Stopped(object sender, EventArgs e) {
    200       if (InvokeRequired)
    201         Invoke(new EventHandler(Content_Stopped), sender, e);
    202       else {
    203         ReadOnly = Locked = false;
    204         SetEnabledStateOfExecutableButtons();
    205       }
    206     }
    207     protected virtual void Content_ExceptionOccurred(object sender, EventArgs<Exception> e) {
    208       if (InvokeRequired)
    209         Invoke(new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred), sender, e);
    210       else
    211         ErrorHandling.ShowErrorDialog(this, e.Value);
    212144    }
    213145    #endregion
     
    264196      if (Content != null) Content.StoreAlgorithmInEachRun = storeAlgorithmInEachRunCheckBox.Checked;
    265197    }
    266     protected virtual void startButton_Click(object sender, EventArgs e) {
    267       Content.Start();
    268     }
    269     protected virtual void pauseButton_Click(object sender, EventArgs e) {
    270       Content.Pause();
    271     }
    272     protected virtual void stopButton_Click(object sender, EventArgs e) {
    273       Content.Stop();
    274     }
    275     protected virtual void resetButton_Click(object sender, EventArgs e) {
    276       Content.Prepare(false);
    277     }
    278198    protected virtual void problemTabPage_DragEnterOver(object sender, DragEventArgs e) {
    279199      e.Effect = DragDropEffects.None;
     
    294214    }
    295215    #endregion
    296 
    297     #region Helpers
    298     private void SetEnabledStateOfExecutableButtons() {
    299       if (Content == null) {
    300         startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
    301       } else {
    302         startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused);
    303         pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started;
    304         stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused);
    305         resetButton.Enabled = Content.ExecutionState != ExecutionState.Started;
    306       }
    307     }
    308     #endregion
    309216  }
    310217}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.Designer.cs

    r5832 r6425  
    3434    /// </summary>
    3535    private void InitializeComponent() {
     36      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BatchRunView));
    3637      this.tabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl();
    3738      this.optimizerTabPage = new System.Windows.Forms.TabPage();
     
    4142      this.runsTabPage = new System.Windows.Forms.TabPage();
    4243      this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView();
    43       this.startButton = new System.Windows.Forms.Button();
    44       this.stopButton = new System.Windows.Forms.Button();
    45       this.resetButton = new System.Windows.Forms.Button();
    46       this.executionTimeLabel = new System.Windows.Forms.Label();
    47       this.executionTimeTextBox = new System.Windows.Forms.TextBox();
    4844      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    4945      this.repetitionsLabel = new System.Windows.Forms.Label();
    5046      this.repetitionsNumericUpDown = new System.Windows.Forms.NumericUpDown();
    51       this.pauseButton = new System.Windows.Forms.Button();
    5247      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5348      this.tabControl.SuspendLayout();
     
    5752      this.SuspendLayout();
    5853      //
     54      // startButton
     55      //
     56      this.startButton.Location = new System.Drawing.Point(0, 459);
     57      this.toolTip.SetToolTip(this.startButton, "Start/Resume Experiment");
     58      //
     59      // executionTimeTextBox
     60      //
     61      this.executionTimeTextBox.Location = new System.Drawing.Point(542, 462);
     62      //
     63      // executionTimeLabel
     64      //
     65      this.executionTimeLabel.Location = new System.Drawing.Point(453, 465);
     66      //
     67      // pauseButton
     68      //
     69      this.pauseButton.Location = new System.Drawing.Point(30, 459);
     70      this.toolTip.SetToolTip(this.pauseButton, "Pause Experiment");
     71      //
     72      // stopButton
     73      //
     74      this.stopButton.Location = new System.Drawing.Point(60, 459);
     75      this.toolTip.SetToolTip(this.stopButton, "Stop Experiment");
     76      //
     77      // resetButton
     78      //
     79      this.resetButton.Location = new System.Drawing.Point(90, 458);
     80      this.toolTip.SetToolTip(this.resetButton, "Reset Experiment");
     81      //
    5982      // nameTextBox
    6083      //
     
    7295      this.tabControl.AllowDrop = true;
    7396      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    74                   | System.Windows.Forms.AnchorStyles.Left)
    75                   | System.Windows.Forms.AnchorStyles.Right)));
     97            | System.Windows.Forms.AnchorStyles.Left)
     98            | System.Windows.Forms.AnchorStyles.Right)));
    7699      this.tabControl.Controls.Add(this.optimizerTabPage);
    77100      this.tabControl.Controls.Add(this.runsTabPage);
     
    79102      this.tabControl.Name = "tabControl";
    80103      this.tabControl.SelectedIndex = 0;
    81       this.tabControl.Size = new System.Drawing.Size(679, 400);
     104      this.tabControl.Size = new System.Drawing.Size(679, 401);
    82105      this.tabControl.TabIndex = 5;
    83106      //
     
    91114      this.optimizerTabPage.Name = "optimizerTabPage";
    92115      this.optimizerTabPage.Padding = new System.Windows.Forms.Padding(3);
    93       this.optimizerTabPage.Size = new System.Drawing.Size(671, 374);
     116      this.optimizerTabPage.Size = new System.Drawing.Size(671, 375);
    94117      this.optimizerTabPage.TabIndex = 1;
    95118      this.optimizerTabPage.Text = "Optimizer";
     
    102125      //
    103126      this.optimizerViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    104                   | System.Windows.Forms.AnchorStyles.Left)
    105                   | System.Windows.Forms.AnchorStyles.Right)));
     127            | System.Windows.Forms.AnchorStyles.Left)
     128            | System.Windows.Forms.AnchorStyles.Right)));
    106129      this.optimizerViewHost.Caption = "View";
    107130      this.optimizerViewHost.Content = null;
     
    110133      this.optimizerViewHost.Name = "optimizerViewHost";
    111134      this.optimizerViewHost.ReadOnly = false;
    112       this.optimizerViewHost.Size = new System.Drawing.Size(659, 332);
     135      this.optimizerViewHost.Size = new System.Drawing.Size(659, 333);
    113136      this.optimizerViewHost.TabIndex = 3;
    114137      this.optimizerViewHost.ViewsLabelVisible = true;
     
    151174      //
    152175      this.runsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    153                   | System.Windows.Forms.AnchorStyles.Left)
    154                   | System.Windows.Forms.AnchorStyles.Right)));
     176            | System.Windows.Forms.AnchorStyles.Left)
     177            | System.Windows.Forms.AnchorStyles.Right)));
    155178      this.runsView.Caption = "RunCollection View";
    156179      this.runsView.Content = null;
     
    161184      this.runsView.TabIndex = 0;
    162185      //
    163       // startButton
    164       //
    165       this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    166       this.startButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Play;
    167       this.startButton.Location = new System.Drawing.Point(0, 458);
    168       this.startButton.Name = "startButton";
    169       this.startButton.Size = new System.Drawing.Size(24, 24);
    170       this.startButton.TabIndex = 6;
    171       this.toolTip.SetToolTip(this.startButton, "Start/Resume Batch Run");
    172       this.startButton.UseVisualStyleBackColor = true;
    173       this.startButton.Click += new System.EventHandler(this.startButton_Click);
    174       //
    175       // stopButton
    176       //
    177       this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    178       this.stopButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Stop;
    179       this.stopButton.Location = new System.Drawing.Point(60, 458);
    180       this.stopButton.Name = "stopButton";
    181       this.stopButton.Size = new System.Drawing.Size(24, 24);
    182       this.stopButton.TabIndex = 8;
    183       this.toolTip.SetToolTip(this.stopButton, "Stop Batch Run");
    184       this.stopButton.UseVisualStyleBackColor = true;
    185       this.stopButton.Click += new System.EventHandler(this.stopButton_Click);
    186       //
    187       // resetButton
    188       //
    189       this.resetButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    190       this.resetButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Restart;
    191       this.resetButton.Location = new System.Drawing.Point(90, 458);
    192       this.resetButton.Name = "resetButton";
    193       this.resetButton.Size = new System.Drawing.Size(24, 24);
    194       this.resetButton.TabIndex = 9;
    195       this.toolTip.SetToolTip(this.resetButton, "Reset Batch Run");
    196       this.resetButton.UseVisualStyleBackColor = true;
    197       this.resetButton.Click += new System.EventHandler(this.resetButton_Click);
    198       //
    199       // executionTimeLabel
    200       //
    201       this.executionTimeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    202       this.executionTimeLabel.AutoSize = true;
    203       this.executionTimeLabel.Location = new System.Drawing.Point(453, 465);
    204       this.executionTimeLabel.Name = "executionTimeLabel";
    205       this.executionTimeLabel.Size = new System.Drawing.Size(83, 13);
    206       this.executionTimeLabel.TabIndex = 10;
    207       this.executionTimeLabel.Text = "&Execution Time:";
    208       //
    209       // executionTimeTextBox
    210       //
    211       this.executionTimeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    212       this.executionTimeTextBox.Location = new System.Drawing.Point(542, 462);
    213       this.executionTimeTextBox.Name = "executionTimeTextBox";
    214       this.executionTimeTextBox.ReadOnly = true;
    215       this.executionTimeTextBox.Size = new System.Drawing.Size(137, 20);
    216       this.executionTimeTextBox.TabIndex = 11;
    217       //
    218186      // openFileDialog
    219187      //
     
    235203      //
    236204      this.repetitionsNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    237                   | System.Windows.Forms.AnchorStyles.Right)));
     205            | System.Windows.Forms.AnchorStyles.Right)));
    238206      this.repetitionsNumericUpDown.Location = new System.Drawing.Point(72, 26);
    239207      this.repetitionsNumericUpDown.Maximum = new decimal(new int[] {
     
    259227      this.repetitionsNumericUpDown.Validated += new System.EventHandler(this.repetitionsNumericUpDown_Validated);
    260228      //
    261       // pauseButton
    262       //
    263       this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    264       this.pauseButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Pause;
    265       this.pauseButton.Location = new System.Drawing.Point(30, 458);
    266       this.pauseButton.Name = "pauseButton";
    267       this.pauseButton.Size = new System.Drawing.Size(24, 24);
    268       this.pauseButton.TabIndex = 7;
    269       this.toolTip.SetToolTip(this.pauseButton, "Pause Batch Run");
    270       this.pauseButton.UseVisualStyleBackColor = true;
    271       this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click);
    272       //
    273229      // BatchRunView
    274230      //
    275231      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    276232      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    277       this.Controls.Add(this.tabControl);
    278       this.Controls.Add(this.startButton);
    279       this.Controls.Add(this.executionTimeTextBox);
    280       this.Controls.Add(this.executionTimeLabel);
    281       this.Controls.Add(this.pauseButton);
    282233      this.Controls.Add(this.repetitionsNumericUpDown);
    283234      this.Controls.Add(this.repetitionsLabel);
    284       this.Controls.Add(this.stopButton);
    285       this.Controls.Add(this.resetButton);
     235      this.Controls.Add(this.tabControl);
    286236      this.Name = "BatchRunView";
    287237      this.Size = new System.Drawing.Size(679, 482);
    288       this.Controls.SetChildIndex(this.infoLabel, 0);
     238      this.Controls.SetChildIndex(this.tabControl, 0);
    289239      this.Controls.SetChildIndex(this.resetButton, 0);
    290240      this.Controls.SetChildIndex(this.stopButton, 0);
     241      this.Controls.SetChildIndex(this.executionTimeLabel, 0);
     242      this.Controls.SetChildIndex(this.pauseButton, 0);
     243      this.Controls.SetChildIndex(this.executionTimeTextBox, 0);
     244      this.Controls.SetChildIndex(this.startButton, 0);
     245      this.Controls.SetChildIndex(this.infoLabel, 0);
    291246      this.Controls.SetChildIndex(this.repetitionsLabel, 0);
    292247      this.Controls.SetChildIndex(this.repetitionsNumericUpDown, 0);
    293       this.Controls.SetChildIndex(this.pauseButton, 0);
    294       this.Controls.SetChildIndex(this.executionTimeLabel, 0);
    295       this.Controls.SetChildIndex(this.executionTimeTextBox, 0);
    296       this.Controls.SetChildIndex(this.startButton, 0);
    297       this.Controls.SetChildIndex(this.tabControl, 0);
    298248      this.Controls.SetChildIndex(this.nameLabel, 0);
    299249      this.Controls.SetChildIndex(this.nameTextBox, 0);
     
    314264    private System.Windows.Forms.Button newOptimizerButton;
    315265    private System.Windows.Forms.Button openOptimizerButton;
    316     private System.Windows.Forms.Button startButton;
    317     private System.Windows.Forms.Button stopButton;
    318     private System.Windows.Forms.Button resetButton;
    319     private System.Windows.Forms.Label executionTimeLabel;
    320     private System.Windows.Forms.TextBox executionTimeTextBox;
    321266    private System.Windows.Forms.OpenFileDialog openFileDialog;
    322267    private System.Windows.Forms.TabPage runsTabPage;
     
    324269    private System.Windows.Forms.NumericUpDown repetitionsNumericUpDown;
    325270    private RunCollectionView runsView;
    326     private System.Windows.Forms.Button pauseButton;
    327271  }
    328272}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs

    r5837 r6425  
    3535  [View("BatchRun View")]
    3636  [Content(typeof(BatchRun), true)]
    37   public sealed partial class BatchRunView : NamedItemView {
     37  public sealed partial class BatchRunView : IOptimizerView {
    3838    private TypeSelectorDialog optimizerTypeSelectorDialog;
    3939
     
    6060    protected override void DeregisterContentEvents() {
    6161      Content.OptimizerChanged -= new EventHandler(Content_OptimizerChanged);
    62       Content.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred);
    63       Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged);
    64       Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged);
    65       Content.Prepared -= new EventHandler(Content_Prepared);
    66       Content.Started -= new EventHandler(Content_Started);
    67       Content.Paused -= new EventHandler(Content_Paused);
    68       Content.Stopped -= new EventHandler(Content_Stopped);
    6962      Content.RepetitionsChanged -= new EventHandler(Content_RepetitionsChanged);
    7063      base.DeregisterContentEvents();
     
    7366      base.RegisterContentEvents();
    7467      Content.OptimizerChanged += new EventHandler(Content_OptimizerChanged);
    75       Content.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred);
    76       Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged);
    77       Content.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged);
    78       Content.Prepared += new EventHandler(Content_Prepared);
    79       Content.Started += new EventHandler(Content_Started);
    80       Content.Paused += new EventHandler(Content_Paused);
    81       Content.Stopped += new EventHandler(Content_Stopped);
    8268      Content.RepetitionsChanged += new EventHandler(Content_RepetitionsChanged);
    8369    }
     
    8975        optimizerViewHost.Content = null;
    9076        runsView.Content = null;
    91         executionTimeTextBox.Text = "-";
    9277      } else {
    93         Locked = ReadOnly = Content.ExecutionState == ExecutionState.Started;
    9478        repetitionsNumericUpDown.Value = Content.Repetitions;
    9579        optimizerViewHost.Content = Content.Optimizer;
    9680        runsView.Content = Content.Runs;
    97         executionTimeTextBox.Text = Content.ExecutionTime.ToString();
    9881      }
    9982    }
     
    10588      optimizerViewHost.Enabled = Content != null;
    10689      runsView.Enabled = Content != null;
    107       executionTimeTextBox.Enabled = Content != null;
    108       SetEnabledStateOfExecutableButtons();
    10990    }
    11091
     
    122103
    123104    #region Content Events
    124     private void Content_ExecutionStateChanged(object sender, EventArgs e) {
    125       if (InvokeRequired)
    126         Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
    127       else
    128         startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
    129     }
    130     private void Content_Prepared(object sender, EventArgs e) {
    131       if (InvokeRequired)
    132         Invoke(new EventHandler(Content_Prepared), sender, e);
    133       else {
    134         ReadOnly = Locked = false;
    135         SetEnabledStateOfExecutableButtons();
    136       }
    137     }
    138     private void Content_Started(object sender, EventArgs e) {
    139       if (InvokeRequired)
    140         Invoke(new EventHandler(Content_Started), sender, e);
    141       else {
    142         ReadOnly = Locked = true;
    143         SetEnabledStateOfExecutableButtons();
    144       }
    145     }
    146     private void Content_Paused(object sender, EventArgs e) {
    147       if (InvokeRequired)
    148         Invoke(new EventHandler(Content_Paused), sender, e);
    149       else {
    150         ReadOnly = Locked = false;
    151         SetEnabledStateOfExecutableButtons();
    152       }
    153     }
    154     private void Content_Stopped(object sender, EventArgs e) {
    155       if (InvokeRequired)
    156         Invoke(new EventHandler(Content_Stopped), sender, e);
    157       else {
    158         ReadOnly = Locked = false;
    159         SetEnabledStateOfExecutableButtons();
    160       }
    161     }
    162     private void Content_ExecutionTimeChanged(object sender, EventArgs e) {
    163       if (InvokeRequired)
    164         Invoke(new EventHandler(Content_ExecutionTimeChanged), sender, e);
    165       else
    166         executionTimeTextBox.Text = Content == null ? "-" : Content.ExecutionTime.ToString();
    167     }
    168     private void Content_ExceptionOccurred(object sender, EventArgs<Exception> e) {
    169       if (InvokeRequired)
    170         Invoke(new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred), sender, e);
    171       else
    172         ErrorHandling.ShowErrorDialog(this, e.Value);
    173     }
    174105    private void Content_OptimizerChanged(object sender, EventArgs e) {
    175106      if (InvokeRequired)
     
    239170      }
    240171    }
    241     private void startButton_Click(object sender, EventArgs e) {
    242       Content.Start();
    243     }
    244     private void pauseButton_Click(object sender, EventArgs e) {
    245       Content.Pause();
    246     }
    247     private void stopButton_Click(object sender, EventArgs e) {
    248       Content.Stop();
    249     }
    250     private void resetButton_Click(object sender, EventArgs e) {
    251       Content.Prepare(false);
    252     }
     172
    253173    private void optimizerTabPage_DragEnterOver(object sender, DragEventArgs e) {
    254174      e.Effect = DragDropEffects.None;
     
    270190    #endregion
    271191
    272     #region Helpers
    273     private void SetEnabledStateOfExecutableButtons() {
    274       if (Content == null) {
    275         startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
    276       } else {
    277         startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused);
    278         pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started;
    279         stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused);
    280         resetButton.Enabled = Content.ExecutionState != ExecutionState.Started;
    281       }
    282     }
    283     #endregion
    284192  }
    285193}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentView.Designer.cs

    r5832 r6425  
    5050      this.runsTabPage = new System.Windows.Forms.TabPage();
    5151      this.runsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    52       this.startButton = new System.Windows.Forms.Button();
    53       this.stopButton = new System.Windows.Forms.Button();
    54       this.resetButton = new System.Windows.Forms.Button();
    55       this.executionTimeLabel = new System.Windows.Forms.Label();
    56       this.executionTimeTextBox = new System.Windows.Forms.TextBox();
    57       this.pauseButton = new System.Windows.Forms.Button();
    5852      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5953      this.tabControl.SuspendLayout();
     
    6155      this.runsTabPage.SuspendLayout();
    6256      this.SuspendLayout();
     57      //
     58      // startButton
     59      //
     60      this.startButton.Location = new System.Drawing.Point(0, 458);
     61      this.toolTip.SetToolTip(this.startButton, "Start/Resume Experiment");
     62      //
     63      // executionTimeTextBox
     64      //
     65      this.executionTimeTextBox.Location = new System.Drawing.Point(542, 461);
     66      //
     67      // executionTimeLabel
     68      //
     69      this.executionTimeLabel.Location = new System.Drawing.Point(453, 464);
     70      //
     71      // pauseButton
     72      //
     73      this.pauseButton.Location = new System.Drawing.Point(30, 458);
     74      this.toolTip.SetToolTip(this.pauseButton, "Pause Experiment");
     75      //
     76      // stopButton
     77      //
     78      this.stopButton.Location = new System.Drawing.Point(60, 458);
     79      this.toolTip.SetToolTip(this.stopButton, "Stop Experiment");
     80      //
     81      // resetButton
     82      //
     83      this.resetButton.Location = new System.Drawing.Point(90, 458);
     84      this.toolTip.SetToolTip(this.resetButton, "Reset Experiment");
    6385      //
    6486      // nameTextBox
     
    7698      //
    7799      this.tabControl.AllowDrop = true;
    78       this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    79                   | System.Windows.Forms.AnchorStyles.Left)
    80                   | System.Windows.Forms.AnchorStyles.Right)));
     100      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     101            | System.Windows.Forms.AnchorStyles.Left)
     102            | System.Windows.Forms.AnchorStyles.Right)));
    81103      this.tabControl.Controls.Add(this.optimizersTabPage);
    82104      this.tabControl.Controls.Add(this.runsTabPage);
     
    84106      this.tabControl.Name = "tabControl";
    85107      this.tabControl.SelectedIndex = 0;
    86       this.tabControl.Size = new System.Drawing.Size(679, 426);
     108      this.tabControl.Size = new System.Drawing.Size(679, 427);
    87109      this.tabControl.TabIndex = 3;
    88110      //
     
    93115      this.optimizersTabPage.Name = "optimizersTabPage";
    94116      this.optimizersTabPage.Padding = new System.Windows.Forms.Padding(3);
    95       this.optimizersTabPage.Size = new System.Drawing.Size(671, 400);
     117      this.optimizersTabPage.Size = new System.Drawing.Size(671, 401);
    96118      this.optimizersTabPage.TabIndex = 1;
    97119      this.optimizersTabPage.Text = "Optimizers";
     
    100122      // optimizerListView
    101123      //
    102       this.optimizerListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    103                   | System.Windows.Forms.AnchorStyles.Left)
    104                   | System.Windows.Forms.AnchorStyles.Right)));
     124      this.optimizerListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     125            | System.Windows.Forms.AnchorStyles.Left)
     126            | System.Windows.Forms.AnchorStyles.Right)));
    105127      this.optimizerListView.Caption = "OptimizerList View";
    106128      this.optimizerListView.Content = null;
     
    108130      this.optimizerListView.Name = "optimizerListView";
    109131      this.optimizerListView.ReadOnly = false;
    110       this.optimizerListView.Size = new System.Drawing.Size(659, 388);
     132      this.optimizerListView.Size = new System.Drawing.Size(659, 389);
    111133      this.optimizerListView.TabIndex = 0;
    112134      //
     
    117139      this.runsTabPage.Name = "runsTabPage";
    118140      this.runsTabPage.Padding = new System.Windows.Forms.Padding(3);
    119       this.runsTabPage.Size = new System.Drawing.Size(671, 400);
     141      this.runsTabPage.Size = new System.Drawing.Size(671, 401);
    120142      this.runsTabPage.TabIndex = 2;
    121143      this.runsTabPage.Text = "Runs";
     
    124146      // runsViewHost
    125147      //
    126       this.runsViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    127                   | System.Windows.Forms.AnchorStyles.Left)
    128                   | System.Windows.Forms.AnchorStyles.Right)));
     148      this.runsViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     149            | System.Windows.Forms.AnchorStyles.Left)
     150            | System.Windows.Forms.AnchorStyles.Right)));
    129151      this.runsViewHost.Caption = "View";
    130152      this.runsViewHost.Content = null;
     
    133155      this.runsViewHost.Name = "runsViewHost";
    134156      this.runsViewHost.ReadOnly = false;
    135       this.runsViewHost.Size = new System.Drawing.Size(663, 388);
     157      this.runsViewHost.Size = new System.Drawing.Size(657, 389);
    136158      this.runsViewHost.TabIndex = 0;
    137159      this.runsViewHost.ViewsLabelVisible = true;
    138160      this.runsViewHost.ViewType = null;
    139       //
    140       // startButton
    141       //
    142       this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    143       this.startButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Play;
    144       this.startButton.Location = new System.Drawing.Point(0, 458);
    145       this.startButton.Name = "startButton";
    146       this.startButton.Size = new System.Drawing.Size(24, 24);
    147       this.startButton.TabIndex = 4;
    148       this.toolTip.SetToolTip(this.startButton, "Start/Resume Experiment");
    149       this.startButton.UseVisualStyleBackColor = true;
    150       this.startButton.Click += new System.EventHandler(this.startButton_Click);
    151       //
    152       // stopButton
    153       //
    154       this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    155       this.stopButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Stop;
    156       this.stopButton.Location = new System.Drawing.Point(60, 458);
    157       this.stopButton.Name = "stopButton";
    158       this.stopButton.Size = new System.Drawing.Size(24, 24);
    159       this.stopButton.TabIndex = 6;
    160       this.toolTip.SetToolTip(this.stopButton, "Stop Experiment");
    161       this.stopButton.UseVisualStyleBackColor = true;
    162       this.stopButton.Click += new System.EventHandler(this.stopButton_Click);
    163       //
    164       // resetButton
    165       //
    166       this.resetButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    167       this.resetButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Restart;
    168       this.resetButton.Location = new System.Drawing.Point(90, 458);
    169       this.resetButton.Name = "resetButton";
    170       this.resetButton.Size = new System.Drawing.Size(24, 24);
    171       this.resetButton.TabIndex = 7;
    172       this.toolTip.SetToolTip(this.resetButton, "Reset Experiment");
    173       this.resetButton.UseVisualStyleBackColor = true;
    174       this.resetButton.Click += new System.EventHandler(this.resetButton_Click);
    175       //
    176       // executionTimeLabel
    177       //
    178       this.executionTimeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    179       this.executionTimeLabel.AutoSize = true;
    180       this.executionTimeLabel.Location = new System.Drawing.Point(453, 465);
    181       this.executionTimeLabel.Name = "executionTimeLabel";
    182       this.executionTimeLabel.Size = new System.Drawing.Size(83, 13);
    183       this.executionTimeLabel.TabIndex = 8;
    184       this.executionTimeLabel.Text = "&Execution Time:";
    185       //
    186       // executionTimeTextBox
    187       //
    188       this.executionTimeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    189       this.executionTimeTextBox.Location = new System.Drawing.Point(542, 462);
    190       this.executionTimeTextBox.Name = "executionTimeTextBox";
    191       this.executionTimeTextBox.ReadOnly = true;
    192       this.executionTimeTextBox.Size = new System.Drawing.Size(137, 20);
    193       this.executionTimeTextBox.TabIndex = 9;
    194       //
    195       // pauseButton
    196       //
    197       this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    198       this.pauseButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Pause;
    199       this.pauseButton.Location = new System.Drawing.Point(30, 458);
    200       this.pauseButton.Name = "pauseButton";
    201       this.pauseButton.Size = new System.Drawing.Size(24, 24);
    202       this.pauseButton.TabIndex = 5;
    203       this.toolTip.SetToolTip(this.pauseButton, "Pause Experiment");
    204       this.pauseButton.UseVisualStyleBackColor = true;
    205       this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click);
    206161      //
    207162      // ExperimentView
     
    210165      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    211166      this.Controls.Add(this.tabControl);
    212       this.Controls.Add(this.startButton);
    213       this.Controls.Add(this.executionTimeTextBox);
    214       this.Controls.Add(this.executionTimeLabel);
    215       this.Controls.Add(this.pauseButton);
    216       this.Controls.Add(this.stopButton);
    217       this.Controls.Add(this.resetButton);
    218167      this.Name = "ExperimentView";
    219168      this.Size = new System.Drawing.Size(679, 482);
    220       this.Controls.SetChildIndex(this.infoLabel, 0);
    221169      this.Controls.SetChildIndex(this.resetButton, 0);
    222170      this.Controls.SetChildIndex(this.stopButton, 0);
    223171      this.Controls.SetChildIndex(this.pauseButton, 0);
     172      this.Controls.SetChildIndex(this.tabControl, 0);
    224173      this.Controls.SetChildIndex(this.executionTimeLabel, 0);
    225174      this.Controls.SetChildIndex(this.executionTimeTextBox, 0);
    226175      this.Controls.SetChildIndex(this.startButton, 0);
    227       this.Controls.SetChildIndex(this.tabControl, 0);
     176      this.Controls.SetChildIndex(this.infoLabel, 0);
    228177      this.Controls.SetChildIndex(this.nameLabel, 0);
    229178      this.Controls.SetChildIndex(this.nameTextBox, 0);
     
    240189    private HeuristicLab.MainForm.WindowsForms.DragOverTabControl tabControl;
    241190    private System.Windows.Forms.TabPage optimizersTabPage;
    242     private System.Windows.Forms.Button startButton;
    243     private System.Windows.Forms.Button stopButton;
    244     private System.Windows.Forms.Button resetButton;
    245     private System.Windows.Forms.Label executionTimeLabel;
    246     private System.Windows.Forms.TextBox executionTimeTextBox;
    247     private System.Windows.Forms.Button pauseButton;
    248191    private OptimizerListView optimizerListView;
    249192    private System.Windows.Forms.TabPage runsTabPage;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentView.cs

    r5832 r6425  
    2020#endregion
    2121
    22 using System;
    2322using System.Linq;
    2423using System.Windows.Forms;
    25 using HeuristicLab.Common;
    2624using HeuristicLab.Core;
    27 using HeuristicLab.Core.Views;
    2825using HeuristicLab.MainForm;
    29 using HeuristicLab.PluginInfrastructure;
    3026
    3127namespace HeuristicLab.Optimization.Views {
    32   /// <summary>
    33   /// The base class for visual representations of items.
    34   /// </summary>
    3528  [View("Experiment View")]
    3629  [Content(typeof(Experiment), true)]
    37   public sealed partial class ExperimentView : NamedItemView {
    38     public new Experiment Content {
    39       get { return (Experiment)base.Content; }
    40       set { base.Content = value; }
    41     }
    42 
    43     /// <summary>
    44     /// Initializes a new instance of <see cref="ItemBaseView"/>.
    45     /// </summary>
     30  public sealed partial class ExperimentView : IOptimizerView {
    4631    public ExperimentView() {
    4732      InitializeComponent();
    4833    }
    4934
    50     protected override void DeregisterContentEvents() {
    51       Content.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred);
    52       Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged);
    53       Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged);
    54       Content.Prepared -= new EventHandler(Content_Prepared);
    55       Content.Started -= new EventHandler(Content_Started);
    56       Content.Paused -= new EventHandler(Content_Paused);
    57       Content.Stopped -= new EventHandler(Content_Stopped);
    58       base.DeregisterContentEvents();
    59     }
    60     protected override void RegisterContentEvents() {
    61       base.RegisterContentEvents();
    62       Content.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred);
    63       Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged);
    64       Content.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged);
    65       Content.Prepared += new EventHandler(Content_Prepared);
    66       Content.Started += new EventHandler(Content_Started);
    67       Content.Paused += new EventHandler(Content_Paused);
    68       Content.Stopped += new EventHandler(Content_Stopped);
     35    public new Experiment Content {
     36      get { return (Experiment)base.Content; }
     37      set { base.Content = value; }
    6938    }
    7039
     
    7443        optimizerListView.Content = null;
    7544        runsViewHost.Content = null;
    76         executionTimeTextBox.Text = "-";
    7745      } else {
    78         Locked = ReadOnly = Content.ExecutionState == ExecutionState.Started;
    7946        optimizerListView.Content = Content.Optimizers;
    8047        runsViewHost.Content = Content.Runs;
    81         executionTimeTextBox.Text = Content.ExecutionTime.ToString();
    8248      }
    8349    }
     
    8753      optimizerListView.Enabled = Content != null;
    8854      runsViewHost.Enabled = Content != null;
    89       executionTimeTextBox.Enabled = Content != null;
    90       SetEnabledStateOfExecutableButtons();
    9155    }
    9256
     
    10266      base.OnClosed(e);
    10367    }
    104 
    105     #region Content Events
    106     private void Content_ExecutionStateChanged(object sender, EventArgs e) {
    107       if (InvokeRequired)
    108         Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
    109       else
    110         startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
    111     }
    112     private void Content_Prepared(object sender, EventArgs e) {
    113       if (InvokeRequired)
    114         Invoke(new EventHandler(Content_Prepared), sender, e);
    115       else {
    116         nameTextBox.Enabled = infoLabel.Enabled = true;
    117         ReadOnly = Locked = false;
    118         SetEnabledStateOfExecutableButtons();
    119       }
    120     }
    121     private void Content_Started(object sender, EventArgs e) {
    122       if (InvokeRequired)
    123         Invoke(new EventHandler(Content_Started), sender, e);
    124       else {
    125         nameTextBox.Enabled = infoLabel.Enabled = false;
    126         ReadOnly = Locked = true;
    127         SetEnabledStateOfExecutableButtons();
    128       }
    129     }
    130     private void Content_Paused(object sender, EventArgs e) {
    131       if (InvokeRequired)
    132         Invoke(new EventHandler(Content_Paused), sender, e);
    133       else {
    134         nameTextBox.Enabled = infoLabel.Enabled = true;
    135         ReadOnly = Locked = false;
    136         SetEnabledStateOfExecutableButtons();
    137       }
    138     }
    139     private void Content_Stopped(object sender, EventArgs e) {
    140       if (InvokeRequired)
    141         Invoke(new EventHandler(Content_Stopped), sender, e);
    142       else {
    143         nameTextBox.Enabled = infoLabel.Enabled = true;
    144         ReadOnly = Locked = false;
    145         SetEnabledStateOfExecutableButtons();
    146       }
    147     }
    148     private void Content_ExecutionTimeChanged(object sender, EventArgs e) {
    149       if (InvokeRequired)
    150         Invoke(new EventHandler(Content_ExecutionTimeChanged), sender, e);
    151       else
    152         executionTimeTextBox.Text = Content == null ? "-" : Content.ExecutionTime.ToString();
    153     }
    154     private void Content_ExceptionOccurred(object sender, EventArgs<Exception> e) {
    155       if (InvokeRequired)
    156         Invoke(new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred), sender, e);
    157       else
    158         ErrorHandling.ShowErrorDialog(this, e.Value);
    159     }
    160     #endregion
    161 
    162     #region Control events
    163     private void startButton_Click(object sender, EventArgs e) {
    164       Content.Start();
    165     }
    166     private void pauseButton_Click(object sender, EventArgs e) {
    167       Content.Pause();
    168     }
    169     private void stopButton_Click(object sender, EventArgs e) {
    170       Content.Stop();
    171     }
    172     private void resetButton_Click(object sender, EventArgs e) {
    173       Content.Prepare(false);
    174     }
    175     #endregion
    176 
    177     #region Helpers
    178     private void SetEnabledStateOfExecutableButtons() {
    179       if (Content == null) {
    180         startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
    181       } else {
    182         startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused);
    183         pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started;
    184         stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused);
    185         resetButton.Enabled = Content.ExecutionState != ExecutionState.Started;
    186       }
    187     }
    188     #endregion
    18968  }
    19069}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/HeuristicLab.Optimization.Views-3.3.csproj

    r5875 r6425  
    6969    <OutputPath>bin\x86\Release\</OutputPath>
    7070    <DefineConstants>TRACE</DefineConstants>
    71     <DocumentationFile>bin\x86\Release\HeuristicLab.Optimization.Views-3.3.XML</DocumentationFile>
     71    <DocumentationFile>
     72    </DocumentationFile>
    7273    <Optimize>true</Optimize>
    7374    <DebugType>pdbonly</DebugType>
     
    127128      <DependentUpon>BatchRunView.cs</DependentUpon>
    128129    </Compile>
     130    <Compile Include="IOptimizerView.cs">
     131      <SubType>UserControl</SubType>
     132    </Compile>
     133    <Compile Include="IOptimizerView.Designer.cs">
     134      <DependentUpon>IOptimizerView.cs</DependentUpon>
     135    </Compile>
    129136    <Compile Include="ResultValueView.cs">
    130137      <SubType>UserControl</SubType>
Note: See TracChangeset for help on using the changeset viewer.