예제 #1
0
        /// <summary>
        /// Gets a list of active windows sorted on the
        /// indcated sort order
        /// </summary>
        /// <param name="order">sort order</param>
        /// <returns>sorted list</returns>
        private List <EnumWindows.WindowInfo> getWindowList(SortOrder order)
        {
            var processName = FilterByProcessName.Trim();

            var windowList = EnumWindows.Enumerate();

            if (!String.IsNullOrEmpty(processName))
            {
                var filteredList = new List <EnumWindows.WindowInfo>();

                for (int ii = 0; ii < windowList.Count; ii++)
                {
                    var process = WindowActivityMonitor.GetProcessForWindow(windowList[ii].Handle);
                    if (String.Compare(process.ProcessName, FilterByProcessName, true) == 0)
                    {
                        filteredList.Add(windowList[ii]);
                    }
                }

                windowList = filteredList;
            }

            var sortedList = sortWindowList(windowList, order);

            if (String.IsNullOrEmpty(processName))
            {
                IntPtr desktopHWnd = User32Interop.GetDesktopWindow();
                if (desktopHWnd != null)
                {
                    sortedList.Insert(0, new EnumWindows.WindowInfo(desktopHWnd, R.GetString("ShowDesktop")));
                }
            }

            return(sortedList);
        }
예제 #2
0
        /// <summary>
        /// Tabs to the previous field if inside an email. If
        /// the user is browsing emails, goes to the previous email
        /// </summary>
        private void handleCmdEmailPreviousSimple()
        {
            var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();

            if (isMailComposeWindow(monitorInfo.FocusedElement) ||
                isMailComposeMessageWindow(monitorInfo.FocusedElement))
            {
                if (isToField(monitorInfo.FocusedElement) ||
                    isSubjectField(monitorInfo.FocusedElement) ||
                    isCCField(monitorInfo.FocusedElement) ||
                    isBCCField(monitorInfo.FocusedElement) ||
                    isMessageBodyField(monitorInfo.FocusedElement) ||
                    isAttachmentField(monitorInfo.FocusedElement))
                {
                    AgentManager.Instance.Keyboard.ExtendedKeyDown(Keys.RShiftKey);
                    Thread.Sleep(10);
                    AgentManager.Instance.Keyboard.Send(Keys.Tab);
                    Thread.Sleep(10);
                    AgentManager.Instance.Keyboard.ExtendedKeyUp(Keys.RShiftKey);
                }
            }
            else if (isBrowseEmailWindow(monitorInfo.FocusedElement))
            {
                AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.Up);
            }
            else
            {
                AgentManager.Instance.Keyboard.Send(Keys.Up);
            }
        }
예제 #3
0
        public void OnLoad(bool resetTalkWindowPosition = true)
        {
            PositionSizeController.OnLoad();

            TextController.OnLoad();

            PositionSizeController.ScaleForm();
            Windows.SetWindowPosition(ScannerForm, Context.AppWindowPosition);

            if (Context.ShowTalkWindowOnStartup)
            {
                Context.AppTalkWindowManager.ToggleTalkWindow();
                Context.ShowTalkWindowOnStartup = false;
            }

            if (resetTalkWindowPosition)
            {
                Context.AppTalkWindowManager.SetTalkWindowPosition(ScannerForm);
            }

            StatusBarController.UpdateStatusBar();

            subscribeToEvents();

            SetWidgetEnabledStates(WindowActivityMonitor.GetForegroundWindowInfo());
        }
