public NavigationCommand(Action action, INavigationService navigationService)
                : base(action)
            {
                Assumes.NotNull(navigationService);

                _navigationService = navigationService;
                _navigationService.CanGoBackChanged += EventServices.MakeWeak(OnCanGoBackChanged, h => _navigationService.CanGoBackChanged -= h);
            }
Ejemplo n.º 2
0
            public NavigationCommand(Action action, INavigationService navigationService)
                : base(action)
            {
                Assumes.NotNull(navigationService);

                _navigationService = navigationService;
                // use navigationService for the Action passed to make weak to ensure we do not root to the command via "this"
                _navigationService.CanGoBackChanged += EventServices.MakeWeak(OnCanGoBackChanged, h => navigationService.CanGoBackChanged -= h);
            }
            public CheckoutCartCommand(ReadOnlyObservableCollection <GroceryItem> groceryItems, IEventAggregator eventAggregator)
            {
                Assumes.NotNull(groceryItems);
                Assumes.NotNull(eventAggregator);

                _groceryItems    = groceryItems;
                _eventAggregator = eventAggregator;

                var collectionChanged = ((INotifyCollectionChanged)groceryItems);

                collectionChanged.CollectionChanged += EventServices.MakeWeak(OnCollectionChanged, h => collectionChanged.CollectionChanged -= h);
            }