/// <summary> /// Raises the Initialized event. /// </summary> /// <param name="e">An EventArgs that contains the event data.</param> protected override void OnInitialized(EventArgs e) { // Ignore call as view builder is already destructed if (!IsDisposed && (_viewBuilder != null)) { // Let base class generate standard event base.OnInitialized(e); // Ask the view builder to pull down current view _viewBuilder.Destruct(); // Ask the view builder to create new view based on new mode _viewBuilder = ViewBuilderBase.CreateViewBuilder(_mode); _viewBuilder.Construct(this, ViewManager, Redirector); if (LayoutOnInitialized) { // Force a layout now that initialization is complete OnLayout(new LayoutEventArgs(null, null)); } } }
private void CreateViewManager() { // Create the view manager instance ViewManager = new ViewManager(this, new ViewLayoutPageShow(this)); // Ask the view builder to create the view for the default mode _viewBuilder = ViewBuilderBase.CreateViewBuilder(_mode); _viewBuilder.Construct(this, ViewManager, Redirector); // We need to know when the layout cycle is starting/ending ViewManager.LayoutBefore += new EventHandler(OnViewManagerLayoutBefore); ViewManager.LayoutAfter += new EventHandler(OnViewManagerLayoutAfter); }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing) { // Remove any associated popups DismissPopups(); // If there anything to dispose? if (_viewBuilder != null) { // Pull down the current view builder hierarchy _viewBuilder.Destruct(); _viewBuilder = null; } // Dispose of the cached context menu if (_kcm != null) { _kcm.Close(); _kcm.Dispose(); _kcm = null; } // Dispose of the buttons instances that have dispose interfaces _button.CloseButton.Dispose(); _button.ContextButton.Dispose(); _button.NextButton.Dispose(); _button.PreviousButton.Dispose(); } base.Dispose(disposing); }