예제 #4
0
        /// <summary>
        /// Executes the command
        /// </summary>
        /// <param name="handled">set to true if the command was handled</param>
        /// <returns>true on success</returns>
        public override bool Execute(ref bool handled)
        {
            bool retVal = true;

            handled = true;

            Form form = Dispatcher.Scanner.Form;

            form.Invoke(new MethodInvoker(delegate()
            {
                IApplicationAgent switchWindowsAgent = Context.AppAgentMgr.GetAgentByName("Switch Windows Agent");
                if (switchWindowsAgent == null)
                {
                    retVal = false;
                }
                else
                {
                    Context.AppTalkWindowManager.CloseTalkWindow();

                    IntPtr foregroundWindow = Windows.GetForegroundWindow();
                    var process             = WindowActivityMonitor.GetProcessForWindow(foregroundWindow);
                    IExtension extension    = switchWindowsAgent;

                    extension.GetInvoker().SetValue("FilterByProcessName", process.ProcessName);

                    Context.AppAgentMgr.ActivateAgent(switchWindowsAgent as IFunctionalAgent);

                    WindowActivityMonitor.GetActiveWindow();
                }
            }));
            return(retVal);
        }
예제 #5
0
        public bool Init(IEnumerable <String> extensionDirs)
        {
            if (_agentsCache == null)
            {
                _agentsCache = new AgentsCache();
                _agentsCache.EvtAgentAdded += _agentsCache_EvtAgentAdded;
                _agentsCache.Init(extensionDirs);

                _genericAppAgent = _agentsCache.GetAgent(GenericAppAgentName);
                if (_genericAppAgent == null)
                {
                    _agentsCache.AddAgentByType(typeof(UnsupportedAppAgent));
                    _genericAppAgent = _agentsCache.GetAgent(GenericAppAgentName);
                }

                _agentsCache.AddAgentByType(typeof(NullAgent));
                _nullAgent = _agentsCache.GetAgent(NullAgentName);

                _dialogAgent      = _agentsCache.GetAgent(DialogControlAgentName);
                _menuControlAgent = _agentsCache.GetAgent(MenuControlAgentName);

                _textControlAgent = _genericAppAgent.TextControlAgent;

                WindowActivityMonitor.EvtFocusChanged += WindowActivityMonitor_EvtFocusChanged;

                getKeyboardActuator();

                WindowActivityMonitor.GetActiveWindow();
            }

            return(true);
        }
예제 #6
0
        /// <summary>
        /// Tabs to the next field if in an email, or to the
        /// next mail item if the user is browsing email
        /// </summary>
        private void handleCmdEmailNextSimple()
        {
            var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();

            if (isMailComposeWindow(monitorInfo.FocusedElement) ||
                isMailComposeMessageWindow(monitorInfo.FocusedElement))
            {
                if (isToField(monitorInfo.FocusedElement) ||
                    isSubjectField(monitorInfo.FocusedElement) ||
                    isCCField(monitorInfo.FocusedElement) ||
                    isBCCField(monitorInfo.FocusedElement) ||
                    isAttachmentField(monitorInfo.FocusedElement))
                {
                    AgentManager.Instance.Keyboard.Send(Keys.Tab);
                }
            }
            else if (isBrowseEmailWindow(monitorInfo.FocusedElement))
            {
                AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.Down);
            }
            else
            {
                AgentManager.Instance.Keyboard.Send(Keys.Down);
            }
        }
예제 #7
0
 /// <summary>
 /// Call this AFTER the Init function
 /// </summary>
 public static void PostInit()
 {
     if (isEnabled(StartupFlags.WindowsActivityMonitor))
     {
         AppAgentMgr.Init(ExtensionDirs);
         WindowActivityMonitor.Start();
     }
 }
예제 #8
0
 /// <summary>
 /// Resumes notifications for requests to display scanners.
 /// The parameter controls whether this should detect which
 /// window is currently active.
 /// </summary>
 /// <param name="getActiveWindow"></param>
 public void ResumePanelChangeRequests(bool getActiveWindow = true)
 {
     _panelChangeNotifications.Release();
     if (getActiveWindow)
     {
         WindowActivityMonitor.GetActiveWindowAsync();
     }
 }
