public AlfredToolWindowControl() { try { InitializeComponent(); _app = AlfredPackage.AlfredInstance; // DataBindings rely on Alfred presently as there hasn't been a need for a page ViewModel yet DataContext = _app; _app.Console?.Log(Properties.Resources.AlfredToolWindowControlInitializeLogHeader, Properties.Resources.AlfredToolWindowControlInitializeLogMessage, LogLevel.Verbose); } catch (Exception ex) { const string Caption = "Problem Starting Tool Window"; var message = ex.BuildDetailsMessage(); #if DEBUG Debugger.Break(); Debug.Fail(Caption, message); #else MessageBox.Show(message, Caption, MessageBoxButton.OK, MessageBoxImage.Error); #endif // We shouldn't load the page in a bad state. Crash the application // ReSharper disable once HeuristicUnreachableCode throw; } }
/// <summary> /// Initializes a new instance of the <see cref="AlfredChatWindowControl"/> class. /// </summary> public AlfredChatWindowControl() { InitializeComponent(); _app = AlfredPackage.AlfredInstance; // DataBindings rely on Alfred presently as there hasn't been a need for a page ViewModel yet DataContext = _app; }
public override void SetUp() { base.SetUp(); _app = new ApplicationManager(Container, BuildOptions()); _app.RootNodes.ShouldNotBeNull(); _control = new ExplorerControl(_app.RootNodes); _app.Alfred.Initialize(); // Get the control ready for interaction InitializeControl(_control); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow" /> class. /// </summary> public MainWindow() { InitializeComponent(); #if DEBUG // Do not allow topmost window mode while debugging Topmost = false; #endif var options = new ApplicationManagerOptions { IsSpeechEnabled = true, ShowMindExplorerPage = true }; _app = new ApplicationManager(CommonProvider.Container, options, this); // DataBindings rely on Alfred presently as there hasn't been a need for a page ViewModel yet DataContext = _app; _app.Console?.Log("WinClient.Initialize", Res.InitializationCompleteLogMessage.NonNull(), LogLevel.Verbose); }
public void ChatHistoryHasNodesAfterConversation() { // Initialize an Alfred application var app = new ApplicationManager(Container, BuildOptions()); var alfred = app.Alfred; var chat = alfred.Subsystems.First(s => s is ChatSubsystem); alfred.Initialize(); // Find the chat system var node = chat.PropertyProviders.Find("Chat History"); Assert.IsNotNull(node, "Could not find Chat History node"); /* The chat history node is going to already have a few entries from coming online. We want a count of new history entries after startup. */ var count = node.PropertyProviders.Count(); // Say the same thing repeatedly to Alfred, thus driving him insane. const string ChatInput = "What's your favorite color?"; const int NumChats = 25; for (var i = 0; i < NumChats; i++) { alfred.ChatProvider.HandleUserStatement(ChatInput); } // Grab the response once and move it to a list so we can examine it var children = node.PropertyProviders.ToList(); /* We expect there to be a statement and a reply for every entry in the chat history plus the initial number of chat entries. */ Assert.AreEqual(count + (NumChats * 2), children.Count(), "The chat history did not have the expected number of nodes"); // We expect that what we said will only appear on nodes originating from the "user". Assert.AreEqual(NumChats, children.Count(p => p.DisplayName.Contains(ChatInput))); }
internal static ApplicationManager EnsureAlfredInstance() { if (_app == null) { var options = new ApplicationManagerOptions { IsSpeechEnabled = true, ShowMindExplorerPage = false }; // Build out the app manager _app = new ApplicationManager(CommonProvider.Container, options); _app.Console?.Log(Resources.AlfredPackageInstantiatingAlfredLogHeader, Resources.AlfredPackageInstantiatingAlfredLogMessage, LogLevel.Verbose); // Auto Start Debug.Assert(Settings.Default != null); if (Settings.Default.AutoStartAlfred) { _app.Console?.Log(Resources.AlfredPackageInstantiatingAlfredLogHeader, Resources.AlfredPackageEnsureAlfredInstanceAutoStartingLogMessage, LogLevel.Verbose); _app.Start(); } } return _app; }
public void ApplicationContainsMindExplorer() { var app = new ApplicationManager(Container, BuildOptions()); Assert.That(app.Alfred.Subsystems.Any(s => s is MindExplorerSubsystem), "The Mind Explorer subsystem is not part of a typical Alfred application"); }
public override void SetUp() { base.SetUp(); _app = new ApplicationManager(Container, BuildOptions()); _control = new RootPagesControl(_app); _app.Alfred.Initialize(); // Get the control ready for interaction InitializeControl(_control); }