AreEqual() public static method

Checks if two scanners are the same
public static AreEqual ( String panel1, String panel2 ) : bool
panel1 String first scanner
panel2 String scanner to compare
return bool
示例#1
0
        /// <summary>
        /// Event handler for request to display a scanner. The
        /// arg parameter contains information about which scanner
        /// to display
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="arg">event arg</param>
        public void AppAgent_EvtPanelRequest(object sender, PanelRequestEventArgs arg)
        {
            Log.Debug("A request came in for panel " + arg.PanelClass + ".  NewWindow is " +
                      arg.MonitorInfo.IsNewWindow);

            if (_currentForm != null)
            {
                Log.Debug("_currentForm is " + _currentForm.Name + ", type: " + _currentForm.GetType() +
                          ", IsModal: " + _currentForm.Modal);

                Form owner = _currentForm.Owner;
                if (owner != null)
                {
                    Log.Debug("owner is : " + owner.Name + ", type: " + owner.GetType() +
                              ", is owner ipanel? " + (_currentForm.Owner is IPanel));
                }
                else
                {
                    Log.Debug("_currentForm.Owner is null");
                }

                // if a modal dialog is currently open, don't honor the request.
                // the modal dialog has to be closed first.
                if (arg.TargetPanel == null || arg.TargetPanel != _currentForm)
                {
                    if (_currentForm.Modal || (_currentForm.Owner != null && _currentForm.Owner.Modal))
                    {
                        Log.Debug("A modal dialog is open. Will not honor panel request");
                        return;
                    }
                }
            }

            // if no panel type, use the alphabet scanner as the
            String requestedPanelClass = arg.PanelClass;

            if (PanelConfigMap.AreEqual(arg.PanelClass, PanelClasses.None))
            {
                requestedPanelClass = PanelClasses.Alphabet;
            }

            IScannerPanel currentScanner = _currentPanel as IScannerPanel;

            if (arg.MonitorInfo.IsNewWindow)
            {
                Log.Debug("This is a new window. winHandle: " + arg.MonitorInfo.FgHwnd);

                if (currentScanner != null)
                {
                    Log.Debug("currentpanel: " + currentScanner.PanelClass + ", requested:  " + requestedPanelClass);
                }
                else
                {
                    Log.Debug("_currentPanel is null or not IScannerPanel. Activate alphabet scanner");
                    requestedPanelClass = PanelClasses.Alphabet;
                }

                // if the current scanner is the same as the requested one, just show it
                if (currentScanner != null && PanelConfigMap.AreEqual(currentScanner.PanelClass, requestedPanelClass) &&
                    _currentPanel.Owner == null)
                {
                    Log.Debug("Current panel is already " + requestedPanelClass + ", calling Show()");
                    _currentPanel.TopMost = true;

                    if (_currentPanel is MenuPanelBase)
                    {
                        (_currentPanel as MenuPanelBase).SetTitle(arg.Title);
                    }
                    Show(null, (IPanel)_currentPanel);
                }
                else
                {
                    // check with the agent if it is OK to switch panels.
                    if ((currentScanner == null) || currentScanner.OnQueryPanelChange(arg))
                    {
                        switchCurrentPanel(arg);
                    }
                }
            }
            else
            {
                if (currentScanner == null)
                {
                    Log.Debug("_currentPanel is null. returning");
                    return;
                }

                Log.Debug("Not a new window.  _currentPanel is " + currentScanner.PanelClass +
                          " requested panel is " + requestedPanelClass);

                // if the current panel is not the same as the requested one, query the
                // agent if it is OK to switch and then do the switch
                if (!PanelConfigMap.AreEqual(currentScanner.PanelClass, requestedPanelClass) &&
                    currentScanner.OnQueryPanelChange(arg))
                {
                    switchCurrentPanel(arg);
                }
                else
                {
                    Log.Debug("Will not switch panels.  Current: " + currentScanner.PanelClass +
                              ", requested: " + requestedPanelClass);

                    if (currentScanner is MenuPanelBase)
                    {
                        (currentScanner as MenuPanelBase).SetTitle(arg.Title);
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        /// A scanner closed. If this panel has child windows (scanners)
        /// close them as well. If there is a parent, Resume it.
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="e">event args</param>
        private void panel_FormClosed(object sender, FormClosedEventArgs e)
        {
            var form = (Form)sender;

            Log.Debug("Enter (" + form.Name + ")");

            IPanel panel = form as IPanel;

            if (panel.SyncObj.Status == SyncLock.StatusValues.Closed)
            {
                Log.Debug("Form is already closed. Returning " + form.Name);
                return;
            }

            Log.Debug("Setting CLOSED for " + form.Name);
            (form as IPanel).SyncObj.Status = SyncLock.StatusValues.Closed;

            form.FormClosed -= panel_FormClosed;

            Form parentForm = form.Owner;

            Form[] array = form.OwnedForms;

            auditLogScannerEvent(form, "close");

            Log.Debug("number of owned forms: " + array.Length);

            // close all the forms this panel owns
            while (true)
            {
                Form[] ownedForms = form.OwnedForms;
                if (ownedForms.Length == 0)
                {
                    Log.Debug(form.Name + ": No more owned forms. Breaking");
                    break;
                }

                Log.Debug("Removing owned form from list. " + ownedForms[0].Name);
                form.RemoveOwnedForm(ownedForms[0]);
                Log.Debug("Calling close on " + ownedForms[0].Name);
                Windows.CloseForm(ownedForms[0]);
            }

            Log.Debug("form Name: " + form.Name + ", type: " + form.GetType());

            // Exit the application if instructed to do so.
            if (Context.AppQuit)
            {
                if (!_appCloseNotifed)
                {
                    _appCloseNotifed = true;

                    Context.AppPanelManager.NotifyQuitApplication();

                    Application.ExitThread();
                }
            }
            else if (parentForm != null)
            {
                // Resume the parent if it is prudent to do so.

                Log.Debug("parent Form is " + parentForm.Name);

                IPanel parentPanel = (IPanel)parentForm;

                if (parentPanel.SyncObj.IsClosing())
                {
                    Log.Debug("*** Parent is closing. Will not call OnResume");
                }
                else
                {
                    Log.Debug("parentform is not closing. Setting _currentPanel to " + parentForm.Name +
                              ", type: " + parentForm.GetType());

                    _currentPanel = parentForm;
                    _currentForm  = parentForm;

                    Log.Debug("Calling OnResume on parentForm " + parentForm.Name);

                    parentPanel.OnResume();

                    //_currentPanel = parentForm;  // moved up
                    //_currentForm = parentForm;  // moved up

                    auditLogScannerEvent(parentForm, "show");
                }
            }
            else
            {
                Log.Debug("parentform is null");
                _currentPanel = null;
                _currentForm  = null;
            }

            var panelClass = (form is IScannerPanel) ? ((IScannerPanel)form).PanelClass : PanelClasses.None;

            if (!PanelConfigMap.AreEqual(panelClass, PanelClasses.None))
            {
                Log.Debug("Calling AppAgentMgr.OnPanelClosed for " + panelClass);
                Context.AppAgentMgr.OnPanelClosed(panelClass);
            }

            if (EvtScannerClosed != null)
            {
                Log.Debug("Calling evetscannerclosed for " + form.Name);
                EvtScannerClosed(this, new ScannerCloseEventArg(form as IPanel));
            }
            else
            {
                Log.Debug("EvtScannerClosed is NULL");
            }

            // (form as IPanel).SyncObj.Status = SyncLock.StatusValues.Closed;  // moved this up

            Log.Debug("Exit " + form.Name);
        }
示例#3
0
        /// <summary>
        /// A scanner closed. If this panel has child windows (scanners)
        /// close them as well. If there is a parent, Resume it.
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="e">event args</param>
        private void panel_FormClosed(object sender, FormClosedEventArgs e)
        {
            var form = (Form)sender;

            Log.Debug("Enter (" + form.Name + ")");

            IPanel panel = form as IPanel;

            if (panel.SyncObj.Status == SyncLock.StatusValues.Closed)
            {
                Log.Debug("Form is already closed. Returning " + form.Name);
                return;
            }

            form.FormClosed -= panel_FormClosed;

            Form   parentForm = form.Owner;
            String panelClass = PanelClasses.None;

            Form[] array = form.OwnedForms;

            auditLogScannerEvent(form, "close");

            Log.Debug("number of owned forms: " + array.Length);

            // close all the forms this panel owns
            while (true)
            {
                Form[] a = form.OwnedForms;
                if (a.Length == 0)
                {
                    Log.Debug(form.Name + ": No more owned forms. Breaking");
                    break;
                }

                Log.Debug("Removing owned form from list. " + a[0].Name);
                form.RemoveOwnedForm(a[0]);
                Log.Debug("Calling close on " + a[0].Name);
                Windows.CloseForm(a[0]);
            }

            Log.Debug("form Name: " + form.Name + ", type: " + form.GetType());

            if (_currentPanel is IScannerPanel)
            {
                panelClass = ((IScannerPanel)_currentPanel).PanelClass;
            }

            // Exit the application if instructed to do so.
            if (Context.AppQuit)
            {
                Application.ExitThread();
            }
            else if (parentForm != null)
            {
                // Resume the parent if it is prudent to do so.

                Log.Debug("parent Form is " + parentForm.Name);

                IPanel parentPanel = (IPanel)parentForm;

                if (parentPanel.SyncObj.IsClosing())
                {
                    Log.Debug("*** Parent is closing. Will not call OnResume");
                }
                else
                {
                    Log.Debug("Calling OnResume on parentForm " + parentForm.Name);
                    parentPanel.OnResume();
                    Log.Debug("parentform is not null. Setting _currentPanel to " + parentForm.Name +
                              ", type: " + parentForm.GetType());

                    _currentPanel = parentForm;
                    _currentForm  = parentForm;

                    auditLogScannerEvent(parentForm, "show");
                }
            }
            else
            {
                Log.Debug("parentform is null");
            }

            // Inform the AgentManager that a scanner just closed
            if (!PanelConfigMap.AreEqual(panelClass, PanelClasses.None))
            {
                Log.Debug("Calling OnPanelClosed for " + panelClass);
                Context.AppAgentMgr.OnPanelClosed(panelClass);
            }

            Log.Debug("Setting CLOSED for " + form.Name);

            (form as IPanel).SyncObj.Status = SyncLock.StatusValues.Closed;

            Log.Debug("Exit " + form.Name);
        }