Esempio n. 1
0
        public void UpdateAlbumCollectionRate(IRateCalculator rateCalculator)
        {
            if (rateCalculator == null)
            {
                return;
            }

            var rates = _albums.Select(a => a.Rate);

            AlbumCollectionRate = rateCalculator.Calculate(rates);
        }
Esempio n. 2
0
 public OptionsService(ILeagueRepository leagueRepository,
                       IRatesRepository rateRepository,
                       ILeagueManager leagueManager,
                       ITeamManager teamManager,
                       IGameManager gameManager,
                       IRelationCreator relationCreator,
                       IRateCalculator rateCalculator,
                       IOptions <RapidApiConfiguration> configuration,
                       IStringLocalizer <InformationMessages> localizer)
 {
     _leagueRepository = leagueRepository;
     _rateRepository   = rateRepository;
     _leagueManager    = leagueManager;
     _teamManager      = teamManager;
     _gameManager      = gameManager;
     _relationCreator  = relationCreator;
     _rateCalculator   = rateCalculator;
     _localizer        = localizer;
     _configuration    = configuration.Value;
 }
Esempio n. 3
0
 public BaseRateCalculator(IRateCalculator successor)
 {
     Successor = successor;
 }
Esempio n. 4
0
 public CalculatorInjector(IRateCalculator rateCalculator)
 {
     _rateCalculator = rateCalculator;
 }
Esempio n. 5
0
 public WeekendRateCalculator(IRateCalculator successor)
     : base(successor)
 {
 }
Esempio n. 6
0
        public MainViewModel(IUnitOfWork unitOfWork,
                             IPerformerService performerService,
                             IAlbumService albumService,
                             IRateCalculator rateCalculator)
        {
            Guard.AgainstNull(unitOfWork);
            Guard.AgainstNull(performerService);
            Guard.AgainstNull(albumService);
            Guard.AgainstNull(rateCalculator);

            _unitOfWork       = unitOfWork;
            _performerService = performerService;
            _albumService     = albumService;
            _rateCalculator   = rateCalculator;

            // setting up all commands (quite a lot of them)

            GeneralViewCommand = new RelayCommand(() =>
            {
                if (SelectedAlbum != null)
                {
                    ViewSelectedAlbum();
                }
                else
                {
                    ViewSelectedPerformer();
                }
            });

            GeneralDeleteCommand = new RelayCommand(() =>
            {
                if (SelectedAlbum != null)
                {
                    RemoveSelectedAlbumAsync();
                }
                else
                {
                    RemoveSelectedPerformerAsync();
                }
            });

            GeneralEditCommand = new RelayCommand(() =>
            {
                if (SelectedAlbum != null)
                {
                    EditAlbum();
                }
                else
                {
                    EditPerformer();
                }
            });

            IndexLetterCommand = new RelayCommand(param =>
            {
                _filter = PerformerFilters.FilterByFirstLetter;
                ActivateUpperPanel(false);
                IndexLetter = param.ToString();
                ActivateUpperPanel(true);
            });

            IndexPageCommand = new RelayCommand(NavigatePage);

            ViewPerformerCommand   = new RelayCommand(ViewSelectedPerformer);
            EditPerformerCommand   = new RelayCommand(EditPerformer);
            EditCountriesCommand   = new RelayCommand(EditCountries);
            EditMusiciansCommand   = new RelayCommand(() => { });
            ViewAlbumCommand       = new RelayCommand(ViewSelectedAlbum);
            EditAlbumCommand       = new RelayCommand(EditAlbum);
            AddPerformerCommand    = new RelayCommand(AddPerformerAsync);
            AddAlbumCommand        = new RelayCommand(AddAlbumAsync);
            DeletePerformerCommand = new RelayCommand(RemoveSelectedPerformerAsync);
            DeleteAlbumCommand     = new RelayCommand(RemoveSelectedAlbumAsync);
            BeginMoveAlbumCommand  = new RelayCommand(BeginMoveAlbum);
            MoveAlbumCommand       = new RelayCommand(MoveAlbum);
            PerformerSearchCommand = new RelayCommand(async() => await SelectPerformersByPatternAsync());
            StartRadioCommand      = new RelayCommand(async() => await StartRadioAsync());
            StatsCommand           = new RelayCommand(ShowStats);
            SettingsCommand        = new RelayCommand(ShowSettings);
            HelpCommand            = new RelayCommand(ShowHelp);

            // create navigation panel
            CreateUpperNavigationPanel();
            // and select the initial set of performers (starting with "A")
            IndexLetter = "A";
        }
