public static void ShowEditorControl <TEditorViewer>(ref TEditorViewer editorViewerToShow, Control parentControlToAttach, object objectToPassToViewer, IDBCommon dbObjectToLoad, EditorContainerType editorContainerType, ViewerName viewerName, DB_CommonTransactionType commontransactionType, string headerTitle, bool showAsPopup, bool showTopMost = false, bool showInFullScreen = true) where TEditorViewer : Control, new() { ParentControl = parentControlToAttach; ViewerName = viewerName; HeaderTitle = headerTitle; CommontransactionType = commontransactionType; switch (editorContainerType) { case EditorContainerType.Settings: if (showAsPopup) { _popupForm = new PopupBaseForm(); _popupForm.InitializePopupBaseForm(FormWindowState.Maximized, false, headerTitle); CommonViewsActions.ShowUserControl(ref _baseContainer, _popupForm, true); } else { CommonViewsActions.ShowUserControl(ref _baseContainer, parentControlToAttach, true); } if (_baseContainer == null) { return; } if (!_baseContainer.IsBaseControllerInitialized) { BaseControllerObject = new BaseController <TEntity>(); _baseContainer.InitializeBaseViewerController(BaseControllerObject); } _baseContainer.InitializeBaseContainer(ViewerName, AbstractViewerType.EditorViewer, headerTitle, false, true, true, true); break; case EditorContainerType.Regular: if (showAsPopup) { _popupForm = new PopupBaseForm(); if (showInFullScreen) { _popupForm.InitializePopupBaseForm(FormWindowState.Maximized, false, headerTitle, FormBorderStyle.None); } else { _popupForm.InitializePopupBaseForm(FormWindowState.Normal, false, headerTitle, FormBorderStyle.None); } CommonViewsActions.ShowUserControl(ref BasicEditorViewerContainer, _popupForm, true); } if (BasicEditorViewerContainer == null) { return; } BasicEditorViewerContainer.SetHeader(headerTitle, commontransactionType); if (!BasicEditorViewerContainer.IsBaseControllerInitialized) { BaseControllerObject = new BaseController <TEntity>(); } BasicEditorViewerContainer.InitializeBaseEditorContainer(ViewerName, HeaderTitle); BaseControllerObject.PassBaseController(BasicEditorViewerContainer); break; } if (editorViewerToShow == null || editorViewerToShow.IsDisposed) { editorViewerToShow = new TEditorViewer(); } EditorViewer = (IViewer)editorViewerToShow; if (EditorViewer != null) { if (objectToPassToViewer != null && EditorViewer is IViewerDataRelated) { ((IViewerDataRelated)EditorViewer).ViewerDataRelated = objectToPassToViewer; } EditorViewer.ClearControls(); EditorViewer.FillControls(); } MVCEditorController = GenerateEditorMVCController(EditorViewer, dbObjectToLoad, editorContainerType, viewerName, AbstractViewerType.EditorViewer); switch (editorContainerType) { case EditorContainerType.Settings: if (_baseEditorContainer == null) { return; } _baseEditorContainer._editorViewer = (Control)EditorViewer; _baseEditorContainer.CommonTransactionType = CommontransactionType; break; case EditorContainerType.Regular: BaseEditorViewerContainer <TEntity> ._editorViewer = (Control)EditorViewer; BasicEditorViewerContainer.CommonTransactionType = CommontransactionType; break; } if (BaseControllerObject != null) { BaseControllerObject.PassMVCController(editorContainerType, AbstractViewerType.EditorViewer); } switch (editorContainerType) { case EditorContainerType.Settings: _baseEditorContainer.InitializeBaseEditorContainer(true, false, false); break; case EditorContainerType.Regular: BasicEditorViewerContainer.InitializeBaseEditorContainer(); break; } if (showAsPopup && _popupForm != null) { _popupForm.Initialize((Control)EditorViewer, BasicEditorViewerContainer); _popupForm.TopMost = showTopMost; _popupForm.BringToFront(); _popupForm.ShowDialog(); } }