示例#1
0
        public MainViewModel(ISettingsRepository settingsRepository, IBeerRepository beerRepository, IInteractionService interactionService, IDrinkerCycleRepository drinkerCycleRepository, IHistoryNavigationService navigationService, IProgressService progressService)
        {
            _settingsRepository = settingsRepository;
            _beerRepository = beerRepository;
            _interactionService = interactionService;
            _drinkerCycleRepository = drinkerCycleRepository;
            _navigationService = navigationService;
            _progressService = progressService;

            _addBeer = new RelayCommand(AddBeer);
            _removeBeer = new RelayCommand(RemoveBeer, () => CanRemoveBeer);
            _addGroup = new RelayCommand(AddGroup, () => CanAddGroup);

            _refreshCommand = new RelayCommand(Refresh, () => CanRefresh);
            _openSettingsCommand = new RelayCommand(OpenSettings);

            Messenger.Default.Register<Messages>(this, EvaluateMessages);

            if (IsInDesignMode)
            {
                DrinkerCycles = _drinkerCycleRepository.GetSampleCycles();
                UserInformation = settingsRepository.GetSampleUserInformations();
            }
            else
            {
                Initialize();
            }
        }