Skip to content

Commit 18ff42e

Browse files
Merge pull request #2695 from microsoft/main
Staging - 4/18/24
2 parents e400d2a + ccc9498 commit 18ff42e

File tree

13 files changed

+70
-63
lines changed

13 files changed

+70
-63
lines changed

tools/Customization/DevHome.Customization/Strings/en-us/Resources.resw

+7-3
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,15 @@
126126
<comment>Dev drive size free</comment>
127127
</data>
128128
<data name="DevDriveInsightsCard.Description" xml:space="preserve">
129-
<value>All things, Dev Drives, optimizations, etc.</value>
129+
<value>All things Dev Drive, optimizations, etc.</value>
130130
<comment>The description for the Dev Drive Insights settings card</comment>
131131
</data>
132132
<data name="DevDriveInsightsCard.Header" xml:space="preserve">
133-
<value>Dev Drive Insights</value>
133+
<value>Dev Drive insights</value>
134134
<comment>The header for the Dev Drive Insights settings card</comment>
135135
</data>
136136
<data name="DevDriveInsights_Header" xml:space="preserve">
137-
<value>Dev Drive Insights</value>
137+
<value>Dev Drive insights</value>
138138
<comment>Header for Dev Drive insights page in the breadcrumb bar</comment>
139139
</data>
140140
<data name="DevDriveSizeText" xml:space="preserve">
@@ -201,6 +201,10 @@
201201
<value>Global environment variable {0} is set to {1}, which is not located on Dev Drive. Move contents of this folder to a directory on Dev Drive such as {2} and set {3} to that chosen directory on Dev Drive</value>
202202
<comment>Optimizer dev drive description</comment>
203203
</data>
204+
<data name="OptimizerDevDriveDescriptionWithEnvVarNotSet" xml:space="preserve">
205+
<value>Move contents of {0} to a directory on Dev Drive such as {1} and set {2} to that chosen directory on Dev Drive</value>
206+
<comment>Optimizer dev drive description when environment variable is not set</comment>
207+
</data>
204208
<data name="SettingsAutoSuggestBox.PlaceholderText" xml:space="preserve">
205209
<value>Search</value>
206210
<comment>The placholder text for the settings auto suggest box</comment>

tools/Customization/DevHome.Customization/ViewModels/DevDriveInsights/DevDriveOptimizerCardViewModel.cs

+12-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public DevDriveOptimizerCardViewModel(
6262
string existingCacheLocation,
6363
string exampleLocationOnDevDrive,
6464
string environmentVariableToBeSet,
65-
List<string> existingDevDriveLetters)
65+
List<string> existingDevDriveLetters,
66+
bool environmentVariableHasValue)
6667
{
6768
OptimizeDevDriveDialogViewModelFactory = optimizeDevDriveDialogViewModelFactory;
6869
ExistingDevDriveLetters = existingDevDriveLetters;
@@ -71,7 +72,16 @@ public DevDriveOptimizerCardViewModel(
7172
ExampleLocationOnDevDrive = exampleLocationOnDevDrive;
7273
EnvironmentVariableToBeSet = environmentVariableToBeSet;
7374
var stringResource = new StringResource("DevHome.Customization.pri", "DevHome.Customization/Resources");
74-
OptimizerDevDriveDescription = stringResource.GetLocalized("OptimizerDevDriveDescription", EnvironmentVariableToBeSet, ExistingCacheLocation, ExampleLocationOnDevDrive, EnvironmentVariableToBeSet);
75+
76+
if (environmentVariableHasValue)
77+
{
78+
OptimizerDevDriveDescription = stringResource.GetLocalized("OptimizerDevDriveDescription", EnvironmentVariableToBeSet, ExistingCacheLocation, ExampleLocationOnDevDrive, EnvironmentVariableToBeSet);
79+
}
80+
else
81+
{
82+
OptimizerDevDriveDescription = stringResource.GetLocalized("OptimizerDevDriveDescriptionWithEnvVarNotSet", ExistingCacheLocation, ExampleLocationOnDevDrive, EnvironmentVariableToBeSet);
83+
}
84+
7585
MakeTheChangeText = stringResource.GetLocalized("MakeTheChangeText");
7686
DevDriveOptimizationSuggestion = stringResource.GetLocalized("DevDriveOptimizationSuggestion");
7787
}

tools/Customization/DevHome.Customization/ViewModels/DevDriveInsightsViewModel.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -330,12 +330,11 @@ public void UpdateListViewModelList()
330330
var matchingSubdirectory = subDirectories.FirstOrDefault(subdir => subdir.StartsWith(cacheDirectory, StringComparison.OrdinalIgnoreCase));
331331
if (Directory.Exists(matchingSubdirectory))
332332
{
333-
if (matchingSubdirectory.Contains("PythonSoftwareFoundation"))
333+
var actualCacheDirectory = Path.Join(matchingSubdirectory, "LocalCache", "Local", "pip", CacheStr);
334+
if (matchingSubdirectory.Contains("PythonSoftwareFoundation") && Directory.Exists(actualCacheDirectory))
334335
{
335-
return Path.Join(matchingSubdirectory, "LocalCache", "Local", "pip", CacheStr);
336+
return actualCacheDirectory;
336337
}
337-
338-
return matchingSubdirectory;
339338
}
340339
}
341340
}
@@ -381,7 +380,8 @@ public void UpdateOptimizerListViewModelList()
381380
existingCacheLocation,
382381
exampleDirectory!, // example location on dev drive to move cache to
383382
cache.EnvironmentVariable!, // environmentVariableToBeSet
384-
existingDevDriveLetters);
383+
existingDevDriveLetters,
384+
!string.IsNullOrEmpty(environmentVariablePath));
385385
DevDriveOptimizerCardCollection.Add(card);
386386
}
387387

