Ignore:
Timestamp:
05/04/19 08:22:42 (7 months ago)
Author:
gkronber
Message:

#2925 merged r16661:16890 from trunk to branch

Location:
branches/2925_AutoDiffForDynamicalModels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2925_AutoDiffForDynamicalModels

  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Parameters.Views/3.3/ValueParameterView.cs

    r16662 r16892  
    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.