コード例 #1
0
        public static void ShowControl <TEditorViewer, TSearchViewer>(ref TEditorViewer editorViewerToShow,
                                                                      ref TSearchViewer searchViewerToShow, Control parentControlToAttach, EditorContainerType editorContainerType, ViewerName viewerName,
                                                                      DB_CommonTransactionType commontransactionType,
                                                                      string headerTitle, AbstractViewerType viewerType, bool showAsPopup, bool showInFullScreen = false, bool isSearchPanelexpanded = false)
            where TEditorViewer : Control, new()
            where TSearchViewer : Control, new()
        {
            //1--- Initialize the BaseContainer
            //2--- Initialize the BaseSettingsEditorContainer / BaseSearchContainer
            //3--- Attach the BaseSettingsEditorContainer to BaseContainer
            //4--- Initialize the ViewerToShow
            //5--- Attach the ViewerToShow to BaseSettingsEditorContainer to Top Panel
            //6--- If the ViewerToShow has children Viewers, then >>
            //7--- If Yes :: Initialize Each Child in the ViewerToShow Children
            //8---			 Initialize The CommonTabControl
            //9---			 Create a Tab page for each viewerToShow child
            //10--			 Attach each Child to each suitable Tab page
            //11-- Attach the CommonTabControl to the BaseSettingsEditorContainer Bottom Panel
            //12-- Initialize the ViewerToShow MVCController
            //13-- Initialize the MVCController for Each Child in the ViewerToShow Children

            ParentControl         = parentControlToAttach;
            ViewerName            = viewerName;
            HeaderTitle           = headerTitle;
            CommontransactionType = commontransactionType;

            if (showAsPopup)
            {
                _popupForm = new PopupBaseForm();
                _popupForm.InitializePopupBaseForm(FormWindowState.Maximized, false, headerTitle, FormBorderStyle.None);
                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, viewerType, headerTitle, false, true, true, true);

            if (editorViewerToShow == null || editorViewerToShow.IsDisposed)
            {
                editorViewerToShow = new TEditorViewer();
            }
            if (searchViewerToShow == null || editorViewerToShow.IsDisposed)
            {
                searchViewerToShow = new TSearchViewer();
            }

            _baseContainer._editorViewerToShow = editorViewerToShow;

            EditorViewer = (IViewer)editorViewerToShow;
            SearchViewer = (IViewer)searchViewerToShow;

            if (EditorViewer != null)
            {
                EditorViewer.ClearControls();
                EditorViewer.FillControls();
            }

            if (SearchViewer != null)
            {
                SearchViewer.ClearControls();
                SearchViewer.FillControls();
            }

            switch (viewerType)
            {
            case AbstractViewerType.EditorViewer:
                MVCEditorController = GenerateEditorMVCController(EditorViewer, null, editorContainerType, viewerName, viewerType);
                break;

            case AbstractViewerType.SearchViewer:
                MVCSearchController = GenerateEditorMVCController(SearchViewer, null, editorContainerType, viewerName, viewerType);
                break;
            }

            switch (viewerType)
            {
            case AbstractViewerType.EditorViewer:
                if (_baseEditorContainer == null)
                {
                    return;
                }
                _baseEditorContainer._editorViewer         = (Control)EditorViewer;
                _baseEditorContainer.CommonTransactionType = CommontransactionType;
                if (BaseControllerObject != null)
                {
                    BaseControllerObject.PassMVCController(editorContainerType, viewerType);
                }
                _baseEditorContainer.InitializeBaseEditorContainer(true, false, false);
                break;

            case AbstractViewerType.SearchViewer:
                if (_baseSearchContainer == null)
                {
                    return;
                }
                _baseSearchContainer._searchViewer = (Control)SearchViewer;
                if (BaseControllerObject != null)
                {
                    BaseControllerObject.PassMVCController(editorContainerType, viewerType);
                }
                _baseSearchContainer.InitializeBaseSearchContainer(isSearchPanelexpanded);
                _baseSearchContainer.LoadGrid();
                break;
            }

            if (showAsPopup && _popupForm != null)
            {
                _popupForm.Show();
            }
        }
コード例 #2
0
        public static void ShowSearchControl <TSearchViewer>(ref TSearchViewer searchViewerToShow,
                                                             Control parentControlToAttach, ViewerName viewerName, DB_CommonTransactionType commontransactionType,
                                                             string headerTitle, bool showAsPopup, bool isSearchPanelexpanded = false)
            where TSearchViewer : Control, new()
        {
            ParentControl         = parentControlToAttach;
            ViewerName            = viewerName;
            HeaderTitle           = headerTitle;
            CommontransactionType = commontransactionType;

            if (showAsPopup)
            {
                _popupForm = new PopupBaseForm();
                _popupForm.InitializePopupBaseForm(FormWindowState.Maximized, false, headerTitle, FormBorderStyle.None);
                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.SearchViewer, headerTitle, true, false, true,
                                                   true);

            if (searchViewerToShow == null || searchViewerToShow.IsDisposed)
            {
                searchViewerToShow = new TSearchViewer();
            }

            SearchViewer = (IViewer)searchViewerToShow;

            if (SearchViewer != null)
            {
                SearchViewer.ClearControls();
                SearchViewer.FillControls();
            }

            MVCSearchController = GenerateSearchMVCController(SearchViewer, viewerName, AbstractViewerType.SearchViewer);

            if (_baseSearchContainer == null)
            {
                return;
            }
            _baseSearchContainer._searchViewer = (Control)SearchViewer;
            if (BaseControllerObject != null)
            {
                BaseControllerObject.PassMVCController(EditorContainerType.Settings, AbstractViewerType.SearchViewer);
            }
            _baseSearchContainer.InitializeBaseSearchContainer(isSearchPanelexpanded);
            _baseSearchContainer.LoadGrid();

            if (showAsPopup && _popupForm != null)
            {
                _popupForm.Show();
            }
        }