Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/05/10 14:04:53 (14 years ago)
Author:
mkommend
Message:

corrected RunCollectionConstraints and the according views (ticket#970)

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

Legend:

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

    r3614 r3632  
    3434      this.txtConstraintData.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    3535                  | System.Windows.Forms.AnchorStyles.Right)));
     36      this.errorProvider.SetIconAlignment(this.txtConstraintData, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
     37      this.errorProvider.SetIconPadding(this.txtConstraintData, 2);
    3638      this.txtConstraintData.Location = new System.Drawing.Point(127, 56);
    3739      this.txtConstraintData.Name = "txtConstraintData";
    3840      this.txtConstraintData.Size = new System.Drawing.Size(246, 20);
    3941      this.txtConstraintData.TabIndex = 9;
    40       this.txtConstraintData.TextChanged += new System.EventHandler(this.txtConstraintData_TextChanged);
     42      this.txtConstraintData.Validated += new System.EventHandler(this.txtConstraintData_Validated);
    4143      this.txtConstraintData.Validating += new System.ComponentModel.CancelEventHandler(this.txtConstraintData_Validating);
    4244      //
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectioComparisonConstraintView.cs

    r3614 r3632  
    3636
    3737    protected override void DeregisterContentEvents() {
    38       base.RegisterContentEvents();
     38      base.DeregisterContentEvents();
    3939      Content.ConstraintDataChanged -= new EventHandler(Content_ConstraintDataChanged);
    4040    }
     
    5252          }
    5353        }
    54         if (Content.ConstraintColumn >= 0)
     54        if (Content.ConstraintColumn >= 0) {
    5555          this.cmbConstraintColumn.SelectedItem = (matrix.ColumnNames.ElementAt(Content.ConstraintColumn));
     56          if (Content.ConstraintData != null)
     57            txtConstraintData.Text = Content.ConstraintData.GetValue();
     58          else
     59            this.Content_ConstraintColumnChanged(cmbConstraintColumn, EventArgs.Empty);
     60        }
    5661      }
    5762    }
     
    7479    }
    7580
    76     private void txtConstraintData_TextChanged(object sender, EventArgs e) {
    77       Content.ConstraintData.SetValue(txtConstraintData.Text);
     81    private void txtConstraintData_Validated(object sender, EventArgs e) {
     82      IStringConvertibleValue value = (IStringConvertibleValue)Activator.CreateInstance(Content.ConstrainedValue.GetDataType(cmbConstraintColumn.SelectedItem.ToString()).First());
     83      value.SetValue(txtConstraintData.Text);
     84      Content.ConstraintData = value;
    7885    }
    7986
    8087    private void txtConstraintData_Validating(object sender, CancelEventArgs e) {
    81       string errorMessage;
     88      string errorMessage = string.Empty;
    8289      if (!Content.ConstraintData.Validate(txtConstraintData.Text, out errorMessage)) {
    8390        errorProvider.SetError(txtConstraintData, errorMessage);
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs

    r3614 r3632  
    120120    }
    121121    private void run_Changed(object sender, EventArgs e) {
    122       IRun run = (IRun)sender;
    123       UpdateRun(run);
     122      if (InvokeRequired)
     123        this.Invoke(new EventHandler(run_Changed), sender, e);
     124      else {
     125        IRun run = (IRun)sender;
     126        UpdateRun(run);
     127      }
    124128    }
    125129
     
    144148      UpdateComboBoxes();
    145149      UpdateDataPoints();
    146       foreach(IRun run in Content)
     150      foreach (IRun run in Content)
    147151        UpdateRun(run);
    148152    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionConstraintCollectionView.Designer.cs

    r3614 r3632  
    1212    protected override void Dispose(bool disposing) {
    1313      if (disposing) {
    14         if (createParameterDialog != null) createParameterDialog.Dispose();
    1514        if (components != null) components.Dispose();
    1615      }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionConstraintCollectionView.cs

    r3614 r3632  
    3232  [Content(typeof(IItemCollection<IRunCollectionConstraint>), false)]
    3333  public partial class RunCollectionConstraintCollectionView : ItemCollectionView<IRunCollectionConstraint> {
    34     protected CreateParameterDialog createParameterDialog;
    3534    /// <summary>
    3635    /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View".
     
    6463      base.RegisterContentEvents();
    6564      foreach (IRunCollectionConstraint constraint in Content)
    66         constraint.ActiveChanged += new EventHandler(constraint_ActiveChanged);
     65        RegisterConstraintEvents(constraint);
    6766    }
    6867    protected override void DeregisterContentEvents() {
    6968      base.DeregisterContentEvents();
    7069      foreach (IRunCollectionConstraint constraint in Content)
    71         constraint.ActiveChanged -= new EventHandler(constraint_ActiveChanged);
     70        DeregisterConstraintEvents(constraint);
    7271    }
    7372    protected override void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRunCollectionConstraint> e) {
    7473      base.Content_ItemsAdded(sender, e);
    7574      foreach (IRunCollectionConstraint constraint in e.Items)
    76         constraint.ActiveChanged += new EventHandler(constraint_ActiveChanged);
     75        RegisterConstraintEvents(constraint);
    7776    }
    7877    protected override void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRunCollectionConstraint> e) {
    7978      base.Content_ItemsRemoved(sender, e);
    8079      foreach (IRunCollectionConstraint constraint in e.Items)
    81         constraint.ActiveChanged -= new EventHandler(constraint_ActiveChanged);
     80        DeregisterConstraintEvents(constraint);
    8281    }
    8382    protected override void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRunCollectionConstraint> e) {
    8483      base.Content_CollectionReset(sender, e);
    8584      foreach (IRunCollectionConstraint constraint in e.OldItems)
    86         constraint.ActiveChanged -= new EventHandler(constraint_ActiveChanged);
     85        RegisterConstraintEvents(constraint);
    8786      foreach (IRunCollectionConstraint constraint in e.Items)
    88         constraint.ActiveChanged += new EventHandler(constraint_ActiveChanged);
     87        DeregisterConstraintEvents(constraint);
     88    }
     89
     90    protected virtual void RegisterConstraintEvents(IRunCollectionConstraint constraint) {
     91      constraint.ActiveChanged += new EventHandler(constraint_ActiveChanged);
     92    }
     93
     94    protected virtual void DeregisterConstraintEvents(IRunCollectionConstraint constraint) {
     95      constraint.ActiveChanged -= new EventHandler(constraint_ActiveChanged);
    8996    }
    9097
     
    99106        }
    100107      }
     108      this.AdjustListViewColumnSizes();
    101109    }
    102 
    103 
    104110  }
    105111}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionTabularView.cs

    r3614 r3632  
    9595    }
    9696    private void run_Changed(object sender, EventArgs e) {
    97       IRun run = (IRun)sender;
    98       UpdateRun(run);
     97      if (InvokeRequired)
     98        this.Invoke(new EventHandler(run_Changed), sender, e);
     99      else {
     100        IRun run = (IRun)sender;
     101        UpdateRun(run);
     102      }
    99103    }
    100104
     
    104108      this.dataGridView.Rows[rowIndex].Visible = run.Visible;
    105109      this.dataGridView.Rows[rowIndex].DefaultCellStyle.ForeColor = run.Color;
     110      this.rowsTextBox.Text = this.Content.Count(r => r.Visible).ToString();
    106111    }
    107112
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r3614 r3632  
    335335    }
    336336    protected virtual void Run_Changed(object sender, EventArgs e) {
    337       IRun run = (IRun)sender;
    338       UpdateRun(run);
     337      if (InvokeRequired)
     338        this.Invoke(new EventHandler(Run_Changed), sender, e);
     339      else {
     340        IRun run = (IRun)sender;
     341        UpdateRun(run);
     342      }
    339343    }
    340344
Note: See TracChangeset for help on using the changeset viewer.