private void PopInner() { // Pop the foremost control Control current = Screens.Pop(); // Deactivate the control ILinkedControl linkedControl = current as ILinkedControl; linkedControl?.Deactivate(Engine); current.Enabled = false; Controls.Remove(current); // re-enable the current control, if any if (Screens.Count > 0) { Control prev = Screens.Peek(); if (prev != null) { prev.Enabled = true; prev.Visible = true; ILinkedControl prevLinkedControl = prev as ILinkedControl; prevLinkedControl?.Activate(Engine, current); } } current.Dispose(); }
private void PushInner(Control control) { // disable the current control if (Screens.Count > 0) { Control prev = Screens.Peek(); if (prev != null) { prev.Enabled = false; if (control.Dock == DockStyle.Fill) { prev.Visible = false; } if (prev is ILinkedControl prevLinkedControl) { prevLinkedControl.Deactivate(Engine); } } } // link the control to our controllers ILinkedControl linkedControl = control as ILinkedControl; linkedControl?.Link(Engine); linkedControl?.Link(this); // Push in the new control Screens.Push(control); Controls.Add(control); control.BringToFront(); control.Enabled = true; linkedControl?.HandleFormResize(Size); CenterControl(control); // Activate the control linkedControl?.Activate(Engine, null); }