Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3301


Ignore:
Timestamp:
04/11/10 19:32:52 (15 years ago)
Author:
mkommend
Message:

implemented fix for ticket #966

Location:
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2
Files:
2 edited

Legend:

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

    r2963 r3301  
    3131using HeuristicLab.PluginInfrastructure;
    3232using System.Collections;
     33using WeifenLuo.WinFormsUI.Docking;
    3334
    3435namespace HeuristicLab.MainForm.WindowsForms {
     
    162163      this.ActiveView = GetView((Form)sender);
    163164    }
     165
     166    protected override void OnFormClosing(FormClosingEventArgs e) {
     167      foreach (KeyValuePair<IView,Form > pair in this.views) {
     168        DockForm dockForm = pair.Value as DockForm;
     169        View view = pair.Key as View;
     170        if (view != null && dockForm != null && dockForm.DockState != DockState.Document) {
     171          view.CloseReason = CloseReason.ApplicationExitCall;
     172          view.OnClosingHelper(dockForm, e);
     173        }
     174      }
     175      base.OnFormClosing(e);
     176    }
     177
     178    protected override void OnFormClosed(FormClosedEventArgs e) {
     179      foreach (KeyValuePair<IView, Form> pair in this.views.ToList()) {
     180        DockForm dockForm = pair.Value as DockForm;
     181        View view = pair.Key as View;
     182        if (view != null && dockForm != null && dockForm.DockState != DockState.Document) {
     183          view.CloseReason = CloseReason.ApplicationExitCall;
     184          view.OnClosedHelper(dockForm, e);
     185          dockForm.Close();
     186        }
     187      }
     188      base.OnFormClosed(e);
     189    }
    164190    #endregion
    165191
     
    188214          form.Activated += new EventHandler(FormActivated);
    189215          form.FormClosed += new FormClosedEventHandler(ChildFormClosed);
    190          
     216
    191217        }
    192218        this.Show(view, firstTimeShown);
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/View.cs

    r3177 r3301  
    119119    }
    120120
    121     private void OnClosingHelper(object sender, FormClosingEventArgs e) {
     121    internal void OnClosingHelper(object sender, FormClosingEventArgs e) {
     122      FormClosingEventArgs eventArgs = new FormClosingEventArgs(this.closeReason, e.Cancel);
    122123      if (this.closeReason != CloseReason.None)
    123         this.OnClosing(new FormClosingEventArgs(this.closeReason, e.Cancel));
     124        this.OnClosing(eventArgs);
    124125      else
    125126        this.OnClosing(e);
    126127
     128      if (eventArgs.Cancel != e.Cancel)
     129        e.Cancel = eventArgs.Cancel;
    127130      this.closeReason = CloseReason.None;
    128131    }
     
    131134    }
    132135
    133     private void OnClosedHelper(object sender, FormClosedEventArgs e) {
     136    internal void OnClosedHelper(object sender, FormClosedEventArgs e) {
    134137      if (this.closeReason != CloseReason.None)
    135138        this.OnClosed(new FormClosedEventArgs(this.closeReason));
Note: See TracChangeset for help on using the changeset viewer.