public void Start(NatSpeakService natSpeakService) { _natSpeakService = natSpeakService ?? throw new ArgumentNullException(nameof(natSpeakService)); ShowConsole(); _logger.Info("Starting..."); _logger.Info( $"Product version: {Assembly.GetExecutingAssembly().GetName().Version}" ); // Get a reference to the GrammarService instance. _grammarService = _natSpeakService.GrammarService; _grammarService.GrammarSerializer = new GrammarSerializer(); _logger.Info("Querying Dragon Naturally Speaking..."); var profileName = _natSpeakService.GetCurrentUserProfileName(); var profilePath = _natSpeakService.GetUserDirectory(profileName); _logger.Info($"Dragon Profile Loaded: {profileName}"); _logger.Info($"Dragon Profile Path: {profilePath}"); LoadGrammars(); }
public async Task Start(NatSpeakService natSpeakService) { _natSpeakService = natSpeakService ?? throw new ArgumentNullException(nameof(natSpeakService)); ShowConsole(); _logger.Info("Starting..."); _logger.Info( $"Mouse Plot version: {Assembly.GetExecutingAssembly().GetName().Version}" ); // Get a reference to the GrammarService instance. _grammarService = _natSpeakService.GrammarService; _grammarService.GrammarSerializer = new GrammarSerializer(); _logger.Info("Querying Dragon Naturally Speaking..."); _logger.Info($"Dragon Version: {_natSpeakService.GetDragonVersion()}"); String profileName; String profilePath; for (var notified = false;; notified = true) { profileName = _natSpeakService.GetCurrentUserProfileName(); // If a profile name could not be retrieved, then either the user // hasn't selected a profile yet, or NatSpeak hasn't been started. if (profileName == null) { if (notified == false) { _logger.Info("Could not load profile. Will try again."); ShowNotifyInfo("Could not load profile. Will try again."); } // Wait for a bit. await Task.Delay(2000); // Try again... continue; } // Get the file-system location of the user's profile (for informational purposes). profilePath = _natSpeakService.GetUserDirectory(profileName); // Profile found. break; } _logger.Info($"Dragon Profile Loaded: {profileName}"); _logger.Info($"Dragon Profile Path: {profilePath}"); LoadGrammars(); CloseConsole(); }