Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2266 for trunk


Ignore:
Timestamp:
08/09/09 15:55:56 (15 years ago)
Author:
mkommend
Message:

added ability to cancel form close;
removed mistakenly commited csproj.user file (ticket #716)

Location:
trunk/sources
Files:
1 deleted
5 edited

Legend:

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

    r2254 r2266  
    2121      this.OnStateChanged();
    2222    }
     23
     24    public override void FormClosing(object sender, FormClosingEventArgs e) {
     25      if (DialogResult.Yes != MessageBox.Show(
     26             "Recent changes have not been saved. Close the editor anyway?", "Close editor?",
     27              MessageBoxButtons.YesNo, MessageBoxIcon.Question,
     28              MessageBoxDefaultButton.Button2)) {
     29
     30        e.Cancel = true;
     31
     32      }
     33    }
    2334  }
    2435}
  • trunk/sources/HeuristicLab.MainForm/3.2/DockingMainForm.cs

    r2256 r2266  
    4848      else {
    4949        base.ShowView(view);
    50         DockContent content = new DockForm(view);
    51         content.Activated += new EventHandler(DockFormActivated);
    52         content.FormClosing += new FormClosingEventHandler(DockFormClosing);
     50        DockContent dockForm = new DockForm(view);
     51        dockForm.Activated += new EventHandler(DockFormActivated);
     52        dockForm.FormClosing += new FormClosingEventHandler(view.FormClosing);
     53        dockForm.FormClosed += new FormClosedEventHandler(DockFormClosed);
    5354        foreach (IToolStripItem item in ViewChangedToolStripItems)
    5455          view.StateChanged += new EventHandler(item.ViewChanged);
    55         content.Show(dockPanel);
     56        dockForm.Show(dockPanel);
    5657      }
    5758    }
    5859
    59     private void DockFormClosing(object sender, FormClosingEventArgs e) {
     60    private void DockFormClosed(object sender, FormClosedEventArgs e) {
    6061      DockForm dockForm = (DockForm)sender;
    6162      views.Remove(dockForm.View);
     
    6364        ActiveView = null;
    6465      dockForm.Activated -= new EventHandler(DockFormActivated);
    65       dockForm.FormClosing -= new FormClosingEventHandler(DockFormClosing);
     66      dockForm.FormClosing -= new FormClosingEventHandler(dockForm.View.FormClosing);
     67      dockForm.FormClosed -= new FormClosedEventHandler(DockFormClosed);
    6668      foreach (IToolStripItem item in ViewChangedToolStripItems)
    6769        dockForm.View.StateChanged -= new EventHandler(item.ViewChanged);
  • trunk/sources/HeuristicLab.MainForm/3.2/Interfaces/IView.cs

    r2254 r2266  
    2323using System.Collections.Generic;
    2424using System.Text;
     25using System.Windows.Forms;
    2526
    2627namespace HeuristicLab.MainForm {
     
    3031    event EventHandler StateChanged;
    3132    IMainForm MainForm { get; set; }
     33    void FormClosing(object sender, FormClosingEventArgs e);
    3234  }
    3335}
  • trunk/sources/HeuristicLab.MainForm/3.2/MultipleDocumentMainForm.cs

    r2256 r2266  
    2222        MultipleDocumentForm form = new MultipleDocumentForm(view);
    2323        form.Activated += new EventHandler(MultipleDocumentFormActivated);
    24         form.FormClosing += new FormClosingEventHandler(MultipleDocumentFormClosing);
     24        form.FormClosing += new FormClosingEventHandler(view.FormClosing);
     25        form.FormClosed += new FormClosedEventHandler(MultipleDocumentFormClosed);
    2526        form.MdiParent = this;
    2627        foreach (IToolStripItem item in ViewChangedToolStripItems)
     
    3536    }
    3637
    37     private void MultipleDocumentFormClosing(object sender, FormClosingEventArgs e) {
     38    private void MultipleDocumentFormClosed(object sender, FormClosedEventArgs e) {
    3839      MultipleDocumentForm form = (MultipleDocumentForm)sender;
    3940      views.Remove(form.View);
     
    4142        ActiveView = null;
    4243      form.Activated -= new EventHandler(MultipleDocumentFormActivated);
    43       form.FormClosing -= new FormClosingEventHandler(MultipleDocumentFormClosing);
     44      form.FormClosing -= new FormClosingEventHandler(form.View.FormClosing);
     45      form.FormClosed -= new FormClosedEventHandler(MultipleDocumentFormClosed);
    4446      foreach (IToolStripItem item in ViewChangedToolStripItems)
    4547        form.View.StateChanged -= new EventHandler(item.ViewChanged);
  • trunk/sources/HeuristicLab.MainForm/3.2/ViewBase.cs

    r2254 r2266  
    6868      set { this.mainForm = value; }
    6969    }
     70
     71    public virtual void FormClosing(object sender, FormClosingEventArgs e) {
     72    }
    7073  }
    7174}
Note: See TracChangeset for help on using the changeset viewer.