- Timestamp:
- 12/10/09 10:11:28 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/ViewBase.cs
r2543 r2548 42 42 get { return myCaption; } 43 43 set { 44 if (value != myCaption) { 45 myCaption = value; 46 OnCaptionChanged(); 44 if (InvokeRequired) { 45 Action<string> action = delegate(string s) { this.Caption = s; }; 46 Invoke(action, value); 47 } else { 48 if (value != myCaption) { 49 myCaption = value; 50 OnCaptionChanged(); 51 } 47 52 } 48 53 } … … 57 62 public event EventHandler Changed; 58 63 protected virtual void OnChanged() { 59 if (Changed != null) 64 if (InvokeRequired) 65 Invoke((MethodInvoker)OnChanged); 66 else if (Changed != null) 60 67 Changed(this, new EventArgs()); 61 68 } 62 69 63 public virtual void OnClosing(object sender, CancelEventArgs e) { 70 public virtual void OnClosing(object sender, CancelEventArgs e) { 64 71 } 65 72 … … 67 74 internal void OnClosingHelper(object sender, FormClosingEventArgs e) { 68 75 if (this.closeReason != CloseReason.None) 69 this.OnClosing(sender, new FormClosingEventArgs(this.closeReason, e.Cancel));76 this.OnClosing(sender, new FormClosingEventArgs(this.closeReason, e.Cancel)); 70 77 else 71 78 this.OnClosing(sender, e); 72 79 73 80 this.closeReason = CloseReason.None; 74 81 } 75 82 76 public virtual void OnClosing(object sender, FormClosingEventArgs e) { 83 public virtual void OnClosing(object sender, FormClosingEventArgs e) { 77 84 } 78 85
Note: See TracChangeset
for help on using the changeset viewer.