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
Show all changes
28 commits
Select commit Hold shift + click to select a range
1ad430d
add initial changes
bbonaby Mar 29, 2024
32e23ef
add parsers
bbonaby Mar 29, 2024
dd85999
fix build
bbonaby Mar 29, 2024
29a749f
update existing classes and xaml
bbonaby Mar 29, 2024
4daca73
add hyper-v adaptive card for creation
bbonaby Mar 29, 2024
96610fc
add changes for hyper-v
bbonaby Mar 29, 2024
2f82316
fix build
bbonaby Mar 29, 2024
62587bb
add changes to show settings cards from hyper v
bbonaby Mar 29, 2024
3ce765e
update with latest changes
bbonaby Mar 31, 2024
9a3df47
add recent changes
bbonaby Mar 31, 2024
d8421ae
fix build
bbonaby Mar 31, 2024
f094aa4
Merge branch 'user/bbonaby-add-adaptive-card-updates2' into user/bbon…
bbonaby Mar 31, 2024
4295de0
Merge branch 'user/bbonaby/add-hyper-v-code-for-creation-adaptive-car…
bbonaby Mar 31, 2024
c1f6289
add updates for adaptive cards to appear in review page
bbonaby Mar 31, 2024
8c887ff
add creation to experiements page and fix adaptive card not showing u…
bbonaby Mar 31, 2024
c9fe61f
add missing message classes
bbonaby Mar 31, 2024
0db3637
Delete tools/SetupFlow/DevHome.SetupFlow/Models/Environments/CreateEn…
bbonaby Mar 31, 2024
af8953f
update message passing
bbonaby Apr 1, 2024
50e4b55
update based on comments, and add more comments
bbonaby Apr 2, 2024
599bcef
update comments and itemsviews choice set to prevent the choiceset fr…
bbonaby Apr 2, 2024
b5feec4
Merge branch 'main' into user/bbonaby-add-adaptive-card-updates2
bbonaby Apr 2, 2024
975616e
Use adaptive card render service to render adaptive card within conte…
bbonaby Apr 2, 2024
8a6b627
Merge branch 'user/bbonaby-add-adaptive-card-updates2' into user/bbon…
bbonaby Apr 2, 2024
92c3979
Merge branch 'user/bbonaby/add-hyper-v-code-for-creation-adaptive-car…
bbonaby Apr 2, 2024
1a4da8f
add updates
bbonaby Apr 2, 2024
34b31f8
Merge branch 'main' into user/bbonaby/add-initial-creation-flow-in-se…
bbonaby Apr 5, 2024
a1b591f
Merge branch 'main' into user/bbonaby/add-initial-creation-flow-in-se…
bbonaby Apr 5, 2024
45ae811
Fix merge conflicts and address comments
bbonaby Apr 5, 2024
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
8 changes: 8 additions & 0 deletions settings/DevHome.Settings/Strings/en-us/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -565,5 +565,13 @@
<data name="QuietBackgroundProcessesExperiment_Description" xml:space="preserve">
<value>Silence and track background processes that may hinder device performance</value>
<comment>Inline description of the Quiet Background Processes experimental feature on the 'Settings -> Experiments' page where you enable it.</comment>
</data>
<data name="EnvironmentsCreationFlow_Description" xml:space="preserve">
<value>Create a local or cloud machine from Dev Home</value>
<comment>Text within a display card that explains what users can do with the Environments creation feature. Users can choose to toggle this on/off to add or remove the feature.</comment>
</data>
<data name="EnvironmentsCreationFlow_Name" xml:space="preserve">
<value>Environments Creation</value>
<comment>Title text for the Environments creation feature.</comment>
</data>
</root>
1 change: 1 addition & 0 deletions src/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<ResourceDictionary Source="ms-appx:///DevHome.Dashboard/Styles/Dashboard_ThemeResources.xaml" />
<ResourceDictionary Source="ms-appx:///DevHome.SetupFlow/Styles/SetupFlow_ThemeResources.xaml" />
<ResourceDictionary Source="ms-appx:///DevHome.Common/Environments/Styles/HorizontalCardStyles.xaml" />
<ResourceDictionary Source="ms-appx:///DevHome.Common/Views/AdaptiveCardViews/AdaptiveCardResourceTemplates.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Expand Down
21 changes: 21 additions & 0 deletions src/NavConfig.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,27 @@
"visible": false
}
]
},
{
"identity": "EnvironmentsCreationFlow",
"enabledByDefault": false,
"buildTypeOverrides": [
{
"buildType": "dev",
"enabledByDefault": true,
"visible": true
},
{
"buildType": "canary",
"enabledByDefault": true,
"visible": true
},
{
"buildType": "release",
"enabledByDefault": false,
"visible": false
}
]
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DevHome.SetupFlow.Exceptions;

public class AdaptiveCardNotRetrievedException : Exception
{
public AdaptiveCardNotRetrievedException(string message)
: base(message)
{
}
}
16 changes: 16 additions & 0 deletions tools/SetupFlow/DevHome.SetupFlow/Extensions/ServiceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using DevHome.SetupFlow.Services.WinGet.Operations;
using DevHome.SetupFlow.TaskGroups;
using DevHome.SetupFlow.ViewModels;
using DevHome.SetupFlow.ViewModels.Environments;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
Expand All @@ -33,6 +34,7 @@ public static IServiceCollection AddSetupFlow(this IServiceCollection services,
services.AddReview();
services.AddSummary();
services.AddSummaryInformation();
services.AddCreateEnvironment();

// View-models
services.AddSingleton<SetupFlowViewModel>();
Expand Down Expand Up @@ -194,4 +196,18 @@ private static IServiceCollection AddSetupTarget(this IServiceCollection service

return services;
}

private static IServiceCollection AddCreateEnvironment(this IServiceCollection services)
{
// Task groups
services.AddTransient<EnvironmentCreationOptionsTaskGroup>();
services.AddTransient<SelectEnvironmentProviderTaskGroup>();

// View models
services.AddTransient<CreateEnvironmentReviewViewModel>();
services.AddTransient<EnvironmentCreationOptionsViewModel>();
services.AddTransient<SelectEnvironmentProviderViewModel>();

return services;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using DevHome.Common.Environments.Models;

namespace DevHome.SetupFlow.Models.Environments;

/// <summary>
/// Data payload for when the <see cref="Microsoft.Windows.DevHome.SDK.IExtensionAdaptiveCardSession2">
/// session Ends. This data is used to send the user input from an adaptive card session back to an object
/// that subscribes to the <see cref="Microsoft.Windows.DevHome.SDK.IExtensionAdaptiveCardSession2.Stopped">
/// event.
/// </summary>
public class CreationAdaptiveCardSessionEndedData
{
/// <summary>
/// Gets the JSON string of the user input from the adaptive card session
/// </summary>
public string UserInputResultJson { get; private set; }

/// <summary>
/// Gets the provider details for the compute system provider. <see cref="ComputeSystemProviderDetails"/>
/// </summary>
public ComputeSystemProviderDetails ProviderDetails { get; private set; }

public CreationAdaptiveCardSessionEndedData(string userInputResultJson, ComputeSystemProviderDetails providerDetails)
{
UserInputResultJson = userInputResultJson;
ProviderDetails = providerDetails;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using CommunityToolkit.Mvvm.Messaging.Messages;

namespace DevHome.SetupFlow.Models.Environments;

/// <summary>
/// Message for sending the data payload for the <see cref="Microsoft.Windows.DevHome.SDK.IExtensionAdaptiveCardSession2">
/// object's session back to a subscriber when the session ends.
/// </summary>
public class CreationAdaptiveCardSessionEndedMessage : ValueChangedMessage<CreationAdaptiveCardSessionEndedData>
{
public CreationAdaptiveCardSessionEndedMessage(CreationAdaptiveCardSessionEndedData value)
: base(value)
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using AdaptiveCards.Rendering.WinUI3;
using CommunityToolkit.Mvvm.Messaging.Messages;

namespace DevHome.SetupFlow.Models.Environments;

/// <summary>
/// Message for requesting a rendered adaptive card that was created from a <see cref="DevHome.Common.Models.ExtensionAdaptiveCard."/>
/// object in one view model to a view.
/// </summary>
/// <remarks>
/// This is used when a view that displays an adaptive card needs to request the rendered adaptive card from the view model.
/// The view in this case would not want to using Binding to bind to the adaptive card, but instead request it and then manually
/// add it to its UI. This prevents xaml binding crashes with "Element is already the child of another element" exceptions.
/// </remarks>
public sealed class CreationOptionsReviewPageDataRequestMessage : RequestMessage<RenderedAdaptiveCard>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this class blank on purpose?

{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using AdaptiveCards.Rendering.WinUI3;
using CommunityToolkit.Mvvm.Messaging.Messages;

namespace DevHome.SetupFlow.Models.Environments;

/// <summary>
/// Message for requesting a rendered adaptive card that was created from a <see cref="DevHome.Common.Models.ExtensionAdaptiveCard."/>
/// object in one view model to a view.
/// </summary>
/// <remarks>
/// This is used when a view that displays an adaptive card needs to request the rendered adaptive card from the view model.
/// The view in this case would not want to using Binding to bind to the adaptive card, but instead request it and then manually
/// add it to its UI. This prevents xaml binding crashes with "Element is already the child of another element" exceptions.
/// </remarks>
public sealed class CreationOptionsViewPageRequestMessage : RequestMessage<RenderedAdaptiveCard>
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using CommunityToolkit.Mvvm.Messaging.Messages;
using DevHome.Common.Environments.Models;

namespace DevHome.SetupFlow.Models.Environments;

/// <summary>
/// Message for sending the <see cref="ComputeSystemProviderDetails"/> from one view model to
/// another view model when the provider changes.
/// </summary>
public class CreationProviderChangedMessage : ValueChangedMessage<ComputeSystemProviderDetails>
{
public CreationProviderChangedMessage(ComputeSystemProviderDetails value)
: base(value)
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using CommunityToolkit.Mvvm.Messaging.Messages;

namespace DevHome.SetupFlow.Models.Environments;

/// <summary>
/// Message for sending a rendered adaptive card that was created from a <see cref="DevHome.Common.Models.ExtensionAdaptiveCard."/>
/// object in one view model to a view.
/// </summary>
/// <remarks>
/// Since multiple view models can listen for this message in the setup flow, this object is used to to send the rendered adaptive card
/// as well as the current view model that is being displayed in the setup flow. Listeners can use the current view model in use
/// by the <see cref="Services.SetupFlowOrchestrator"/> to determine if they should display the adaptive card or not.
/// </remarks>
public class NewAdaptiveCardAvailableMessage : ValueChangedMessage<RenderedAdaptiveCardData>
{
public NewAdaptiveCardAvailableMessage(RenderedAdaptiveCardData value)
: base(value)
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using AdaptiveCards.Rendering.WinUI3;

namespace DevHome.SetupFlow.Models.Environments;

/// <summary>
/// Data object that contains the rendered adaptive card and the current view model being used in
/// the setup flow by the <see cref="Services.SetupFlowOrchestrator"/>.
/// </summary>
public class RenderedAdaptiveCardData
{
public object CurrentSetupFlowViewModel { get; private set; }

public RenderedAdaptiveCard RenderedAdaptiveCard { get; set; }

public RenderedAdaptiveCardData(object currentSetupFlowViewModel, RenderedAdaptiveCard renderedAdaptiveCard)
{
CurrentSetupFlowViewModel = currentSetupFlowViewModel;
RenderedAdaptiveCard = renderedAdaptiveCard;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using DevHome.SetupFlow.ViewModels;
using DevHome.SetupFlow.ViewModels.Environments;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;

Expand Down Expand Up @@ -35,6 +36,11 @@ public DataTemplate SetupTargetTabTemplate
get; set;
}

public DataTemplate CreateEnvironmentTabTemplate
{
get; set;
}

protected override DataTemplate SelectTemplateCore(object item)
{
return ResolveDataTemplate(item, () => base.SelectTemplateCore(item));
Expand All @@ -59,6 +65,7 @@ private DataTemplate ResolveDataTemplate(object item, Func<DataTemplate> default
RepoConfigReviewViewModel => RepoConfigTabTemplate,
AppManagementReviewViewModel => AppManagementTabTemplate,
SetupTargetReviewViewModel => SetupTargetTabTemplate,
CreateEnvironmentReviewViewModel => CreateEnvironmentTabTemplate,
_ => defaultDataTemplate(),
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using DevHome.SetupFlow.ViewModels;
using DevHome.SetupFlow.ViewModels.Environments;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;

Expand All @@ -29,7 +30,11 @@ public class SetupFlowViewSelector : DataTemplateSelector

public DataTemplate SummaryTemplate { get; set; }

public DataTemplate ConfigurationFileTemplate { get; set; }
public DataTemplate ConfigurationFileTemplate { get; set; }

public DataTemplate SelectEnvironmentsProviderTemplate { get; set; }

public DataTemplate EnvironmentCreationOptionsTemplate { get; set; }

protected override DataTemplate SelectTemplateCore(object item)
{
Expand Down Expand Up @@ -58,7 +63,9 @@ private DataTemplate ResolveDataTemplate(object item, Func<DataTemplate> default
LoadingViewModel => LoadingTemplate,
SummaryViewModel => SummaryTemplate,
ConfigurationFileViewModel => ConfigurationFileTemplate,
SetupTargetViewModel => SetupTargetTemplate,
SetupTargetViewModel => SetupTargetTemplate,
SelectEnvironmentProviderViewModel => SelectEnvironmentsProviderTemplate,
EnvironmentCreationOptionsViewModel => EnvironmentCreationOptionsTemplate,
_ => defaultDataTemplate(),
};
}
Expand Down
Loading