From 7b74464ad6166f0951804307a864376f29bf66d0 Mon Sep 17 00:00:00 2001 From: Jorgen Dahl Date: Thu, 1 Jul 2021 09:56:05 -0400 Subject: [PATCH] Remove old installed packages view (#11791) * update * update * update * update * Update InstalledPackagesControl.xaml * Update icons and icon sizes. * More tweaking.. * More tweaking. Remove delete button. Restore delete button in context menu. * More tweaking * MergeFixes * Some more tweaks * Add contest menu style * update colors * More context menu tweaking. * One small tweak. * add mark for uninstall label * simplify control * Update DynamoModern.xaml * Change ListBox to ItemsControl * More tweaks * More tweaks * Restore Scollbar * Remove unused icon * align content with header and remove border * update * update menu icon * Remove old Installed packages view. * Update InstalledPackagesControl.xaml.cs * Fix Colors * Move style * Use FlatIconButtonStyle * Update comment and use nameof() * Fix merge error. * Update comment. * Fix tests * Keep ManagePackage tracking * Fix project file * Fix command * Update track implementation * More command tweaks Co-authored-by: pinzart Co-authored-by: pinzart90 <46732933+pinzart90@users.noreply.github.com> --- .../Controls/InstalledPackagesControl.xaml.cs | 10 +- src/DynamoCoreWpf/DynamoCoreWpf.csproj | 10 - .../Properties/Resources.Designer.cs | 27 -- .../Properties/Resources.en-US.resx | 9 - src/DynamoCoreWpf/Properties/Resources.resx | 9 - .../PackageManager/PackageViewModel.cs | 13 +- src/DynamoCoreWpf/Views/Core/DynamoView.xaml | 4 - .../Views/Core/DynamoView.xaml.cs | 25 -- .../Views/Menu/PreferencesView.xaml | 12 +- .../Views/Menu/PreferencesView.xaml.cs | 21 ++ .../PackageManager/InstalledPackagesView.xaml | 330 ------------------ .../InstalledPackagesView.xaml.cs | 39 --- .../PackageManagerUITests.cs | 46 +-- 13 files changed, 56 insertions(+), 499 deletions(-) delete mode 100644 src/DynamoCoreWpf/Views/PackageManager/InstalledPackagesView.xaml delete mode 100644 src/DynamoCoreWpf/Views/PackageManager/InstalledPackagesView.xaml.cs diff --git a/src/DynamoCoreWpf/Controls/InstalledPackagesControl.xaml.cs b/src/DynamoCoreWpf/Controls/InstalledPackagesControl.xaml.cs index c30ec6ec2ed..7820fb54655 100644 --- a/src/DynamoCoreWpf/Controls/InstalledPackagesControl.xaml.cs +++ b/src/DynamoCoreWpf/Controls/InstalledPackagesControl.xaml.cs @@ -32,14 +32,6 @@ private void MoreButton_OnClick(object sender, RoutedEventArgs e) button.ContextMenu.DataContext = button.DataContext; button.ContextMenu.IsOpen = true; } - - private void Expander_Expanded(object sender, RoutedEventArgs e) - { - Expander exp = (Expander)sender; - if (exp.DataContext is PackageViewModel pm) - { - pm.ToggleTypesVisibleInManagerCommand.Execute(); - } - } } } + diff --git a/src/DynamoCoreWpf/DynamoCoreWpf.csproj b/src/DynamoCoreWpf/DynamoCoreWpf.csproj index 4104539dbad..7bdb8555ec0 100644 --- a/src/DynamoCoreWpf/DynamoCoreWpf.csproj +++ b/src/DynamoCoreWpf/DynamoCoreWpf.csproj @@ -362,9 +362,6 @@ InfoBubbleView.xaml - - InstalledPackagesView.xaml - LibraryView.xaml @@ -506,7 +503,6 @@ Designer - Always @@ -1168,12 +1164,6 @@ Designer - - - MSBuild:Compile - Designer - - MSBuild:Compile diff --git a/src/DynamoCoreWpf/Properties/Resources.Designer.cs b/src/DynamoCoreWpf/Properties/Resources.Designer.cs index 164ba892a62..b6f5936293c 100644 --- a/src/DynamoCoreWpf/Properties/Resources.Designer.cs +++ b/src/DynamoCoreWpf/Properties/Resources.Designer.cs @@ -2783,24 +2783,6 @@ public static string InstalledPackageViewContextMenuRemoveDeprecationTooltip { } } - /// - /// Looks up a localized string similar to Show Contents. - /// - public static string InstalledPackageViewContextMenuShowContent { - get { - return ResourceManager.GetString("InstalledPackageViewContextMenuShowContent", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to See the types loaded by this package. - /// - public static string InstalledPackageViewContextMenuShowContentTooltip { - get { - return ResourceManager.GetString("InstalledPackageViewContextMenuShowContentTooltip", resourceCulture); - } - } - /// /// Looks up a localized string similar to Show Root Directory. /// @@ -3872,15 +3854,6 @@ public static string PackageHostDependencyTooltip { } } - /// - /// Looks up a localized string similar to Package Manager Website. - /// - public static string PackageManagerWebSiteButton { - get { - return ResourceManager.GetString("PackageManagerWebSiteButton", resourceCulture); - } - } - /// /// Looks up a localized string similar to The name of the package cannot contain /,\, or *.. /// diff --git a/src/DynamoCoreWpf/Properties/Resources.en-US.resx b/src/DynamoCoreWpf/Properties/Resources.en-US.resx index b6327d362f3..65b939a8e9c 100644 --- a/src/DynamoCoreWpf/Properties/Resources.en-US.resx +++ b/src/DynamoCoreWpf/Properties/Resources.en-US.resx @@ -1160,12 +1160,6 @@ Failed to publish file(s): Remove package deprecation. Only allowed if you're a current maintainer of the package. - - Show Contents - - - See the types loaded by this package - Show Root Directory @@ -1527,9 +1521,6 @@ Next assemblies were loaded several times: A problem occurred when trying to install the package. Dynamo is unable to obtain read/write access to {0} - - Package Manager Website - The name of the package cannot contain /,\, or *. ErrorString diff --git a/src/DynamoCoreWpf/Properties/Resources.resx b/src/DynamoCoreWpf/Properties/Resources.resx index 48caae39494..8618d52dc6e 100644 --- a/src/DynamoCoreWpf/Properties/Resources.resx +++ b/src/DynamoCoreWpf/Properties/Resources.resx @@ -1153,12 +1153,6 @@ You will get a chance to save your work. Remove package deprecation. Only allowed if you're a current maintainer of the package. - - Show Contents - - - See the types loaded by this package - Show Root Directory @@ -1237,9 +1231,6 @@ You will get a chance to save your work. Starting - - Package Manager Website - Search returned no results! diff --git a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageViewModel.cs b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageViewModel.cs index a9ed31993a3..bbc986c4635 100644 --- a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageViewModel.cs @@ -45,6 +45,7 @@ public bool HasAssemblies get { return Model.LoadedAssemblies.Any(); } } + [Obsolete("Do not use. This command will be removed. It does nothing.")] public DelegateCommand ToggleTypesVisibleInManagerCommand { get; set; } public DelegateCommand GetLatestVersionCommand { get; set; } public DelegateCommand PublishNewPackageVersionCommand { get; set; } @@ -62,7 +63,7 @@ public PackageViewModel(DynamoViewModel dynamoViewModel, Package model) this.packageManagerClient = pmExtension.PackageManagerClient; Model = model; - ToggleTypesVisibleInManagerCommand = new DelegateCommand(ToggleTypesVisibleInManager, CanToggleTypesVisibleInManager); + ToggleTypesVisibleInManagerCommand = new DelegateCommand(() => { }, () => true); GetLatestVersionCommand = new DelegateCommand(GetLatestVersion, CanGetLatestVersion); PublishNewPackageVersionCommand = new DelegateCommand(() => ExecuteWithTou(PublishNewPackageVersion), CanPublishNewPackageVersion); PublishNewPackageCommand = new DelegateCommand(() => ExecuteWithTou(PublishNewPackage), CanPublishNewPackage); @@ -266,15 +267,5 @@ private bool CanGetLatestVersion() { return false; } - - private void ToggleTypesVisibleInManager() - { - Model.TypesVisibleInManager = !Model.TypesVisibleInManager; - } - - private bool CanToggleTypesVisibleInManager() - { - return true; - } } } diff --git a/src/DynamoCoreWpf/Views/Core/DynamoView.xaml b/src/DynamoCoreWpf/Views/Core/DynamoView.xaml index 703bc5dd6f6..ccb748a85d5 100644 --- a/src/DynamoCoreWpf/Views/Core/DynamoView.xaml +++ b/src/DynamoCoreWpf/Views/Core/DynamoView.xaml @@ -603,10 +603,6 @@ Header="{x:Static p:Resources.DynamoViewPackageMenuSearchPackage}" Command="{Binding Path=DataContext.ShowPackageManagerSearchCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:DynamoView}}}" Name="showPMSearch" /> - { _installedPkgsView = null; cmd.Dispose(); }; - _installedPkgsView.Show(); - - if (_installedPkgsView.IsLoaded && IsLoaded) _installedPkgsView.Owner = this; - } - _installedPkgsView.Focus(); - } - private void ClipBoard_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { dynamoViewModel.CopyCommand.RaiseCanExecuteChanged(); @@ -1531,7 +1507,6 @@ private void WindowClosed(object sender, EventArgs e) //PACKAGE MANAGER dynamoViewModel.RequestPackagePublishDialog -= DynamoViewModelRequestRequestPackageManagerPublish; - dynamoViewModel.RequestManagePackagesDialog -= DynamoViewModelRequestShowInstalledPackages; dynamoViewModel.RequestPackageManagerSearchDialog -= DynamoViewModelRequestShowPackageManagerSearch; //FUNCTION NAME PROMPT diff --git a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml index c371aaefa92..07f9090caeb 100644 --- a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml +++ b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml @@ -744,11 +744,13 @@ - + diff --git a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs index 9f24300ea7c..e58443efdf8 100644 --- a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs +++ b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs @@ -22,6 +22,11 @@ public partial class PreferencesView : Window private readonly PreferencesViewModel viewModel; private readonly DynamoViewModel dynViewModel; + // Used for tracking the manage package command event + // This is not a command any more but we keep it + // around in a compatible way for now + private IDisposable managePackageCommandEvent; + /// /// Constructor of Preferences View /// @@ -82,6 +87,7 @@ private void InitRadioButtonsDescription() /// private void CloseButton_Click(object sender, RoutedEventArgs e) { + managePackageCommandEvent?.Dispose(); Dynamo.Logging.Analytics.TrackEvent( Actions.Close, Categories.Preferences); @@ -250,5 +256,20 @@ private void ReloadCPython_Click(object sender, RoutedEventArgs e) dynViewModel.Model.OnRequestPythonReset("CPython3"); } + private void InstalledPackagesExpander_OnExpanded(object sender, RoutedEventArgs e) + { + if (e.OriginalSource == e.Source) + { + managePackageCommandEvent = Analytics.TrackCommandEvent("ManagePackage"); + } + } + + private void InstalledPackagesExpander_OnCollapsed(object sender, RoutedEventArgs e) + { + if (e.OriginalSource == e.Source) + { + managePackageCommandEvent?.Dispose(); + } + } } } \ No newline at end of file diff --git a/src/DynamoCoreWpf/Views/PackageManager/InstalledPackagesView.xaml b/src/DynamoCoreWpf/Views/PackageManager/InstalledPackagesView.xaml deleted file mode 100644 index 0ac94ffea4a..00000000000 --- a/src/DynamoCoreWpf/Views/PackageManager/InstalledPackagesView.xaml +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -