IRootPageService.cs
 1  // Copyright (c) Microsoft Corporation
 2  // The Microsoft Corporation licenses this file to you under the MIT license.
 3  // See the LICENSE file in the project root for more information.
 4  
 5  namespace Microsoft.CmdPal.Core.ViewModels;
 6  
 7  public interface IRootPageService
 8  {
 9      /// <summary>
10      /// Gets the root page of the command palette. Return any IPage implementation that
11      /// represents the root view of this instance of the command palette.
12      /// </summary>
13      Microsoft.CommandPalette.Extensions.IPage GetRootPage();
14  
15      /// <summary>
16      /// Pre-loads any necessary data or state before the root page is loaded.
17      /// This will be awaited before the root page and the user can do anything,
18      /// so ideally it should be quick and not block the UI thread for long.
19      /// </summary>
20      Task PreLoadAsync();
21  
22      /// <summary>
23      /// Do any loading work that can be done after the root page is loaded and
24      /// displayed to the user.
25      /// This is run asynchronously, on a background thread.
26      /// </summary>
27      Task PostLoadRootPageAsync();
28  
29      /// <summary>
30      /// Called when a command is performed. The context is the
31      /// sender context for the invoked command. This is typically the IListItem
32      /// or ICommandContextItem that was used to invoke the command.
33      /// </summary>
34      void OnPerformCommand(object? context, bool topLevel, AppExtensionHost? currentHost);
35  
36      void GoHome();
37  }