Example #1
0
        /// <summary>
        /// Shows 'panel'.  'parent' is the form making the call to show.
        /// If 'showAsDialog' is true, shows panel as the Dialog with 'parent'
        /// as the parent form. Else, just shows 'panel'. Also Pauses the parent
        /// scanner.  It will be Resumed when the panel is closed.
        /// </summary>
        /// <param name="parent">parent panel</param>
        /// <param name="panel">panel to show</param>
        /// <param name="showAsDialog">true to show as dialog</param>
        /// <returns>true on success</returns>
        private bool show(IPanel parent, IPanel panel, bool showAsDialog)
        {
            Form panelForm  = (Form)panel;
            Form parentForm = (Form)parent;

            Log.Debug("parentForm: " + ((parentForm != null) ? parentForm.Name : " null") +
                      ".  panel: " + panelForm.Name);

            panelForm.FormClosed += panel_FormClosed;

            _currentForm = panelForm;

            if (parent != null)
            {
                parent.OnPause();

                if (showAsDialog)
                {
                    Log.Debug("Showing Dialog" + panelForm.Name + " with parent " + parentForm.Name);

                    auditLogScannerEvent(panelForm, "show");
                    Windows.ShowDialog(parentForm, panelForm);
                }
                else
                {
                    Log.Debug("Showing " + panelForm.Name);

                    Log.Debug("parent is not null. Setting _currentPanel to " + panelForm.Name +
                              ", type: " + panelForm.GetType());
                    _currentPanel = panelForm;
                    auditLogScannerEvent(panelForm, "show");
                    Windows.Show(parentForm, panelForm);
                }
            }
            else
            {
                Log.Debug("showing " + panelForm.Name + ", parent is null");
                Log.Debug("parent is null. Setting _currentPanel to " + panelForm.Name +
                          ", type: " + panelForm.GetType());

                _currentPanel = panelForm;

                auditLogScannerEvent(panelForm, "show");
                if (showAsDialog)
                {
                    panelForm.ShowDialog();
                }
                else
                {
                    Windows.ShowForm(panelForm);
                }
            }

            return(true);
        }
Example #2
0
        /// <summary>
        /// 把某个页面入栈,  把某个页面显示在界面上
        /// </summary>
        public void PushPanel(UIPanelType panelType)
        {
            if (m_panelStack == null)
            {
                m_panelStack = new Stack <IPanel>();
            }

            //判断一下栈里面是否有页面
            if (m_panelStack.Count > 0)
            {
                IPanel topPanel = m_panelStack.Peek();
                topPanel.OnPause();
            }

            IPanel panel = GetPanel(panelType);

            panel.OnEnter();
            m_panelStack.Push(panel);
        }
Example #3
0
        /// <summary>
        /// Shows 'panel'.  'parent' is the form making the call to show.
        /// If 'showAsDialog' is true, shows panel as the Dialog with 'parent'
        /// as the parent form. Else, just shows 'panel'. Also Pauses the parent
        /// scanner.  It will be Resumed when the panel is closed.
        /// </summary>
        /// <param name="parent">parent panel</param>
        /// <param name="panel">panel to show</param>
        /// <param name="displayMode">how to display the panel</param>
        /// <returns>true on success</returns>
        private bool show(IPanel parent, IPanel panel, DisplayModeTypes displayMode)
        {
            Form panelForm  = (Form)panel;
            Form parentForm = (Form)parent;

            Log.Debug("parentForm: " + ((parentForm != null) ? parentForm.Name : " null") +
                      ".  panel: " + panelForm.Name);

            panelForm.FormClosed += panel_FormClosed;

            _currentForm = panelForm;

            PreShowPanel            = panel;
            PreShowPanelDisplayMode = displayMode;

            if (parent != null)
            {
                parent.OnPause();

                if (displayMode == DisplayModeTypes.Dialog)
                {
                    Log.Debug("Showing Dialog" + panelForm.Name + " with parent " + parentForm.Name);

                    auditLogScannerEvent(panelForm, "show");
                    Context.AppPanelManager.NotifyPanelPreShow(new PanelPreShowEventArg(panel, displayMode));
                    Windows.ShowDialog(parentForm, panelForm);
                }
                else
                {
                    Log.Debug("Showing " + panelForm.Name);

                    Log.Debug("parent is not null. Setting _currentPanel to " + panelForm.Name +
                              ", type: " + panelForm.GetType());
                    _currentPanel = panelForm;
                    auditLogScannerEvent(panelForm, "show");

                    Context.AppPanelManager.NotifyPanelPreShow(new PanelPreShowEventArg(panel, displayMode));

                    Windows.Show(parentForm, panelForm);
                }
            }
            else
            {
                Log.Debug("showing " + panelForm.Name + ", parent is null");
                Log.Debug("parent is null. Setting _currentPanel to " + panelForm.Name +
                          ", type: " + panelForm.GetType());

                _currentPanel = panelForm;

                auditLogScannerEvent(panelForm, "show");
                if (displayMode == DisplayModeTypes.Dialog)
                {
                    Context.AppPanelManager.NotifyPanelPreShow(new PanelPreShowEventArg(panel, displayMode));

                    panelForm.ShowDialog();
                }
                else
                {
                    Context.AppPanelManager.NotifyPanelPreShow(new PanelPreShowEventArg(panel, displayMode));

                    Windows.ShowForm(panelForm);
                }
            }

            PreShowPanel            = null;
            PreShowPanelDisplayMode = DisplayModeTypes.None;

            return(true);
        }
Example #4
0
        /// <summary>
        /// Shows 'panel'.  'parent' is the form making the call to show.
        /// If 'showAsDialog' is true, shows panel as the Dialog with 'parent'
        /// as the parent form. Else, just shows 'panel'. Also Pauses the parent
        /// scanner.  It will be Resumed when the panel is closed.
        /// </summary>
        /// <param name="parent">parent panel</param>
        /// <param name="panel">panel to show</param>
        /// <param name="showAsDialog">true to show as dialog</param>
        /// <returns>true on success</returns>
        private bool show(IPanel parent, IPanel panel, bool showAsDialog)
        {
            Form panelForm = (Form)panel;
            Form parentForm = (Form)parent;

            Log.Debug("parentForm: " + ((parentForm != null) ? parentForm.Name : " null") +
                        ".  panel: " + panelForm.Name);

            panelForm.FormClosed += panel_FormClosed;

            if (parent != null)
            {
                parent.OnPause();

                if (showAsDialog)
                {
                    Log.Debug("Showing Dialog" + panelForm.Name + " with parent " + parentForm.Name);
                    _currentForm = panelForm;
                    auditLogScannerEvent(panelForm, "show");
                    Windows.ShowDialog(parentForm, panelForm);
                }
                else
                {
                    Log.Debug("Showing " + panelForm.Name);
                    _currentForm = panelForm;
                    Log.Debug("parent is not null. Setting _currentPanel to " + panelForm.Name +
                                ", type: " + panelForm.GetType());
                    _currentPanel = panelForm;
                    auditLogScannerEvent(panelForm, "show");
                    Windows.Show(parentForm, panelForm);
                }
            }
            else
            {
                Log.Debug("showing " + panelForm.Name + ", parent is null");
                Log.Debug("parent is null. Setting _currentPanel to " + panelForm.Name +
                            ", type: " + panelForm.GetType());

                _currentPanel = panelForm;
                _currentForm = panelForm;
                auditLogScannerEvent(panelForm, "show");
                Windows.ShowForm(panelForm);
            }

            return true;
        }