- Timestamp:
- 04/19/10 21:00:30 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/ContentView.cs
r3389 r3416 28 28 using System.Text; 29 29 using System.Windows.Forms; 30 using HeuristicLab.Common; 31 using System.Reflection; 30 32 31 33 namespace HeuristicLab.MainForm.WindowsForms { 32 34 public partial class ContentView : View, IContentView { 33 private object content;34 public object Content {35 private IContent content; 36 public IContent Content { 35 37 get { return content; } 36 38 set { … … 38 40 throw new ArgumentException(string.Format("View \"{0}\" cannot view object \"{1}\".", this.GetType().Name, value.GetType().Name)); 39 41 if (InvokeRequired) { 40 Invoke(new Action< object>(delegate(object o) { this.Content = o; }), value);42 Invoke(new Action<IContent>(delegate(IContent o) { this.Content = o; }), value); 41 43 } else { 42 44 if (this.content != value) { … … 49 51 } 50 52 } 51 private bool saveEnabled;52 public bool SaveEnabled {53 get { return saveEnabled; }54 protected set {55 if (value != saveEnabled) {56 saveEnabled = value;57 OnChanged();58 }59 }60 }61 53 62 54 public ContentView() 63 55 : base() { 64 56 InitializeComponent(); 65 saveEnabled = true;57 this.locked = false; 66 58 } 67 public ContentView( object content)59 public ContentView(IContent content) 68 60 : this() { 69 61 this.content = content; 62 } 63 64 private bool locked; 65 public virtual bool Locked { 66 get { return this.locked; } 67 set { 68 if (InvokeRequired) { 69 Action<bool> action = delegate(bool b) { this.Locked = b; }; 70 Invoke(action, value); 71 } else { 72 if (value != locked) { 73 locked = value; 74 PropertyInfo prop = typeof(IContentView).GetProperty("Locked"); 75 PropagateStateChanges(this, typeof(IContentView), prop); 76 OnLockedChanged(); 77 OnChanged(); 78 } 79 } 80 } 81 } 82 public event EventHandler LockedChanged; 83 protected virtual void OnLockedChanged() { 84 if (InvokeRequired) 85 Invoke((MethodInvoker)OnLockedChanged); 86 else { 87 EventHandler handler = LockedChanged; 88 if (handler != null) 89 handler(this, EventArgs.Empty); 90 } 70 91 } 71 92
Note: See TracChangeset
for help on using the changeset viewer.