Esempio n. 7
0
        public MainWindowViewModel(IEventAggregator eventAggregator,
                                   IUnitOfWork unitOfWork,
                                   IPerformerService performerService,
                                   IAlbumService albumService,
                                   IRateCalculator rateCalculator,
                                   IDialogService dialogService)
        {
            Guard.AgainstNull(eventAggregator);
            Guard.AgainstNull(unitOfWork);
            Guard.AgainstNull(performerService);
            Guard.AgainstNull(albumService);
            Guard.AgainstNull(rateCalculator);
            Guard.AgainstNull(dialogService);

            _eventAggregator  = eventAggregator;
            _unitOfWork       = unitOfWork;
            _performerService = performerService;
            _albumService     = albumService;
            _rateCalculator   = rateCalculator;
            _dialogService    = dialogService;

            _eventAggregator
            .GetEvent <AlbumRateUpdatedEvent>()
            .Subscribe(UpdateRate, ThreadOption.UIThread);

            _moveAlbumService = new MoveAlbumService(_dialogService);


            // setting up all commands (quite a lot of them)

            GeneralViewCommand = new DelegateCommand(() =>
            {
                if (_selectedAlbum != null)
                {
                    ViewSelectedAlbum();
                }
                else
                {
                    ViewSelectedPerformer();
                }
            });

            GeneralDeleteCommand = new DelegateCommand(() =>
            {
                if (_selectedAlbum != null)
                {
                    RemoveSelectedAlbumAsync();
                }
                else
                {
                    RemoveSelectedPerformerAsync();
                }
            });

            GeneralEditCommand = new DelegateCommand(() =>
            {
                if (_selectedAlbum != null)
                {
                    EditAlbum();
                }
                else
                {
                    EditPerformer();
                }
            });

            ViewPerformerCommand   = new DelegateCommand(ViewSelectedPerformer);
            EditPerformerCommand   = new DelegateCommand(EditPerformer);
            EditCountriesCommand   = new DelegateCommand(EditCountries);
            ViewAlbumCommand       = new DelegateCommand(ViewSelectedAlbum);
            EditAlbumCommand       = new DelegateCommand(EditAlbum);
            AddPerformerCommand    = new DelegateCommand(AddPerformerAsync);
            AddAlbumCommand        = new DelegateCommand(AddAlbumAsync);
            DeletePerformerCommand = new DelegateCommand(RemoveSelectedPerformerAsync);
            DeleteAlbumCommand     = new DelegateCommand(RemoveSelectedAlbumAsync);
            BeginMoveAlbumCommand  = new DelegateCommand(BeginMoveAlbum);
            MoveAlbumCommand       = new DelegateCommand(async() => await MoveAlbumAsync());
            PerformerSearchCommand = new DelegateCommand(async() => await SelectPerformersByPatternAsync());
            StartRadioCommand      = new DelegateCommand(StartRadio);
            StatsCommand           = new DelegateCommand(ShowStats);
            SettingsCommand        = new DelegateCommand(ShowSettings);
            HelpCommand            = new DelegateCommand(ShowHelp);

            IndexLetterCommand = new DelegateCommand <string>(NavigateLetter);
            IndexPageCommand   = new DelegateCommand <string>(NavigatePage);

            // create navigation panel
            CreateUpperNavigationPanel();

            // and select the initial set of performers (starting with "A")
            IndexLetter = "A";
        }
 public EarlyBirdRateCalculator(IRateCalculator successor)
     : base(successor)
 {
 }
Esempio n. 9
0
 public NightRateCalculator(IRateCalculator successor)
     : base(successor)
 {
 }