Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2723 for trunk/sources


Ignore:
Timestamp:
01/29/10 16:26:43 (14 years ago)
Author:
mkommend
Message:

corrected MainForm.ActiveViewChanged event and View.IsShown property (ticket #857)

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

Legend:

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

    r2707 r2723  
    8686      get { return this.activeView; }
    8787      protected set {
    88         if (this.activeView != value) {
     88        if (this.activeView != value && (value != null || this.views.Keys.All(v => !v.IsShown))) {
    8989          if (InvokeRequired) {
    9090            Action<IView> action = delegate(IView activeView) { this.ActiveView = activeView; };
     
    214214        if (this.views.ContainsKey(view)) {
    215215          this.Hide(view);
     216          if (this.activeView == view && views.All(v => !view.IsShown))
     217            this.ActiveView = null;
    216218          this.OnViewHidden(view);
    217219        }
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/View.cs

    r2711 r2723  
    5858    public bool IsShown {
    5959      get { return this.isShown; }
     60      private set { this.isShown = value; }
    6061    }
    6162
     
    6465      bool firstTimeShown = mainform.GetForm(this) == null;
    6566
    66       MainFormManager.GetMainForm<MainForm>().ShowView(this,firstTimeShown);
     67      this.IsShown = true;
     68      mainform.ShowView(this, firstTimeShown);
    6769      if (firstTimeShown) {
    6870        Form form = mainform.GetForm(this);
     
    7072        form.FormClosing += new FormClosingEventHandler(OnClosingHelper);
    7173      }
    72       this.OnShown(new ViewShownEventArgs(this,firstTimeShown));
     74      this.OnShown(new ViewShownEventArgs(this, firstTimeShown));
    7375    }
    7476
     
    7678      MainForm mainform = MainFormManager.GetMainForm<MainForm>();
    7779      Form form = mainform.GetForm(this);
    78       if (form != null)
     80      if (form != null) {
     81        this.IsShown = false;
    7982        mainform.CloseView(this);
     83      }
    8084    }
    8185
     
    8387      MainForm mainform = MainFormManager.GetMainForm<MainForm>();
    8488      Form form = mainform.GetForm(this);
    85       if (form != null)
    86         mainform.CloseView(this,closeReason);
     89      if (form != null) {
     90        this.IsShown = false;
     91        mainform.CloseView(this, closeReason);
     92      }
    8793    }
    8894
    8995    public new void Hide() {
     96      this.IsShown = false;
    9097      MainFormManager.GetMainForm<MainForm>().HideView(this);
    9198      this.OnHidden(new EventArgs());
     
    107114
    108115    protected virtual void OnShown(ViewShownEventArgs e) {
    109       this.isShown = true;
    110116    }
    111117
    112118    protected virtual void OnHidden(EventArgs e) {
    113       this.isShown = false;
    114119    }
    115120
     
    140145
    141146    protected virtual void OnClosed(FormClosedEventArgs e) {
    142       this.isShown = false;
    143147    }
    144148
Note: See TracChangeset for help on using the changeset viewer.