Skip to content

Commit

Permalink
single New Package Download Path (DynamoDS#14559)
Browse files Browse the repository at this point in the history
* single New Package Download Path

- just shows the currently selected package download path

* null check, typos

---------

Co-authored-by: Aaron (Qilong) <[email protected]>
  • Loading branch information
dnenov and QilongTang authored Nov 4, 2023
1 parent 425c6e5 commit 0304338
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Dynamo.Controls;
using System;
using System.Collections.ObjectModel;
using Dynamo.ViewModels;
using NotificationObject = Dynamo.Core.NotificationObject;
using System.Collections.ObjectModel;

namespace Dynamo.PackageManager
{
Expand Down Expand Up @@ -53,6 +53,12 @@ public PackageManagerViewModel(DynamoViewModel dynamoViewModel, PackageManagerSe
PkgSearchVM.RegisterTransientHandlers();

LocalPackages.CollectionChanged += LocalPackages_CollectionChanged;

// We are forced to make the update ourselves if the Preferences ViewModel has not been initialized yet
if (String.IsNullOrEmpty(PreferencesViewModel?.SelectedPackagePathForInstall))
{
PreferencesViewModel.SelectedPackagePathForInstall = dynamoViewModel.PreferenceSettings.SelectedPackagePathForInstall;
}
}

private void LocalPackages_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
Expand Down
27 changes: 19 additions & 8 deletions src/DynamoCoreWpf/Views/PackageManager/PackageManagerView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@
<controls:EmptyListToVisibilityConverter x:Key="EmptyListToVisibilityConverter" />
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

<Style x:Key="PkgMngTextBlockStyle" TargetType="TextBlock">
<Setter Property="Width" Value="Auto" />
<Setter Property="Margin" Value="0 5" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Background" Value="#2F2E30" />
<Setter Property="Foreground" Value="#EEEEEE" />
<Setter Property="FontFamily" Value="{StaticResource ArtifaktElementRegular}" />
<Setter Property="FontStyle" Value="Normal" />
<Setter Property="FontSize" Value="12px " />
<Setter Property="Focusable" Value="False" />
<Setter Property="Padding" Value="5 10"/>
</Style>
<Style x:Key="PkgMngListBoxStyle" TargetType="ListBox">
<Setter Property="Width" Value="Auto" />
<Setter Property="Margin" Value="0 5" />
Expand Down Expand Up @@ -486,17 +498,16 @@
Style="{StaticResource GenericToolTipLight}" />
</Label.ToolTip>
</Label>
<ListBox Grid.Row="1"
<!-- Default download path -->
<TextBlock Grid.Row="1"
x:Name="PackageDownloadDirectoryListBox"
Style="{DynamicResource PkgMngListBoxStyle}"
ItemContainerStyle="{DynamicResource PkgMngListBoxItemStyle}"
ItemsSource="{Binding Path=PackagePathsForInstall}"
SelectedItem="{Binding Path=SelectedPackagePathForInstall}">
<ListBox.ToolTip>
Style="{StaticResource PkgMngTextBlockStyle}"
Text="{Binding Path=SelectedPackagePathForInstall, UpdateSourceTrigger=PropertyChanged}">
<TextBlock.ToolTip>
<ToolTip Content="{Binding Path=SelectedPackagePathForInstall}"
Style="{StaticResource GenericToolTipLight}" />
</ListBox.ToolTip>
</ListBox>
</TextBlock.ToolTip>
</TextBlock>

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

0 comments on commit 0304338

Please sign in to comment.