tools/Customization/DevHome.Customization/Views/DevDriveInsightsPage.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
<ScrollView VerticalAlignment="Top">
1111
<Grid MaxWidth="{ThemeResource MaxPageContentWidth}" Margin="{ThemeResource ContentPageMargin}">
1212
<views:DevDriveInsightsView />
13-
</Grid>
13+
</Grid>
1414
</ScrollView>
1515
</Page>

tools/Customization/DevHome.Customization/Views/DevDriveInsightsView.xaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
<!--- Template for dev drive horizontal cards on the dev insights page. -->
2626
<DataTemplate x:Key="HorizontalCardForDevDriveInsightsPage" x:DataType="devViewModels:DevDriveCardViewModel">
27-
<ctControls:SettingsExpander Header="{Binding DevDriveLabel, Mode=OneWay}">
28-
<ctControls:SettingsExpander.HeaderIcon>
27+
<ctControls:SettingsCard Header="{Binding DevDriveLabel, Mode=OneWay}">
28+
<ctControls:SettingsCard.HeaderIcon>
2929
<FontIcon Glyph="&#xEDA2;" FontSize="25" FontFamily="{ThemeResource AmcFluentIcons}"/>
30-
</ctControls:SettingsExpander.HeaderIcon>
30+
</ctControls:SettingsCard.HeaderIcon>
3131
<Grid Grid.Column="2">
3232
<Grid.RowDefinitions>
3333
<RowDefinition Height="Auto" />
@@ -39,15 +39,15 @@
3939
</TextBlock>
4040
<ProgressBar Grid.Row="1" Width="200" Value="{x:Bind DevDriveFillPercentage, Mode=OneWay}" HorizontalAlignment="Right" />
4141
<Grid Grid.Row="2">
42-
<TextBlock Style="{StaticResource CardBodyStackPanelAltTextBlockStyle}" HorizontalAlignment="Right" Margin="0 0 120 0">
42+
<TextBlock Style="{StaticResource CardBodyStackPanelAltTextBlockStyle}" HorizontalAlignment="Right" Margin="0 0 120 0">
4343
<Run Text="{Binding Path=DevDriveUsedSizeText, Mode=OneWay}" />
4444
</TextBlock>
45-
<TextBlock Style="{StaticResource CardBodyStackPanelAltTextBlockStyle}" HorizontalAlignment="Right">
45+
<TextBlock Style="{StaticResource CardBodyStackPanelAltTextBlockStyle}" HorizontalAlignment="Right">
4646
<Run Text="{Binding Path=DevDriveFreeSizeText, Mode=OneWay}" />
4747
</TextBlock>
4848
</Grid>
4949
</Grid>
50-
</ctControls:SettingsExpander>
50+
</ctControls:SettingsCard>
5151
</DataTemplate>
5252

5353

tools/Dashboard/DevHome.Dashboard/Services/IWidgetHostingService.cs

+17
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,34 @@ namespace DevHome.Dashboard.Services;
99

