Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/13/19 13:59:30 (5 years ago)
Author:
mkommend
Message:

#2521: Merged trunk changes up to r16945 into branch.

Location:
branches/2521_ProblemRefactoring
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring

  • branches/2521_ProblemRefactoring/HeuristicLab.Parameters.Views/3.3/ValueParameterView.cs

    r16723 r16946  
    7474    protected override void DeregisterContentEvents() {
    7575      Content.GetsCollectedChanged -= new EventHandler(Content_GetsCollectedChanged);
     76      Content.ReadOnlyChanged -= new EventHandler(Content_ReadOnlyChanged);
    7677      Content.ValueChanged -= new EventHandler(Content_ValueChanged);
    7778      base.DeregisterContentEvents();
     
    8586      base.RegisterContentEvents();
    8687      Content.GetsCollectedChanged += new EventHandler(Content_GetsCollectedChanged);
     88      Content.ReadOnlyChanged += new EventHandler(Content_ReadOnlyChanged);
    8789      Content.ValueChanged += new EventHandler(Content_ValueChanged);
    8890    }
     
    103105    protected override void SetEnabledStateOfControls() {
    104106      base.SetEnabledStateOfControls();
    105       setValueButton.Enabled = Content != null && !(Content is IFixedValueParameter) && !ReadOnly;
    106       clearValueButton.Enabled = Content != null && Content.Value != null && !(Content is IFixedValueParameter) && !(Content is ValueParameter<T>) && !ReadOnly;
     107      setValueButton.Enabled = Content != null && !Content.ReadOnly && !(Content is IFixedValueParameter) && !ReadOnly;
     108      clearValueButton.Enabled = Content != null && !Content.ReadOnly && Content.Value != null && !(Content is IFixedValueParameter) && !(Content is ValueParameter<T>) && !ReadOnly;
    107109      showInRunCheckBox.Enabled = Content != null && !ReadOnly;
    108110    }
     
    113115      else {
    114116        SetDataTypeTextBoxText();
    115         setValueButton.Enabled = Content != null && !(Content is IFixedValueParameter) && !ReadOnly;
    116         clearValueButton.Enabled = Content != null && Content.Value != null && !(Content is IFixedValueParameter<T>) && !(Content is ValueParameter<T>) && !ReadOnly;
     117        setValueButton.Enabled = Content != null && !Content.ReadOnly && !(Content is IFixedValueParameter) && !ReadOnly;
     118        clearValueButton.Enabled = Content != null && !Content.ReadOnly && Content.Value != null && !(Content is IFixedValueParameter<T>) && !(Content is ValueParameter<T>) && !ReadOnly;
    117119        valueViewHost.ViewType = null;
    118120        valueViewHost.Content = Content != null ? Content.Value : null;
     121      }
     122    }
     123
     124    protected virtual void Content_ReadOnlyChanged(object sender, EventArgs e) {
     125      if (InvokeRequired)
     126        Invoke(new EventHandler(Content_ReadOnlyChanged), sender, e);
     127      else {
     128        SetEnabledStateOfControls();
    119129      }
    120130    }
     
    135145        try {
    136146          Content.Value = (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
    137         }
    138         catch (Exception ex) {
     147        } catch (Exception ex) {
    139148          ErrorHandling.ShowErrorDialog(this, ex);
    140149        }
Note: See TracChangeset for help on using the changeset viewer.