Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/01/13 09:57:40 (11 years ago)
Author:
mkommend
Message:

#2081: Implemented reviewer comments by gkronber for path values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data.Views/3.3/Path Views/FileValueView.cs

    r9697 r9833  
    2222using System;
    2323using System.Windows.Forms;
     24using HeuristicLab.Core.Views;
    2425using HeuristicLab.MainForm;
    2526
     
    2728  [View("FileValueView")]
    2829  [Content(typeof(FileValue), true)]
    29   public partial class FileValueView : StringConvertibleValueView {
     30  public partial class FileValueView : ItemView {
    3031    public new FileValue Content {
    3132      get { return (FileValue)base.Content; }
    3233      set { base.Content = value; }
    33     }
    34 
    35     public override bool ReadOnly {
    36       get {
    37         if ((Content != null) && Content.ReadOnly) return true;
    38         return base.ReadOnly;
    39       }
    40       set { base.ReadOnly = value; }
    4134    }
    4235
     
    4538    }
    4639
    47     protected override void RegisterContentEvents() {
    48       base.RegisterContentEvents();
    49       Content.FileOpenDialogFilterChanged += new EventHandler(Content_FileOpenDialogFilterChanged);
    50     }
    51     protected override void DeregisterContentEvents() {
    52       Content.FileOpenDialogFilterChanged -= new EventHandler(Content_FileOpenDialogFilterChanged);
    53       base.DeregisterContentEvents();
    54     }
    5540    protected override void SetEnabledStateOfControls() {
    5641      base.SetEnabledStateOfControls();
    57       valueTextBox.Enabled = !Locked && !ReadOnly && Content != null;
    58       valueTextBox.ReadOnly = Locked || ReadOnly || Content == null;
    5942      openButton.Enabled = !Locked && !ReadOnly && Content != null;
    6043    }
     
    6346      base.OnContentChanged();
    6447      if (Content == null) {
    65         valueTextBox.Text = string.Empty;
     48        stringConvertibleValueView.Content = null;
    6649        return;
    6750      }
    6851
    69       valueTextBox.Text = Content.Value;
    70       openButton.Enabled = !Content.ReadOnly;
    71       openFileDialog.Filter = Content.FileDialogFilter;
    72     }
    73 
    74     protected virtual void Content_FileOpenDialogFilterChanged(object sender, EventArgs e) {
     52      stringConvertibleValueView.Content = Content.StringValue;
    7553      openFileDialog.Filter = Content.FileDialogFilter;
    7654    }
    7755
    7856    protected virtual void openButton_Click(object sender, EventArgs e) {
     57      openFileDialog.Filter = Content.FileDialogFilter;
    7958      if (openFileDialog.ShowDialog(this) != DialogResult.OK) return;
    8059      Content.Value = openFileDialog.FileName;
Note: See TracChangeset for help on using the changeset viewer.