Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/10/09 10:11:28 (15 years ago)
Author:
mkommend
Message:

added ViewShown, ViewHidden and ViewClosed events in MainForm (ticket #771)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/ViewBase.cs

    r2543 r2548  
    4242      get { return myCaption; }
    4343      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          }
    4752        }
    4853      }
     
    5762    public event EventHandler Changed;
    5863    protected virtual void OnChanged() {
    59       if (Changed != null)
     64      if (InvokeRequired)
     65        Invoke((MethodInvoker)OnChanged);
     66      else if (Changed != null)
    6067        Changed(this, new EventArgs());
    6168    }
    6269
    63     public virtual void OnClosing(object sender, CancelEventArgs e) {     
     70    public virtual void OnClosing(object sender, CancelEventArgs e) {
    6471    }
    6572
     
    6774    internal void OnClosingHelper(object sender, FormClosingEventArgs e) {
    6875      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));
    7077      else
    7178        this.OnClosing(sender, e);
    72      
     79
    7380      this.closeReason = CloseReason.None;
    7481    }
    7582
    76     public virtual void OnClosing(object sender, FormClosingEventArgs e) {     
     83    public virtual void OnClosing(object sender, FormClosingEventArgs e) {
    7784    }
    7885
Note: See TracChangeset for help on using the changeset viewer.