Changeset 7290 for branches/RegressionBenchmarks/HeuristicLab.Optimization.Views/3.3/ResultValueView.cs
- Timestamp:
- 01/08/12 19:13:14 (12 years ago)
- Location:
- branches/RegressionBenchmarks
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RegressionBenchmarks
- Property svn:ignore
-
old new 18 18 bin 19 19 protoc.exe 20 *.user
-
- Property svn:mergeinfo changed
/trunk/sources merged: 7209,7214,7216-7230,7233-7239,7241,7243-7252,7254,7256-7261,7265-7266,7272-7275,7277,7280,7283
- Property svn:ignore
-
branches/RegressionBenchmarks/HeuristicLab.Optimization.Views/3.3/ResultValueView.cs
r5896 r7290 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 1Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 30 30 [Content(typeof(IResult), false)] 31 31 public sealed partial class ResultValueView : ItemView { 32 private const string infoLabelToolTipSuffix = "Double-click to open description editor."; 33 32 34 public new IResult Content { 33 35 get { return (IResult)base.Content; } … … 45 47 46 48 protected override void DeregisterContentEvents() { 49 Content.NameChanged -= new EventHandler(Content_NameChanged); 50 Content.DescriptionChanged -= new EventHandler(Content_DescriptionChanged); 47 51 Content.ValueChanged -= new EventHandler(Content_ValueChanged); 48 52 base.DeregisterContentEvents(); … … 50 54 protected override void RegisterContentEvents() { 51 55 base.RegisterContentEvents(); 56 Content.NameChanged += new EventHandler(Content_NameChanged); 57 Content.DescriptionChanged += new EventHandler(Content_DescriptionChanged); 52 58 Content.ValueChanged += new EventHandler(Content_ValueChanged); 53 59 } … … 57 63 if (Content == null) { 58 64 viewHost.Content = null; 65 toolTip.SetToolTip(infoLabel, string.Empty); 66 if (ViewAttribute.HasViewAttribute(this.GetType())) 67 this.Caption = ViewAttribute.GetViewName(this.GetType()); 68 else 69 this.Caption = "ResultValue View"; 59 70 } else { 60 71 viewHost.ViewType = null; 61 72 viewHost.Content = Content.Value; 73 toolTip.SetToolTip(infoLabel, string.IsNullOrEmpty(Content.Description) ? infoLabelToolTipSuffix : Content.Description + Environment.NewLine + Environment.NewLine + infoLabelToolTipSuffix); 74 Caption = Content.Name; 62 75 } 63 76 } … … 67 80 viewHost.Enabled = Content != null; 68 81 viewHost.ReadOnly = this.ReadOnly; 82 infoLabel.Enabled = Content != null; 69 83 } 70 84 85 private void Content_NameChanged(object sender, EventArgs e) { 86 if (InvokeRequired) 87 Invoke(new EventHandler(Content_NameChanged), sender, e); 88 else 89 Caption = Content.Name; 90 } 91 private void Content_DescriptionChanged(object sender, EventArgs e) { 92 if (InvokeRequired) 93 Invoke(new EventHandler(Content_DescriptionChanged), sender, e); 94 else 95 toolTip.SetToolTip(infoLabel, string.IsNullOrEmpty(Content.Description) ? infoLabelToolTipSuffix : Content.Description + Environment.NewLine + Environment.NewLine + infoLabelToolTipSuffix); 96 } 71 97 private void Content_ValueChanged(object sender, EventArgs e) { 72 98 if (InvokeRequired) … … 76 102 } 77 103 } 104 105 private void infoLabel_DoubleClick(object sender, System.EventArgs e) { 106 using (TextDialog dialog = new TextDialog("Description of " + Content.Name, Content.Description, ReadOnly || !Content.CanChangeDescription)) { 107 if (dialog.ShowDialog(this) == DialogResult.OK) 108 Content.Description = dialog.Content; 109 } 110 } 78 111 } 79 112 }
Note: See TracChangeset
for help on using the changeset viewer.