Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ToolingVersions.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<TargetFramework>net6.0-windows10.0.22000.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.19045.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.19045.0</SupportedOSPlatformVersion>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion common/DevHome.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Windows.DevHome.SDK" Version="0.100.254" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.231008000" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.231115000" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Internal.Windows.DevHome.Helpers" Version="1.0.20230706-x2201" />
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.4" />
Expand Down
10 changes: 10 additions & 0 deletions common/Helpers/RuntimeHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation and Contributors
// Licensed under the MIT license.

using System;
using Windows.Win32;
using Windows.Win32.Foundation;

Expand All @@ -17,4 +18,13 @@ public static bool IsMSIX
return PInvoke.GetCurrentPackageFullName(ref length, null) != WIN32_ERROR.APPMODEL_ERROR_NO_PACKAGE;
}
}

public static bool IsOnWindows11
{
get
{
var version = Environment.OSVersion.Version;
return version.Major >= 10 && version.Build >= 22000;
}
}
}
1 change: 1 addition & 0 deletions common/Services/IPackageDeploymentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public interface IPackageDeploymentService
/// <summary>
/// Find packages for the current user. If maxVersion is specified, package versions must be
/// between minVersion and maxVersion. If maxVersion is null, packages must be above minVersion.
/// If no minVersion is specified, returns packages of any version.
/// </summary>
/// <returns>An IEnumerable containing the installed packages that meet the version criteria.</returns>
public IEnumerable<Package> FindPackagesForCurrentUser(string packageFamilyName, params (Version minVersion, Version? maxVersion)[] ranges);
Expand Down
10 changes: 9 additions & 1 deletion common/Services/PackageDeploymentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ public IEnumerable<Package> FindPackagesForCurrentUser(string packageFamilyName,
var version = package.Id.Version;
var major = version.Major;
var minor = version.Minor;
var build = version.Build;
var revision = version.Revision;

Log.Logger()?.ReportInfo("PackageDeploymentService", $"Found package {package.Id.FullName}");

// Create System.Version type from PackageVersion to test. System.Version supports CompareTo() for easy comparisons.
if (IsVersionSupported(new (major, minor), ranges))
if (IsVersionSupported(new (major, minor, build, revision), ranges))
{
versionedPackages.Add(package);
}
Expand Down Expand Up @@ -79,6 +81,12 @@ public IEnumerable<Package> FindPackagesForCurrentUser(string packageFamilyName,

private bool IsVersionSupported(Version target, params (Version minVersion, Version? maxVersion)[] ranges)
{
// If a min version wasn't specified, any version is fine.
if (ranges.Length == 0)
{
return true;
}

foreach (var (minVersion, maxVersion) in ranges)
{
if (maxVersion == null)
Expand Down
8 changes: 6 additions & 2 deletions settings/DevHome.Settings/Strings/en-us/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@
<comment>Opt into including experimentation information into your issue template</comment>
</data>
<data name="Settings_Feedback_ReportBug_IncludeExtensions.Content" xml:space="preserve">
<value>Include installed Dev Home extensions</value>
<comment>Opt into including information on extensions into your issue template</comment>
<value>Include installed Dev Home extensions and related packages</value>
<comment>Opt into including information on extensions and related packages into your issue template</comment>
</data>
<data name="Settings_Feedback_ReportBug_IncludeSystemInfo.Content" xml:space="preserve">
<value>Include my system information</value>
Expand Down Expand Up @@ -452,6 +452,10 @@
<value>Extensions</value>
<comment>Label for displaying device's installed extensions</comment>
</data>
<data name="Settings_Feedback_WidgetService" xml:space="preserve">
<value>Widget Service</value>
<comment>Label for displaying device's installed widget service</comment>
</data>
<data name="Settings_Accounts_NoProvidersContentDialog_SecondaryButtonText" xml:space="preserve">
<value>Cancel</value>
</data>
Expand Down
1 change: 1 addition & 0 deletions settings/DevHome.Settings/Views/FeedbackPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<Expander.Content>
<StackPanel>
<TextBlock x:Name="ReportBugIncludeExtensionsList" />
<TextBlock x:Name="WidgetServiceInfo"/>
</StackPanel>
</Expander.Content>
</Expander>
Expand Down
27 changes: 26 additions & 1 deletion settings/DevHome.Settings/Views/FeedbackPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private async void DisplayReportBugDialog(object sender, RoutedEventArgs e)
var extensionsInfo = string.Empty;
if (ReportBugIncludeExtensions.IsChecked.GetValueOrDefault())
{
extensionsInfo = HttpUtility.UrlEncode(GetExtensions());
extensionsInfo = HttpUtility.UrlEncode(GetExtensions() + "\n" + GetWidgetService());
}

var otherSoftwareText = "OS Build Version: " + GetOSVersion() + "\n.NET Version: " + GetDotNetVersion();
Expand Down Expand Up @@ -196,6 +196,7 @@ private void ShowSysInfoExpander_Expanding(Expander sender, ExpanderExpandingEve
private void ShowExtensionsInfoExpander_Expanding(Expander sender, ExpanderExpandingEventArgs args)
{
ReportBugIncludeExtensionsList.Text = GetExtensions();
WidgetServiceInfo.Text = GetWidgetService();
}

private async void Reload()
Expand Down Expand Up @@ -328,6 +329,30 @@ private string GetExtensions()
return extensionsStr;
}

private string GetWidgetService()
{
var stringResource = new StringResource("DevHome.Settings/Resources");
var widgetServiceString = stringResource.GetLocalized("Settings_Feedback_WidgetService") + ": \n";
var packageDeploymentService = Application.Current.GetService<IPackageDeploymentService>();

// Only one package is expected in total from these two queries, but print anything just in case.
const string webExperienceFamilyName = "MicrosoftWindows.Client.WebExperience_cw5n1h2txyewy";
var webPackages = packageDeploymentService.FindPackagesForCurrentUser(webExperienceFamilyName);
foreach (var package in webPackages)
{
widgetServiceString += package.Id.FullName + "\n";
}

const string widgetServiceFamilyName = "Microsoft.WidgetsPlatformRuntime_8wekyb3d8bbwe";
var widgetPackages = packageDeploymentService.FindPackagesForCurrentUser(widgetServiceFamilyName);
foreach (var package in widgetPackages)
{
widgetServiceString += package.Id.FullName + "\n";
}

return widgetServiceString;
}

private async void BuildExtensionButtonClicked(object sender, RoutedEventArgs e)
{
await Launcher.LaunchUriAsync(new ("https://go.microsoft.com/fwlink/?linkid=2234795"));
Expand Down
5 changes: 0 additions & 5 deletions src/DevHome.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
<Import Project="$(SolutionDir)ToolingVersions.props" />
<PropertyGroup>
<OutputType>WinExe</OutputType>

<!-- TargetPlatformMinVersion is different here than the other csproj files.
User this version instead of the one defined in ToolingVersions.props -->
<TargetPlatformMinVersion>10.0.22000.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.22000.0</SupportedOSPlatformVersion>
<RootNamespace>DevHome</RootNamespace>
<ApplicationIcon>Assets/DevHome.ico</ApplicationIcon>
<ApplicationManifest>app.manifest</ApplicationManifest>
Expand Down
2 changes: 1 addition & 1 deletion src/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<desktop6:RegistryWriteVirtualization>disabled</desktop6:RegistryWriteVirtualization>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.22000.0" MaxVersionTested="10.0.22000.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19045.0" MaxVersionTested="10.0.22000.0" />
<PackageDependency Name="Microsoft.VCLibs.140.00.UWPDesktop" MinVersion="14.0.24217.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
</Dependencies>
<Resources>
Expand Down
10 changes: 6 additions & 4 deletions src/Services/ActivationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@ namespace DevHome.Services;

public class ActivationService : IActivationService
{
private readonly ActivationHandler<LaunchActivatedEventArgs> _defaultHandler;
private readonly IEnumerable<IActivationHandler> _activationHandlers;
private readonly IThemeSelectorService _themeSelectorService;
private readonly ILocalSettingsService _localSettingsService;

private bool _isInitialActivation = true;

public ActivationService(
ActivationHandler<LaunchActivatedEventArgs> defaultHandler,
IEnumerable<IActivationHandler> activationHandlers,
IThemeSelectorService themeSelectorService,
ILocalSettingsService localSettingsService)
{
_defaultHandler = defaultHandler;
_activationHandlers = activationHandlers;
_themeSelectorService = themeSelectorService;
_localSettingsService = localSettingsService;
Expand All @@ -41,8 +38,13 @@ public async Task ActivateAsync(object activationArgs)
// Execute tasks before activation.
await InitializeAsync();

// We can skip the initialization page if it's not our first run and we're on Windows 11.
// If we're on Windows 10, we need to go to the initialization page to install the WidgetService if we don't have it already.
var skipInitialization = await _localSettingsService.ReadSettingAsync<bool>(WellKnownSettingsKeys.IsNotFirstRun)
&& RuntimeHelper.IsOnWindows11;

// Set the MainWindow Content.
App.MainWindow.Content = await _localSettingsService.ReadSettingAsync<bool>(WellKnownSettingsKeys.IsNotFirstRun)
App.MainWindow.Content = skipInitialization
? Application.Current.GetService<ShellPage>()
: Application.Current.GetService<InitializationPage>();

Expand Down
21 changes: 16 additions & 5 deletions src/ViewModels/InitializationViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,36 @@

using CommunityToolkit.Mvvm.ComponentModel;
using DevHome.Common.Extensions;
using DevHome.Common.Services;
using DevHome.Contracts.Services;
using DevHome.Dashboard.Services;
using DevHome.Logging;
using DevHome.Views;
using Microsoft.UI.Xaml;

namespace DevHome.ViewModels;

public class InitializationViewModel : ObservableObject
{
private readonly IThemeSelectorService _themeSelector;
private readonly IExtensionService _extensionService;
private readonly IWidgetHostingService _widgetHostingService;

public InitializationViewModel(IThemeSelectorService themeSelector, IExtensionService extensionService)
public InitializationViewModel(IThemeSelectorService themeSelector, IWidgetHostingService widgetHostingService)
{
_themeSelector = themeSelector;
_extensionService = extensionService;
_widgetHostingService = widgetHostingService;
}

public void OnPageLoaded()
public async void OnPageLoaded()
{
try
{
await _widgetHostingService.EnsureWidgetServiceAsync();
}
catch (Exception ex)
{
GlobalLog.Logger?.ReportInfo("InitializationViewModel", "Installing WidgetService failed: ", ex);
}

App.MainWindow.Content = Application.Current.GetService<ShellPage>();

_themeSelector.SetRequestedTheme();
Expand Down
1 change: 1 addition & 0 deletions tools/Dashboard/DevHome.Dashboard/DevHome.Dashboard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<PackageReference Include="CommunityToolkit.WinUI.Converters" Version="8.0.230907" />
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.4" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
<PackageReference Include="System.Management.Automation" Version="7.2.8" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@

using System.Threading.Tasks;
using Microsoft.Windows.Widgets.Hosts;
using static DevHome.Dashboard.Services.WidgetHostingService;

namespace DevHome.Dashboard.Services;

public interface IWidgetHostingService
{
public Task<bool> EnsureWidgetServiceAsync();

public WidgetServiceStates GetWidgetServiceState();

public Task<WidgetHost> GetWidgetHostAsync();

public Task<WidgetCatalog> GetWidgetCatalogAsync();
Expand Down
Loading