Skip to content

Commit

Permalink
Fix C2D when trying to copy an item in the Packages screen
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinotorowski committed Feb 1, 2021
1 parent 0a33de7 commit 5498e2d
Showing 1 changed file with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,39 @@ private void OnOpenStore()

private void OnCopy(object parameter)
{
Clipboard.SetText((string)parameter);
var requiredParameter = (PackageProperty)parameter;

var toCopy = new StringBuilder();

foreach (var pkg in this.application.ApplicationState.Packages.SelectedPackages)
{
switch (requiredParameter)
{
case PackageProperty.Name:
toCopy.AppendLine(pkg.Name);
break;
case PackageProperty.DisplayName:
toCopy.AppendLine(pkg.DisplayName);
break;
case PackageProperty.FullName:
toCopy.AppendLine(pkg.PackageId);
break;
case PackageProperty.Version:
toCopy.AppendLine(pkg.Version.ToString());
break;
case PackageProperty.Publisher:
toCopy.AppendLine(pkg.DisplayPublisherName);
break;
case PackageProperty.Subject:
toCopy.AppendLine(pkg.Publisher);
break;
case PackageProperty.InstallPath:
toCopy.AppendLine(pkg.InstallLocation);
break;
}
}

Clipboard.SetText(toCopy.ToString().TrimEnd(), TextDataFormat.Text);
}

private bool CanCopy(object parameter)
Expand Down

0 comments on commit 5498e2d

Please sign in to comment.