- Timestamp:
- 08/01/13 09:57:40 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Data.Views/3.3/Path Views/FileValueView.cs
r9697 r9833 22 22 using System; 23 23 using System.Windows.Forms; 24 using HeuristicLab.Core.Views; 24 25 using HeuristicLab.MainForm; 25 26 … … 27 28 [View("FileValueView")] 28 29 [Content(typeof(FileValue), true)] 29 public partial class FileValueView : StringConvertibleValueView {30 public partial class FileValueView : ItemView { 30 31 public new FileValue Content { 31 32 get { return (FileValue)base.Content; } 32 33 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; }41 34 } 42 35 … … 45 38 } 46 39 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 }55 40 protected override void SetEnabledStateOfControls() { 56 41 base.SetEnabledStateOfControls(); 57 valueTextBox.Enabled = !Locked && !ReadOnly && Content != null;58 valueTextBox.ReadOnly = Locked || ReadOnly || Content == null;59 42 openButton.Enabled = !Locked && !ReadOnly && Content != null; 60 43 } … … 63 46 base.OnContentChanged(); 64 47 if (Content == null) { 65 valueTextBox.Text = string.Empty;48 stringConvertibleValueView.Content = null; 66 49 return; 67 50 } 68 51 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; 75 53 openFileDialog.Filter = Content.FileDialogFilter; 76 54 } 77 55 78 56 protected virtual void openButton_Click(object sender, EventArgs e) { 57 openFileDialog.Filter = Content.FileDialogFilter; 79 58 if (openFileDialog.ShowDialog(this) != DialogResult.OK) return; 80 59 Content.Value = openFileDialog.FileName;
Note: See TracChangeset
for help on using the changeset viewer.