Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/21/10 06:14:03 (14 years ago)
Author:
swagner
Message:

Adapted views according the new read-only property (#973)

Location:
trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/PathTSPTourView.cs

    r3213 r3454  
    7070      if (Content == null) {
    7171        pictureBox.Image = null;
    72         pictureBox.Enabled = false;
    7372      } else {
    74         pictureBox.Enabled = true;
    7573        GenerateImage();
    7674      }
     75      SetEnabledStateOfControls();
     76    }
     77
     78    protected override void OnReadOnlyChanged() {
     79      base.OnReadOnlyChanged();
     80      SetEnabledStateOfControls();
     81    }
     82
     83    private void SetEnabledStateOfControls() {
     84      pictureBox.Enabled = Content != null;
    7785    }
    7886
  • trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TravelingSalesmanProblemView.cs

    r3376 r3454  
    7171      if (Content == null) {
    7272        parameterCollectionView.Content = null;
    73         parameterCollectionView.Enabled = false;
    7473        pathTSPTourView.Content = null;
    75         pathTSPTourView.Enabled = false;
    76         importButton.Enabled = false;
    7774      } else {
    7875        parameterCollectionView.Content = ((IParameterizedNamedItem)Content).Parameters;
    79         parameterCollectionView.Enabled = true;
    8076        pathTSPTourView.Content = new PathTSPTour(Content.Coordinates, Content.BestKnownSolution);
    81         pathTSPTourView.Enabled = true;
    82         importButton.Enabled = true;
    8377      }
     78      SetEnabledStateOfControls();
     79    }
     80
     81    protected override void OnReadOnlyChanged() {
     82      base.OnReadOnlyChanged();
     83      SetEnabledStateOfControls();
     84    }
     85
     86    private void SetEnabledStateOfControls() {
     87      parameterCollectionView.Enabled = Content != null;
     88      parameterCollectionView.ReadOnly = ReadOnly;
     89      pathTSPTourView.Enabled = Content != null;
     90      pathTSPTourView.ReadOnly = ReadOnly;
     91      importButton.Enabled = Content != null && !ReadOnly;
    8492    }
    8593
Note: See TracChangeset for help on using the changeset viewer.