예제 #9
0
        /// <summary>
        /// Dispays the menu indicated by the menu name
        /// </summary>
        /// <param name="menuName">name of the menu</param>
        /// <param name="title">Title of the menu</param>
        private void showMenu(String menuName, String title)
        {
            var panelArg = new PanelRequestEventArgs(menuName, title, WindowActivityMonitor.GetForegroundWindowInfo())
            {
                UseCurrentScreenAsParent = true
            };

            showPanel(this, panelArg);
        }
예제 #10
0
        /// <summary>
        /// Invoked when the user selects something in the scanner that
        /// corresponds to a mapped functionality.  For now we only
        /// support photo viewer. Extend this to support other
        /// functionalities
        /// </summary>
        /// <param name="command">the command</param>
        /// <param name="commandArg">any optional arguments</param>
        /// <param name="handled">was it handled?</param>
        public override void OnRunCommand(String command, object commandArg, ref bool handled)
        {
            handled = true;

            switch (command)
            {
            case "NextPhoto":
                Context.AppAgentMgr.Keyboard.Send(Keys.Right);
                break;

            case "PreviousPhoto":
                Context.AppAgentMgr.Keyboard.Send(Keys.Left);
                break;

            case "PhotoDelete":
                Context.AppAgentMgr.Keyboard.Send(Keys.Delete);
                break;

            case "PhotoViewerZoomMenu":
                showPanel(this, new PanelRequestEventArgs("PhotoViewerZoomMenu",
                                                          _photoViewerTitle,
                                                          WindowActivityMonitor.GetForegroundWindowInfo(),
                                                          true));
                break;

            case "PhotoViewerRotateMenu":
                showPanel(this, new PanelRequestEventArgs("PhotoViewerRotateMenu",
                                                          _photoViewerTitle,
                                                          WindowActivityMonitor.GetForegroundWindowInfo(),
                                                          true));
                break;

            case "CmdZoomIn":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.Add);
                break;

            case "CmdZoomOut":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.Subtract);
                break;

            case "CmdZoomFit":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D0);
                break;

            case "RotateRight":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.OemPeriod);
                break;

            case "RotateLeft":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.Oemcomma);
                break;

            default:
                base.OnRunCommand(command, commandArg, ref handled);
                break;
            }
        }
예제 #11
0
        /// <summary>
        /// Tabs to the next field in an email window
        /// </summary>
        private void handleCmdEmailNextField()
        {
            var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();

            if (!isMailComposeMessageWindow(monitorInfo.FocusedElement))
            {
                AgentManager.Instance.Keyboard.Send(Keys.Tab);
            }
        }
예제 #12
0
        public void ShowContextMenu()
        {
            // this will force an activateagent call which
            // in turn will get the contextual menu from the
            // active app agent

            _getContextMenu = true;
            WindowActivityMonitor.GetActiveWindow();
        }
예제 #13
0
        void showWindowsExplorerScanner(String panel)
        {
            WindowActivityMonitorInfo monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
            PanelRequestEventArgs     panelArg    = new PanelRequestEventArgs(panel, monitorInfo);

            panelArg.Title = "Explorer";
            panelArg.UseCurrentScreenAsParent = true;
            showPanel(this, panelArg);
        }