1010
public interface IWidgetHostingService
1111
{
12+
/// <summary>Get the list of current widgets from the WidgetService.</summary>
13+
/// <returns>A list of widgets, or empty list if there were no widgets or the list could not be retrieved.</returns>
1214
public Task<Widget[]> GetWidgetsAsync();
1315

16+
/// <summary>Gets the widget with the given ID.</summary>
17+
/// <returns>The widget, or null if one could not be retrieved.</returns>
1418
public Task<Widget> GetWidgetAsync(string widgetId);
1519

20+
/// <summary>Create and return a new widget.</summary>
21+
/// <returns>The new widget, or null if one could not be created.</returns>
1622
public Task<Widget> CreateWidgetAsync(string widgetDefinitionId, WidgetSize widgetSize);
1723

24+
/// <summary>Get the catalog of widgets from the WidgetService.</summary>
25+
/// <returns>The catalog of widgets, or null if one could not be created.</returns>
1826
public Task<WidgetCatalog> GetWidgetCatalogAsync();
1927

28+
/// <summary>Get the list of WidgetProviderDefinitions from the WidgetService.</summary>
29+
/// <returns>A list of WidgetProviderDefinitions, or an empty list if there were no widgets
30+
/// or the list could not be retrieved.</returns>
2031
public Task<WidgetProviderDefinition[]> GetProviderDefinitionsAsync();
2132

33+
/// <summary>Get the list of WidgetDefinitions from the WidgetService.</summary>
34+
/// <returns>A list of WidgetDefinitions, or an empty list if there were no widgets
35+
/// or the list could not be retrieved.</returns>
2236
public Task<WidgetDefinition[]> GetWidgetDefinitionsAsync();
2337

38+
/// <summary>Get the WidgetDefinition for the given WidgetDefinitionId from the WidgetService.</summary>
39+
/// <returns>The WidgetDefinition, or null if the widget definition could not be found
40+
/// or there was an error retrieving it.</returns>
2441
public Task<WidgetDefinition> GetWidgetDefinitionAsync(string widgetDefinitionId);
2542
}

tools/Dashboard/DevHome.Dashboard/Services/WidgetHostingService.cs

+9-31
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ public class WidgetHostingService : IWidgetHostingService
2323

2424
private const int MaxAttempts = 3;
2525

26-
/// <summary>
27-
/// Get the list of current widgets from the WidgetService.
28-
/// </summary>
29-
/// <returns>A list of widgets, or null if there were no widgets or the list could not be retrieved.</returns>
26+
/// <inheritdoc />
3027
public async Task<Widget[]> GetWidgetsAsync()
3128
{
3229
var attempt = 0;
@@ -35,7 +32,7 @@ public async Task<Widget[]> GetWidgetsAsync()
3532
try
3633
{
3734
_widgetHost ??= await Task.Run(() => WidgetHost.Register(new WidgetHostContext("BAA93438-9B07-4554-AD09-7ACCD7D4F031")));
38-
return await Task.Run(() => _widgetHost.GetWidgets());
35+
return await Task.Run(() => _widgetHost.GetWidgets()) ?? [];
3936
}
4037
catch (COMException ex) when (ex.HResult == RpcServerUnavailable || ex.HResult == RpcCallFailed)
4138
{
@@ -52,11 +49,10 @@ public async Task<Widget[]> GetWidgetsAsync()
5249
}
5350
}
5451

55-
return null;
52+
return [];
5653
}
5754

58-
/// <summary>Gets the widget with the given ID.</summary>
59-
/// <returns>The widget, or null if one could not be retrieved.</returns>
55+
/// <inheritdoc />
6056
public async Task<Widget> GetWidgetAsync(string widgetId)
6157
{
6258
var attempt = 0;
@@ -83,10 +79,7 @@ public async Task<Widget> GetWidgetAsync(string widgetId)
8379
return null;
8480
}
8581

