Ejemplo n.º 1
0
        /// <summary>
        /// Runs the specified command.  The command can be
        /// prefixed by 'agent.' in which case the application
        /// agent is invoked to run the command.  If the command
        /// is prefixed with 'scanner.' the scanner is invoked to run
        /// the command. If there is no prefix, then the scanner is
        /// invoked first, if it doesn't handle it, then the application
        /// agent is invoked.
        /// </summary>
        /// <param name="command"></param>
        private void runCommand(String command)
        {
            bool handled = false;

            if (command[0] == '@')
            {
                command = command.Substring(1);
            }

            Log.Debug("Calling scanner common runcomand with " + command);
            ScannerForm.Invoke(new MethodInvoker(delegate
            {
                String[] parts = command.Split('.');
                if (parts.Length > 1)
                {
                    if (String.Compare(parts[0], "agent", true) == 0)
                    {
                        runCommandAgent(parts[1], ref handled);
                    }
                    else if (String.Compare(parts[0], "scanner", true) == 0)
                    {
                        runCommandScanner(parts[1], ref handled);
                    }
                }
                else
                {
                    runCommandScanner(command, ref handled);
                    if (!handled)
                    {
                        runCommandAgent(command, ref handled);
                    }
                }
            }));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Hides the talk window
 /// </summary>
 public void HideTalkWindow()
 {
     if (Context.AppTalkWindowManager.IsTalkWindowActive)
     {
         ScannerForm.Invoke(new MethodInvoker(() => Context.AppTalkWindowManager.ToggleTalkWindow()));
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// The interpreter invoked a "close" command.  Close
 /// the scanner
 /// </summary>
 /// <param name="sender">event sender</param>
 /// <param name="e">event args</param>
 private void Interpreter_EvtCloseNotify(object sender, InterpreterEventArgs e)
 {
     ScannerForm.Invoke(new MethodInvoker(delegate
     {
         Log.Debug("Calling close for " + ScannerForm.Name);
         ScannerForm.Close();
     }));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Call this in the OnPause hander in the form.
        /// </summary>
        public void OnPause()
        {
            if (_isPaused)
            {
                return;
            }

            _isPaused = true;

            try
            {
                if (!DialogMode)
                {
                    if (!KeepTalkWindowActive)
                    {
                        if (!Context.AppTalkWindowManager.IsPaused)
                        {
                            ScannerForm.Invoke(new MethodInvoker(delegate
                            {
                                Context.AppTalkWindowManager.Pause();

                                _talkWindowPaused = true;
                            }));
                        }
                        else
                        {
                            _talkWindowPaused = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Debug(ex.ToString());
            }
        }