public PackageViewModel(IPackageService packageService, IChocolateyService chocolateyService, INavigationService navigationService) { _packageService = packageService; _chocolateyService = chocolateyService; _navigationService = navigationService; PackagesChangedEventManager.AddListener(_chocolateyService, this); _isInstalled = new Lazy <bool>(() => _chocolateyService.IsPackageInstalled(Id, Version)); }
public bool ReceiveWeakEvent(Type managerType, object sender, EventArgs e) { if (sender is IChocolateyService && e is PackagesChangedEventArgs) { _isInstalled = new Lazy <bool>(() => _chocolateyService.IsPackageInstalled(Id, Version)); NotifyPropertyChanged("IsInstalled"); NotifyPropertyChanged("CanUpdate"); } return(true); }