示例#1
0
        public void Launch()
        {
            Application.ApplicationExit += OnApplicationExit;
            Application.ThreadExit      += OnApplicationExit;

            _logger.Info("Renfrew starting...");

            try {
                _logger.Debug("Creating 'site object'...");
                _sitePtr = _natSpeakService.CreateSiteObject();

                _logger.Debug("Calling Connect()...");
                _natSpeakService.Connect(_sitePtr);

                _logger.Debug("Starting Core Application...");
                CoreApplication.Instance.Start(_natSpeakService);
            } catch (COMException e) {
                _logger.Fatal(e, "Could not connect to Dragon NaturallySpeaking. Is it running?");

                MessageBox.Show(
                    "There was an error connecting to Dragon NaturallySpeaking:\r\n" +
                    $"  >> COM Error: {e.Message}\r\n" +
                    "\r\n" +
                    "Please make sure Dragon is running!",
                    "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error
                    );

                // Kill the application
                Application.ExitThread();
                Environment.Exit(-1);
            }
        }
示例#2
0
        public async void Launch()
        {
            Application.ApplicationExit += OnApplicationExit;
            Application.ThreadExit      += OnApplicationExit;

            _logger.Info("Renfrew starting...");

            try {
                _logger.Debug("Creating 'site object'...");
                _sitePtr = _natSpeakService.CreateSiteObject();

                _logger.Debug("Calling Connect()...");
                _natSpeakService.Connect(_sitePtr);

                _logger.Debug("Starting Core Application...");

                await CoreApplication.Instance.Start(_natSpeakService);
            } catch (Exception e) {
                _logger.Fatal(e, "");

                CoreApplication.Instance.ShowNotifyError(
                    "There was an unexpected error that requires Mouse Plot to quit. 😞 See the log for more info."
                    );

                // Wait long enough for the user to see the error message.
                Thread.Sleep(10000);

                _logger.Debug("Exiting application.");

                // Kill the application
                Application.ExitThread();
                Environment.Exit(-1);
            }
        }
 public unsafe void Register(IServiceProvider *site)
 {
     _natSpeakService.Connect(site);
     CoreApplication.Instance.Start(_natSpeakService);
 }