diff --git a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerClientViewModel.cs b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerClientViewModel.cs index aca34008833..2b39944a310 100644 --- a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerClientViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerClientViewModel.cs @@ -259,6 +259,12 @@ public string Username public ICommand ToggleLoginStateCommand { get; private set; } + /// + /// Contains all votes the user has been submitted. + /// Will allow the user to vote for a package they have not upvoted before + /// + private List Uservotes { get; set; } + internal PackageManagerClientViewModel(DynamoViewModel dynamoViewModel, PackageManagerClient model ) { this.DynamoViewModel = dynamoViewModel; @@ -276,6 +282,11 @@ internal PackageManagerClientViewModel(DynamoViewModel dynamoViewModel, PackageM RaisePropertyChanged("Username"); }; } + + if (AuthenticationManager.LoginState.Equals(LoginState.LoggedIn)) + { + this.Uservotes = this.Model.UserVotes(); + } } private void ToggleLoginState() @@ -485,6 +496,11 @@ public List ListAll() var ele = new PackageManagerSearchElement(header); ele.UpvoteRequested += this.Model.Upvote; + if (Uservotes != null) + { + ele.HasUpvote = Uservotes.Contains(header._id); + } + CachedPackageList.Add( ele ); } diff --git a/src/DynamoCoreWpf/Views/PackageManager/Controls/PackageManagerPackagesControl.xaml b/src/DynamoCoreWpf/Views/PackageManager/Controls/PackageManagerPackagesControl.xaml index ec0e01e7c4e..e9d66b23f5d 100644 --- a/src/DynamoCoreWpf/Views/PackageManager/Controls/PackageManagerPackagesControl.xaml +++ b/src/DynamoCoreWpf/Views/PackageManager/Controls/PackageManagerPackagesControl.xaml @@ -154,18 +154,16 @@ SelectedIndex="{Binding Path=SelectedIndex}" VirtualizingPanel.ScrollUnit="Pixel"> - + + + + + +