예제 #14
0
        /// <summary>
        /// Activates a functional agent. The caller should to an 'await'
        /// on this to wait for it to complete.  This is because some
        /// functional agents return data and the caller has to wait
        /// for the functional agent to exit so it can get the data. Eg
        /// FileBrowser agent that returns a filename
        /// </summary>
        /// <param name="caller">The calling agent (can be null)</param>
        /// <param name="agent">Functional agent to activate</param>
        /// <returns>the task to wait on</returns>
        public async Task ActivateAgent(IApplicationAgent caller, IFunctionalAgent agent)
        {
            lock (_syncActivateAgent)
            {
                if (_currentAgent != null && _currentAgent != agent)
                {
                    if (caller == null && !_currentAgent.QueryAgentSwitch(agent))
                    {
                        return;
                    }

                    _currentAgent.OnFocusLost();
                }

                if (caller != null)
                {
                    agent.Parent = caller;
                    caller.OnPause();
                }

                _textControlAgent = agent.TextControlAgent;

                setAgent(agent);
            }

            Log.Debug("Calling activateAgent: " + agent.Name);
            await activateAgent(agent);

            CompletionCode exitCode = agent.ExitCode;

            Log.Debug("Returned from activateAgent: " + agent.Name);
            setAgent(null);

            if (agent.ExitCommand != null)
            {
                if (agent.ExitCommand.ContextSwitch)
                {
                    Context.AppPanelManager.CloseCurrentPanel();
                }

                RunCommandDispatcher.Dispatch(agent.ExitCommand.Command);
            }
            else if (exitCode == CompletionCode.ContextSwitch)
            {
                Context.AppPanelManager.CloseCurrentPanel();
                EnumWindows.RestoreFocusToTopWindow();
                WindowActivityMonitor.GetActiveWindow();
            }
            else
            {
                PausePanelChangeRequests();
                EnumWindows.RestoreFocusToTopWindow();
                ResumePanelChangeRequests(false);
            }
        }
예제 #15
0
        /// <summary>
        /// Attaches a file to the current email being composed.  The currently
        /// focused window has to be the mail compose window.  Sends a
        /// Ctrl+H command to.  Launches the file browser to get the file to attach
        /// from the user.  Then inserts the filename into the attachment field
        /// in the mail compose window
        /// </summary>
        protected async void attachFile()
        {
            var info = WindowActivityMonitor.GetForegroundWindowInfo();

            if (!isMailComposeMessageWindow(info.FocusedElement) &&
                !isMailComposeWindow(info.FocusedElement))
            {
                Log.Debug("Wrong window");
                return;
            }

            _fileAttachment = String.Empty;
            await getFileToAttach();

            if (String.IsNullOrEmpty(_fileAttachment))
            {
                return;
            }

            Thread.Sleep(500);
            EnumWindows.RestoreFocusToTopWindow();
            Thread.Sleep(500);

            SendKeys.SendWait("^h");
            Thread.Sleep(1000);

            for (int ii = 0; ii < 10; ii++)
            {
                var info1 = WindowActivityMonitor.GetForegroundWindowInfo();
                if (info1.Title == "Attach File")
                {
                    Log.Debug("YES!  Found Attach file window");
                    var automationElement = AgentUtils.GetElementOrAncestorByAutomationId(
                        info1.FocusedElement,
                        "Edit",
                        "ControlType.Edit",
                        "1148");
                    if (automationElement != null)
                    {
                        Log.Debug("element is not null");
                        AgentUtils.InsertTextIntoElement(automationElement, _fileAttachment);
                        SendKeys.Send("{ENTER}");
                    }
                    else
                    {
                        Log.Debug("element is null");
                    }

                    break;
                }

                Thread.Sleep(500);
            }
        }
예제 #16
0
        /// <summary>
        /// Invoked to run a command
        /// </summary>
        /// <param name="command">The command to execute</param>
        /// <param name="commandArg">Optional arguments for the command</param>
        /// <param name="handled">set this to true if handled</param>
        public override void OnRunCommand(String command, object commandArg, ref bool handled)
        {
            handled = true;
            switch (command)
            {
            case "SwitchAppWindow":
                DialogUtils.ShowTaskSwitcher(ReaderProcessName);
                break;

            case "FoxitZoomMenu":
            {
                var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
                var panelArg    = new PanelRequestEventArgs("FoxitReaderZoomMenu", "Foxit", monitorInfo)
                {
                    UseCurrentScreenAsParent = true
                };

                showPanel(this, panelArg);
            }

            break;

            case "SaveFile":
                AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.F);
                AgentManager.Instance.Keyboard.Send(Keys.A);
                break;

            case "CmdZoomIn":
                TextControlAgent.Pause();
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.Add);
                TextControlAgent.Resume();
                break;

            case "CmdZoomOut":
                TextControlAgent.Pause();
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.Subtract);
                TextControlAgent.Resume();
                break;

            case "CmdZoomFit":
                TextControlAgent.Pause();
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D2);
                TextControlAgent.Resume();
                break;

            case "CmdFind":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.F);
                break;

            default:
                base.OnRunCommand(command, commandArg, ref handled);
                break;
            }
        }