86-
/// <summary>
87-
/// Create and return a new widget.
88-
/// </summary>
89-
/// <returns>The new widget, or null if one could not be created.</returns>
82+
/// <inheritdoc />
9083
public async Task<Widget> CreateWidgetAsync(string widgetDefinitionId, WidgetSize widgetSize)
9184
{
9285
var attempt = 0;
@@ -113,10 +106,7 @@ public async Task<Widget> CreateWidgetAsync(string widgetDefinitionId, WidgetSiz
113106
return null;
114107
}
115108

116-
/// <summary>
117-
/// Get the catalog of widgets from the WidgetService.
118-
/// </summary>
119-
/// <returns>The catalog of widgets, or null if one could not be created.</returns>
109+
/// <inheritdoc />
120110
public async Task<WidgetCatalog> GetWidgetCatalogAsync()
121111
{
122112
var attempt = 0;
@@ -149,11 +139,7 @@ public async Task<WidgetCatalog> GetWidgetCatalogAsync()
149139
return _widgetCatalog;
150140
}
151141

152-
/// <summary>
153-
/// Get the list of WidgetProviderDefinitions from the WidgetService.
154-
/// </summary>
155-
/// <returns>A list of WidgetProviderDefinitions, or an empty list if there were no widgets
156-
/// or the list could not be retrieved.</returns>
142+
/// <inheritdoc />
157143
public async Task<WidgetProviderDefinition[]> GetProviderDefinitionsAsync()
158144
{
159145
var attempt = 0;
@@ -182,11 +168,7 @@ public async Task<WidgetProviderDefinition[]> GetProviderDefinitionsAsync()
182168
return [];
183169
}
184170

185-
/// <summary>
186-
/// Get the list of WidgetDefinitions from the WidgetService.
187-
/// </summary>
188-
/// <returns>A list of WidgetDefinitions, or an empty list if there were no widgets
189-
/// or the list could not be retrieved.</returns>
171+
/// <inheritdoc />
190172
public async Task<WidgetDefinition[]> GetWidgetDefinitionsAsync()
191173
{
192174
var attempt = 0;
@@ -215,11 +197,7 @@ public async Task<WidgetDefinition[]> GetWidgetDefinitionsAsync()
215197
return [];
216198
}
217199

218-
/// <summary>
219-
/// Get the WidgetDefinition for the given WidgetDefinitionId from the WidgetService.
220-
/// </summary>
221-
/// <returns>The WidgetDefinition, or null if the widget definition could not be found
222-
/// or there was an error retrieving it.</returns>
200+
/// <inheritdoc />
223201
public async Task<WidgetDefinition> GetWidgetDefinitionAsync(string widgetDefinitionId)
224202
{
225203
var attempt = 0;

tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml.cs

+5-7
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,14 @@ private async Task InitializeDashboard()
217217
private async Task InitializePinnedWidgetListAsync(bool isFirstDashboardRun)
218218
{
219219
var hostWidgets = await GetPreviouslyPinnedWidgets();
220-
221-
if ((hostWidgets == null || hostWidgets.Length == 0) && isFirstDashboardRun)
220+
if ((hostWidgets.Length == 0) && isFirstDashboardRun)
222221
{
223222
// If it's the first time the Dashboard has been displayed and we have no other widgets pinned to a
224223
// different version of Dev Home, pin some default widgets.
225224
_log.Information($"Pin default widgets");
226225
await PinDefaultWidgetsAsync();
227226
}
228-
else if (hostWidgets != null)
227+
else
229228
{
230229
await RestorePinnedWidgetsAsync(hostWidgets);
231230
}
@@ -235,11 +234,10 @@ private async Task<ComSafeWidget[]> GetPreviouslyPinnedWidgets()
235234
{
236235
_log.Information("Get widgets for current host");
237236
var unsafeHostWidgets = await ViewModel.WidgetHostingService.GetWidgetsAsync();
238-
239-
if (unsafeHostWidgets == null)
237+
if (unsafeHostWidgets.Length == 0)
240238
{
241239
_log.Information($"Found 0 widgets for this host");
242-
return null;
240+
return [];
243241
}
244242

245243
var comSafeHostWidgets = new List<ComSafeWidget>();
@@ -380,7 +378,7 @@ private async Task DeleteAbandonedWidgetAsync(ComSafeWidget widget)
380378
await widget.DeleteAsync();
381379

382380
var newWidgetList = await ViewModel.WidgetHostingService.GetWidgetsAsync();
383-
length = (newWidgetList == null) ? 0 : newWidgetList.Length;
381+
length = newWidgetList.Length;
384382
_log.Information($"After delete, {length} widgets for this host");
385383
}
386384

tools/QuietBackgroundProcesses/DevHome.QuietBackgroundProcesses.UI/Views/QuietBackgroundProcessesView.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<!-- Header icon -->
1414
<ctControls:SettingsExpander.HeaderIcon>
15-
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xefff;"/>
15+
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xe9d9;"/>
1616
</ctControls:SettingsExpander.HeaderIcon>
1717

1818
<!-- Quiet session setting area -->
Loading
Loading

tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw

+5-5
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@
222222
<comment>{Locked="{0}"}Title for the page showing the contents of a configuration file. {0} is replaced by the configuration file name.</comment>
223223
</data>
224224
<data name="ConfigurationActivationFailedDisabled" xml:space="preserve">
225-
<value>Winget configuration is currently disabled on your machine. We are initiating the enablement process, which may take a few minutes. Please try again soon.</value>
226-
<comment>Message displayed to the user when they attempt to activate Dev Home from a file but the Winget configuration feature is disabled.</comment>
225+
<value>WinGet configuration is currently disabled on your machine. We are initiating the enablement process, which may take a few minutes. Please try again soon.</value>
226+
<comment>Message displayed to the user when they attempt to activate Dev Home from a file but the WinGet configuration feature is disabled.</comment>
227227
</data>
228228
<data name="ConfigurationActivationFailedBusy" xml:space="preserve">
229229
<value>The DSC flow cannot be activated while machine configuration is in progress. Please complete your current configuration tasks and then try again.</value>
@@ -526,7 +526,7 @@
526526
<comment>Header text for a group of controls giving multiple choices for configuring the machine, but not a full setup flow</comment>
527527
</data>
528528
<data name="MainPage_SetupFlow.Description" xml:space="preserve">
529-
<value>Clone repositories, install applications, and generate Winget Configuration files together</value>
529+
<value>Clone repositories, install applications, and generate WinGet Configuration files together.</value>
530530
<comment>Body text description for a card than when clicked takes the user to a multi-step flow for setting up their machine</comment>
531531
</data>
532532
<data name="MainPage_SetupFlow.Header" xml:space="preserve">
@@ -538,7 +538,7 @@
538538
<comment>Header for a card that when clicked takes the user to a multi-step flow for setting up for a remote machine</comment>
539539
</data>
540540
<data name="MainPage_SetupFlow_For_target.Description" xml:space="preserve">
541-
<value>Clone repositories, install applications, and generate a Winget Configuration file to apply to an environment.</value>
541+
<value>Clone repositories, install applications, and generate a WinGet Configuration file to apply to an environment.</value>
542542
<comment>Body text description for a card than when clicked takes the user to a multi-step flow for setting up their machine</comment>
543543
</data>
544544
<data name="NoAppsToInstall.Text" xml:space="preserve">
@@ -1573,7 +1573,7 @@
15731573
<comment>Text for when the configuration operation on a remote machine is on going but the extension is waiting for the current user to logon to the machine</comment>
15741574
</data>
15751575
<data name="SetupTargetConfigurationSkipped" xml:space="preserve">
1576-
<value>Winget skipped this unit</value>
1576+
<value>WinGet skipped this unit</value>
15771577
<comment>Text for when the a part of the configuration on the remove machine was completed but its completed status was set to skipped.</comment>
15781578
</data>
15791579
<data name="SetupTargetConfigurationOpenConfigFailed" xml:space="preserve">

tools/SetupFlow/DevHome.SetupFlow/ViewModels/LoadingViewModel.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ public partial class LoadingViewModel : SetupPageViewModelBase
3838
private static readonly BitmapImage DarkCaution = new(new Uri("ms-appx:///DevHome.SetupFlow/Assets/DarkCaution.png"));
3939
private static readonly BitmapImage DarkError = new(new Uri("ms-appx:///DevHome.SetupFlow/Assets/DarkError.png"));
4040
private static readonly BitmapImage DarkSuccess = new(new Uri("ms-appx:///DevHome.SetupFlow/Assets/DarkSuccess.png"));
41-
private static readonly BitmapImage DarkInfo = new(new Uri("ms-appx:///DevHome.SetupFlow/Assets/DarkCaution.png"));
41+
private static readonly BitmapImage DarkInfo = new(new Uri("ms-appx:///DevHome.SetupFlow/Assets/DarkInfo.png"));
4242
private static readonly BitmapImage LightCaution = new(new Uri("ms-appx:///DevHome.SetupFlow/Assets/LightCaution.png"));
4343
private static readonly BitmapImage LightError = new(new Uri("ms-appx:///DevHome.SetupFlow/Assets/LightError.png"));
4444
private static readonly BitmapImage LightSuccess = new(new Uri("ms-appx:///DevHome.SetupFlow/Assets/LightSuccess.png"));
45-
private static readonly BitmapImage LightInfo = new(new Uri("ms-appx:///DevHome.SetupFlow/Assets/LightCaution.png"));
45+
private static readonly BitmapImage LightInfo = new(new Uri("ms-appx:///DevHome.SetupFlow/Assets/LightInfo.png"));
4646

4747
#pragma warning disable SA1310 // Field names should not contain underscore
4848
private const int MAX_RETRIES = 1;

0 commit comments

Comments
 (0)