コード例 #1
0
        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));
        }
コード例 #2
0
 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);
 }