예제 #17
0
 public void OnPanelClosed(String panelClass)
 {
     Log.Debug();
     Log.Debug("panelClass : " + panelClass);
     Log.Debug(" currentAgent: " + _currentAgent);
     if (_currentAgent != null)
     {
         var activityInfo = WindowActivityMonitor.GetForegroundWindowInfo();
         _currentAgent.OnPanelClosed(panelClass, activityInfo);
     }
 }
예제 #18
0
 /// <summary>
 /// Event handler to display the alphabet scanner
 /// </summary>
 /// <param name="sender">event sender</param>
 /// <param name="eventArgs">event args</param>
 private void launchAppScanner_EvtShowScanner(object sender, EventArgs eventArgs)
 {
     if (_launchAppScanner != null)
     {
         var arg = new PanelRequestEventArgs(PanelClasses.AlphabetMinimal, WindowActivityMonitor.GetForegroundWindowInfo())
         {
             TargetPanel = _launchAppScanner,
             RequestArg  = _launchAppScanner,
             UseCurrentScreenAsParent = true
         };
         showPanel(this, arg);
     }
 }
예제 #19
0
        /// <summary>
        /// Opens the email or goes to the inbox
        /// </summary>
        private void handleCmdEmailOpenOrInbox()
        {
            WindowActivityMonitorInfo monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();

            if (isInboxWindow(monitorInfo.FocusedElement))
            {
                AgentManager.Instance.Keyboard.Send(Keys.Enter);
            }
            else
            {
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D1);
            }
        }
예제 #20
0
 /// <summary>
 /// Invoked to set the 'enabled' state of a widget.  This
 /// will depend on the current context.
 /// </summary>
 /// <param name="arg">contains info about the widget</param>
 public override void CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     if (String.Compare(arg.Widget.SubClass, "EmailAttachFile", true) == 0)
     {
         WindowActivityMonitorInfo info = WindowActivityMonitor.GetForegroundWindowInfo();
         arg.Enabled = (isMailComposeMessageWindow(info.FocusedElement) ||
                        isMailComposeWindow(info.FocusedElement));
         arg.Handled = true;
     }
     else
     {
         checkWidgetEnabled(_supportedFeatures, arg);
     }
 }
예제 #21
0
        /// <summary>
        /// Attaches a file to the current email being composed.
        /// Launches the file browser to get the file to attach  from the user.
        /// Sends a command to bring up the Outlook "Insert File" dialog.
        /// Inserts the filename into the file name field in the dialog
        /// </summary>
        protected async void attachFile()
        {
            _fileAttachment = String.Empty;
            await getFileToAttach();

            if (String.IsNullOrEmpty(_fileAttachment))
            {
                return;
            }

            Thread.Sleep(500);
            EnumWindows.RestoreFocusToTopWindowOnDesktop();
            Thread.Sleep(500);

            AgentManager.Instance.Keyboard.Send(Keys.F10);
            AgentManager.Instance.Keyboard.Send(Keys.H);
            AgentManager.Instance.Keyboard.Send(Keys.A);
            AgentManager.Instance.Keyboard.Send(Keys.F);

            Thread.Sleep(1000);

            for (int ii = 0; ii < 10; ii++)
            {
                var info1 = WindowActivityMonitor.GetForegroundWindowInfo();
                if (String.Compare(info1.Title, R.GetString2("OutlookAttachFileWindowTitle"), true) == 0)
                {
                    Log.Debug("YES!  Found Attach file window");
                    var automationElement = AgentUtils.GetElementOrAncestorByAutomationId(
                        info1.FocusedElement,
                        "Edit",
                        "ControlType.Edit",
                        "1148");
                    if (automationElement != null)
                    {
                        Log.Debug("element is not null");
                        AgentUtils.InsertTextIntoElement(automationElement, _fileAttachment);
                        SendKeys.Send("{ENTER}");
                    }
                    else
                    {
                        Log.Debug("element is null");
                    }

                    break;
                }

                Thread.Sleep(500);
            }
        }
