-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide API for registering nested pages (#2356)
- Loading branch information
Showing
8 changed files
with
88 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using Microsoft.UI.Xaml.Controls; | ||
|
||
namespace DevHome.Common.Services; | ||
|
||
public interface IPageService | ||
{ | ||
Type GetPageType(string key); | ||
|
||
public void Configure<T_VM, T_V>() | ||
where T_VM : ObservableObject | ||
where T_V : Page; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Dashboard | ||
|
||
The Dashboard page hosts and displays Windows Widgets. Widgets are small UI containers that display text and graphics, associated with an app installed on the device. For information on creating widgets, see [Widgets Overview](https://learn.microsoft.com/windows/apps/design/widgets/) and [Widget providers](https://learn.microsoft.com/windows/apps/develop/widgets/widget-providers). | ||
|
||
Each widget is represented by a [`WidgetViewModel`](../tools/Dashboard/DevHome.Dashboard/ViewModels/WidgetViewModel.cs). The WidgetViewModel displays itself inside a [`WidgetControl`](../../tools/Dashboard/DevHome.Dashboard/Controls/WidgetControl.xaml), and the WidgetControls are grouped into a [`WidgetBoard`](../../tools/Dashboard/DevHome.Dashboard/Controls/WidgetBoard.cs). | ||
|
||
### Widget UI | ||
|
||
The Widget UI consists of two main parts. At the top, there is a context menu and an attribution area. For more information on these components, please read [Built-in widget UI components](https://learn.microsoft.com/windows/apps/design/widgets/widgets-states-and-ui#built-in-widget-ui-components). The rest of the widget content is an [Adaptive Card](https://learn.microsoft.com/windows/apps/design/widgets/widgets-create-a-template) provided by the [Widget Provider](https://learn.microsoft.com/windows/apps/develop/widgets/widget-providers). | ||
|
||
Widgets are rendered by Adaptive Cards, and there are a few ways Dev Home customizes the look and feel of the cards. Please note all of these are subject to change while Dev Home is in Preview. | ||
* Dev Home widgets use the [Adaptive Card schema](https://adaptivecards.io/explorer/) version 1.5, which is the most recent schema supported by the WinUI 3 Adaptive Card renderer. | ||
* There are [HostConfig](https://learn.microsoft.com/adaptive-cards/sdk/rendering-cards/uwp/host-config) files that define common styles (e.g., font family, font sizes, default spacing) and behaviors (e.g., max number of actions) for all the widgets. There is one for [light mode](../../tools/Dashboard/DevHome.Dashboard/Assets/HostConfigLight.json) and one for [dark mode](../tools/Dashboard/DevHome.Dashboard/Assets/HostConfigDark.json). | ||
* Dev Home supports a custom AdaptiveElement type called [`LabelGroup`](../../common/Renderers/LabelGroup.cs). This allows a card author to render a set of labels, each with a specified background color. For an example of how to use this type, please see the [GitHub Issues widget](https://github.com/microsoft/devhomegithubextension/blob/main/src/GitHubExtension/Widgets/Templates/GitHubIssuesTemplate.json). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using DevHome.Common.Services; | ||
using DevHome.Settings.ViewModels; | ||
using DevHome.Settings.Views; | ||
|
||
namespace DevHome.Settings.Extensions; | ||
|
||
public static class PageExtensions | ||
{ | ||
public static void ConfigureSettingsPages(this IPageService pageService) | ||
{ | ||
// Settings is not a Tool, so the main page is not configured automatically. Configure it here. | ||
pageService.Configure<SettingsViewModel, SettingsPage>(); | ||
|
||
// Configure sub-pages | ||
pageService.Configure<PreferencesViewModel, PreferencesPage>(); | ||
pageService.Configure<AccountsViewModel, AccountsPage>(); | ||
pageService.Configure<ExperimentalFeaturesViewModel, ExperimentalFeaturesPage>(); | ||
pageService.Configure<FeedbackViewModel, FeedbackPage>(); | ||
pageService.Configure<AboutViewModel, AboutPage>(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
tools/ExtensionLibrary/DevHome.ExtensionLibrary/Extensions/PageExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using DevHome.Common.Services; | ||
using DevHome.ExtensionLibrary.ViewModels; | ||
using DevHome.ExtensionLibrary.Views; | ||
|
||
namespace DevHome.ExtensionLibrary.Extensions; | ||
|
||
public static class PageExtensions | ||
{ | ||
public static void ConfigureExtensionLibraryPages(this IPageService pageService) | ||
{ | ||
pageService.Configure<ExtensionSettingsViewModel, ExtensionSettingsPage>(); | ||
} | ||
} |