Skip to content

Commit

Permalink
Improving the narrator with DevHome (#2986)
Browse files Browse the repository at this point in the history
* Making the narrator say what I want it to say

* Fixing merge

* Using a theme resource

* Adding a comment about a string
  • Loading branch information
dhoehna committed May 23, 2024
1 parent 762f78d commit eac4432
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,8 @@
<value>Go to extensions library</value>
<comment>Text for when the environment page in Dev Home is empty and the user has no extensions installed that support environments</comment>
</data>
<data name="MoreOptionsButtonName" xml:space="preserve">
<value>More Options</value>
<comment>The text narrator should say for the ... button</comment>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using DevHome.Common.Environments.Models;
using DevHome.Common.Services;
using Microsoft.UI.Xaml.Media.Imaging;
using Microsoft.Windows.DevHome.SDK;
using Windows.Foundation;
Expand Down Expand Up @@ -41,6 +42,13 @@ public abstract partial class ComputeSystemCardBase : ObservableObject
[ObservableProperty]
private bool _shouldShowLaunchOperation;

/// <summary>
/// This string can, and should, be in a resource file. But can't because this string used in a
/// data template.
/// </summary>
[ObservableProperty]
private string _moreOptionsButtonName;

public BitmapImage? HeaderImage { get; protected set; }

public BitmapImage? BodyImage { get; protected set; }
Expand All @@ -54,6 +62,12 @@ public abstract partial class ComputeSystemCardBase : ObservableObject
[ObservableProperty]
private string _uiMessageToDisplay = string.Empty;

public ComputeSystemCardBase()
{
var stringResource = new StringResource("DevHome.Environments.pri", "DevHome.Environments/Resources");
_moreOptionsButtonName = stringResource.GetLocalized("MoreOptionsButtonName");
}

public override string ToString()
{
return $"{Name} {AlternativeName}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public partial class CreateComputeSystemOperationViewModel : ComputeSystemCardBa
_stringResource = stringResource;
_computeSystemManager = computeSystemManager;
Operation = operation;
Name = Operation.EnvironmentName;

var providerDetails = Operation.ProviderDetails;
ProviderDisplayName = providerDetails.ComputeSystemProvider.DisplayName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
<DataTemplate x:Key="ThreeDotsButton" x:DataType="vm:ComputeSystemViewModel">
<Grid>
<Button
Style="{StaticResource HorizontalThreeDotsStyle}">
Style="{StaticResource HorizontalThreeDotsStyle}"
AutomationProperties.Name="{x:Bind MoreOptionsButtonName}">
<Button.Flyout>
<customControls:CardFlyout ItemsViewModels="{x:Bind DotOperations, Mode=OneWay}"/>
</Button.Flyout>
Expand All @@ -64,7 +65,8 @@
<DataTemplate x:Key="ThreeDotsButtonForCreation" x:DataType="vm:CreateComputeSystemOperationViewModel">
<Grid>
<Button
Style="{StaticResource HorizontalThreeDotsStyle}">
Style="{StaticResource HorizontalThreeDotsStyle}"
AutomationProperties.Name="{x:Bind MoreOptionsButtonName}">
<Button.Flyout>
<customControls:CardFlyout ItemsViewModels="{x:Bind DotOperations, Mode=OneWay}" />
</Button.Flyout>
Expand Down
3 changes: 2 additions & 1 deletion tools/SetupFlow/DevHome.SetupFlow/Views/ReviewView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
<StackPanel>
<Expander HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"
IsExpanded="true"
MinHeight="64" CornerRadius="4" Padding="24,0,24,7" >
MinHeight="64" CornerRadius="{ThemeResource ControlCornerRadius}" Padding="24,0,24,7"
AutomationProperties.Name="{x:Bind ViewModel.ReviewPageExpanderDescription, Mode=OneWay}">
<Expander.Header>
<Grid>
<Grid.ColumnDefinitions>
Expand Down

0 comments on commit eac4432

Please sign in to comment.