예제 #22
0
        /// <summary>
        /// Call this AFTER the Init function
        /// </summary>
        public static bool PostInit()
        {
            if (isEnabled(StartupFlags.AgentManager))
            {
                AppAgentMgr.PostInit();
            }

            if (isEnabled(StartupFlags.WindowsActivityMonitor))
            {
                WindowActivityMonitor.GetActiveWindow();
                WindowActivityMonitor.Start();
            }

            return(true);
        }
예제 #23
0
        /// <summary>
        /// Parses the title of the notepad window and extracts the
        /// file name from it
        /// </summary>
        /// <returns>filename</returns>
        private String getFileNameFromWindow()
        {
            var info = WindowActivityMonitor.GetForegroundWindowInfo();

            if (info.FgProcess.ProcessName.Equals("notepad", StringComparison.InvariantCultureIgnoreCase))
            {
                String[] titleParts = info.Title.Split('-');
                if (titleParts != null && titleParts.Length > 0)
                {
                    return(titleParts[0]);
                }
            }

            return(String.Empty);
        }
예제 #24
0
        /// <summary>
        /// Changes the culture to the specified culture
        /// </summary>
        /// <param name="culture">culture to change to</param>
        public static void ChangeCulture(CultureInfo cultureInfo)
        {
            var culture = CultureInfo.CreateSpecificCulture(cultureInfo.Name);

            CultureInfo.DefaultThreadCurrentCulture   = culture;
            CultureInfo.DefaultThreadCurrentUICulture = culture;

            ResourceUtils.InstallLanguageForUser();

            if (EvtCultureChanged != null)
            {
                WindowActivityMonitor.Pause();
                EvtCultureChanged(cultureInfo, new CultureChangedEventArg(cultureInfo));
                WindowActivityMonitor.Resume();
            }
        }
예제 #25
0
        private void ProcessExit()
        {
            if (LectureManagerAgent.Confirm("Exit Lecture Manager?"))
            {
                AgentManager.Instance.RemoveAgent(this.Handle);

                StopSpeaking();

                removeWatchdogs();

                Aster.Utility.Windows.RestorePreviousWindow();
                WindowActivityMonitor.GetActiveWindow();

                this.Close();
            }
        }
예제 #26
0
        /// <summary>
        /// Form has been loaded
        /// </summary>
        private void TaskSwitcherForm_Load(object sender, EventArgs e)
        {
            Log.Debug();

            dtlp.Show();

            _dialogCommon.OnLoad();
            subscribeToEvents();

            var windowList = EnumWindows.Enumerate();

            if (!String.IsNullOrEmpty(FilterProcessName))
            {
                List <EnumWindows.WindowInfo> filteredList = new List <EnumWindows.WindowInfo>();

                for (int ii = 0; ii < windowList.Count; ii++)
                {
                    Process process = WindowActivityMonitor.GetProcessForWindow(windowList[ii].Handle);
                    if (String.Compare(process.ProcessName, FilterProcessName, true) == 0)
                    {
                        filteredList.Add(windowList[ii]);
                    }
                }

                windowList = filteredList;
            }
            else
            {
                Log.Debug("list count=" + windowList.Count);

                IntPtr desktopHWnd = User32Interop.GetDesktopWindow();

                Log.Debug("desktopHWnd=" + desktopHWnd.ToString());

                if (desktopHWnd != null)
                {
                    windowList.Insert(0, new EnumWindows.WindowInfo(desktopHWnd, "Show Desktop"));
                }
            }

            PopulateTLP(windowList);

            Windows.SetWindowPosition(this, Windows.WindowPosition.CenterScreen);

            _dialogCommon.GetAnimationManager().Start(_dialogCommon.GetRootWidget());
            Log.Debug("returning");
        }
