Skip to content

Commit 0304338

Browse files
dnenovQilongTang
andauthored
single New Package Download Path (#14559)
* single New Package Download Path - just shows the currently selected package download path * null check, typos --------- Co-authored-by: Aaron (Qilong) <[email protected]>
1 parent 425c6e5 commit 0304338

File tree

2 files changed

+27
-10
lines changed

2 files changed

+27
-10
lines changed

src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerViewModel.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using Dynamo.Controls;
1+
using System;
2+
using System.Collections.ObjectModel;
23
using Dynamo.ViewModels;
34
using NotificationObject = Dynamo.Core.NotificationObject;
4-
using System.Collections.ObjectModel;
55

66
namespace Dynamo.PackageManager
77
{
@@ -53,6 +53,12 @@ public PackageManagerViewModel(DynamoViewModel dynamoViewModel, PackageManagerSe
5353
PkgSearchVM.RegisterTransientHandlers();
5454

5555
LocalPackages.CollectionChanged += LocalPackages_CollectionChanged;
56+
57+
// We are forced to make the update ourselves if the Preferences ViewModel has not been initialized yet
58+
if (String.IsNullOrEmpty(PreferencesViewModel?.SelectedPackagePathForInstall))
59+
{
60+
PreferencesViewModel.SelectedPackagePathForInstall = dynamoViewModel.PreferenceSettings.SelectedPackagePathForInstall;
61+
}
5662
}
5763

5864
private void LocalPackages_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)

src/DynamoCoreWpf/Views/PackageManager/PackageManagerView.xaml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@
3333
<controls:EmptyListToVisibilityConverter x:Key="EmptyListToVisibilityConverter" />
3434
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
3535

36+
<Style x:Key="PkgMngTextBlockStyle" TargetType="TextBlock">
37+
<Setter Property="Width" Value="Auto" />
38+
<Setter Property="Margin" Value="0 5" />
39+
<Setter Property="HorizontalAlignment" Value="Stretch" />
40+
<Setter Property="Background" Value="#2F2E30" />
41+
<Setter Property="Foreground" Value="#EEEEEE" />
42+
<Setter Property="FontFamily" Value="{StaticResource ArtifaktElementRegular}" />
43+
<Setter Property="FontStyle" Value="Normal" />
44+
<Setter Property="FontSize" Value="12px " />
45+
<Setter Property="Focusable" Value="False" />
46+
<Setter Property="Padding" Value="5 10"/>
47+
</Style>
3648
<Style x:Key="PkgMngListBoxStyle" TargetType="ListBox">
3749
<Setter Property="Width" Value="Auto" />
3850
<Setter Property="Margin" Value="0 5" />
@@ -486,17 +498,16 @@
486498
Style="{StaticResource GenericToolTipLight}" />
487499
</Label.ToolTip>
488500
</Label>
489-
<ListBox Grid.Row="1"
501+
<!-- Default download path -->
502+
<TextBlock Grid.Row="1"
490503
x:Name="PackageDownloadDirectoryListBox"
491-
Style="{DynamicResource PkgMngListBoxStyle}"
492-
ItemContainerStyle="{DynamicResource PkgMngListBoxItemStyle}"
493-
ItemsSource="{Binding Path=PackagePathsForInstall}"
494-
SelectedItem="{Binding Path=SelectedPackagePathForInstall}">
495-
<ListBox.ToolTip>
504+
Style="{StaticResource PkgMngTextBlockStyle}"
505+
Text="{Binding Path=SelectedPackagePathForInstall, UpdateSourceTrigger=PropertyChanged}">
506+
<TextBlock.ToolTip>
496507
<ToolTip Content="{Binding Path=SelectedPackagePathForInstall}"
497508
Style="{StaticResource GenericToolTipLight}" />
498-
</ListBox.ToolTip>
499-
</ListBox>
509+
</TextBlock.ToolTip>
510+
</TextBlock>
500511

501512
<Label Content="{x:Static p:Resources.PackagePathPreferencesTitle}"
502513
Padding="5,5,5,5"

0 commit comments

Comments
 (0)