private void btnFullScreen_Click(object sender, System.EventArgs e)
        {
            PopupBaseForm _popupForm = new PopupBaseForm();

            _popupForm.InitializePopupBaseForm(FormWindowState.Maximized, false, HeaderTitle);
            CommonViewsActions.ShowUserControl(ref _baseContainer, _popupForm);
        }
Esempio n. 2
0
 public static DialogResult ShowAsPopup(Control controlToAttach, Control parentControl,
                                        FormBorderStyle formBorder      = FormBorderStyle.None, object colorTouse = null,
                                        FormWindowState formWindowState = FormWindowState.Normal, bool topMost    = true,
                                        string headerTitle = "")
 {
     using (PopupBaseForm popupBaseForm = new PopupBaseForm())
     {
         popupBaseForm.LookAndFeel.SetSkinStyle(ApplicationStaticConfiguration.SkinName);
         UserLookAndFeel.Default.SetSkinStyle(ApplicationStaticConfiguration.SkinName);
         UserLookAndFeel.Default.SetSkinStyle(ApplicationStaticConfiguration.SkinName);
         if (ApplicationStaticConfiguration.SkinColor != null)
         {
             popupBaseForm.LookAndFeel.SkinMaskColor = Color.FromArgb(((Color)ApplicationStaticConfiguration.SkinColor).R,
                                                                      ((Color)ApplicationStaticConfiguration.SkinColor).G,
                                                                      ((Color)ApplicationStaticConfiguration.SkinColor).B);
         }
         popupBaseForm.Controls.Add(controlToAttach);
         popupBaseForm.FormBorderStyle = formBorder;
         popupBaseForm.Initialize(controlToAttach, parentControl, colorTouse);
         DialogResult dialogResult = popupBaseForm.ShowDialog();
         popupBaseForm.Controls.Remove(controlToAttach);
         controlToAttach.Dispose();
         return(dialogResult);
     }
 }
Esempio n. 3
0
        public static DialogResult ShowAsPopup(ref Control controlToAttach, FormWindowState formWindowState, bool topMost,
                                               string headerTitle)
        {
            XtraForm form = new PopupBaseForm();

            CommonViewsActions.ShowUserControl(ref controlToAttach, form);
            return(form.ShowDialog());
        }
        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();
            }
        }
        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();
            }
        }
        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();
            }
        }