예제 #27
0
파일: Context.cs 프로젝트: weberjavi/acat
        /// <summary>
        /// Disposes allocated resources
        /// </summary>
        public static void Dispose()
        {
            if (AppActuatorManager != null)
            {
                AppActuatorManager.Dispose();
            }

            if (AppPanelManager != null)
            {
                AppPanelManager.Dispose();
            }

            if (AppWordPredictionManager != null)
            {
                AppWordPredictionManager.Dispose();
            }

            if (AppTTSManager != null)
            {
                AppTTSManager.Dispose();
            }

            if (AppSpellCheckManager != null)
            {
                AppSpellCheckManager.Dispose();
            }

            if (AppAbbreviations != null)
            {
                AppAbbreviations.Dispose();
            }

            if (AppAgentMgr != null)
            {
                AppAgentMgr.Dispose();
            }

            if (AppAutomationEventManger != null)
            {
                AppAutomationEventManger.Dispose();
            }

            WindowActivityMonitor.Dispose();
        }
        /// <summary>
        /// Executes the command
        /// </summary>
        /// <param name="handled">set to true if the command was handled</param>
        /// <returns>true on success</returns>
        public override bool Execute(ref bool handled)
        {
            handled = true;

            Form form = Dispatcher.Scanner.Form;

            form.Invoke(new MethodInvoker(delegate()
            {
                if (DialogUtils.ConfirmScanner(form as IPanel, ACATExtension.Resources.LockTheScreen))
                {
                    Form screenLockForm = Context.AppPanelManager.CreatePanel("ScreenLockForm");
                    if (screenLockForm != null)
                    {
                        WindowActivityMonitor.Pause();
                        Context.AppPanelManager.ShowDialog(form as IPanel, screenLockForm as IPanel);
                    }
                }
            }));

            return(true);
        }
예제 #29
0
        /// <summary>
        /// Executes the command
        /// </summary>
        /// <param name="handled">set to true if the command was handled</param>
        /// <returns>true on success</returns>
        public override bool Execute(ref bool handled)
        {
            handled = true;

            Form form = Dispatcher.Scanner.Form;

            form.Invoke(new MethodInvoker(delegate()
            {
                if (DialogUtils.ConfirmScanner(form as IPanel, "Lock the screen and mute?"))
                {
                    Form muteForm = Context.AppPanelManager.CreatePanel("ACATMuteForm");
                    if (muteForm != null)
                    {
                        WindowActivityMonitor.Pause();
                        Context.AppPanelManager.ShowDialog(form as IPanel, muteForm as IPanel);
                    }
                }
            }));

            return(true);
        }
예제 #30
0
        /// <summary>
        /// Talk window form closed. Notify subscribers and
        /// restore focus to the application window that at
        /// the top of the Z order
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="e">event args</param>
        private void _talkWindowForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            Log.Debug("********* Calling EXiting all frames");
            System.Windows.Threading.Dispatcher.ExitAllFrames();
            System.Windows.Threading.Dispatcher.CurrentDispatcher.BeginInvokeShutdown(System.Windows.Threading.DispatcherPriority.Background);

            Log.Debug("appquit: " + PanelManagement.Context.AppQuit);

            if (!PanelManagement.Context.AppQuit)
            {
                if (EvtTalkWindowClosed != null)
                {
                    EvtTalkWindowClosed(this, new EventArgs());
                }

                EnumWindows.RestoreFocusToTopWindow();
                WindowActivityMonitor.GetActiveWindowAsync();
            }

            Log.Debug("Exiting");
        }