예제 #1
0
        public BookDetailViewModel(IEventAggregator eventAggregator,
                                   IMetroDialogService metroDialogService,
                                   IRepository <Book> booksRepo,
                                   ILanguageLookupDataService languageLookupDataService,
                                   IPublisherLookupDataService publisherLookupDataService,
                                   IAuthorLookupDataService authorLookupDataService,
                                   IFormatLookupDataService formatLookupDataService,
                                   IGenreLookupDataService genreLookupDataService)
            : base(eventAggregator, metroDialogService)
        {
            this.languageLookupDataService = languageLookupDataService
                                             ?? throw new ArgumentNullException(nameof(languageLookupDataService));
            this.publisherLookupDataService = publisherLookupDataService
                                              ?? throw new ArgumentNullException(nameof(publisherLookupDataService));
            this.authorLookupDataService = authorLookupDataService
                                           ?? throw new ArgumentNullException(nameof(authorLookupDataService));
            this.formatLookupDataService = formatLookupDataService
                                           ?? throw new ArgumentNullException(nameof(formatLookupDataService));
            this.genreLookupDataService = genreLookupDataService
                                          ?? throw new ArgumentNullException(nameof(genreLookupDataService));

            HighlightMouseOverCommand          = new DelegateCommand(HighlightMouseOverExecute);
            HighlightMouseLeaveCommand         = new DelegateCommand(HighlightMouseLeaveExecute);
            SetReadDateCommand                 = new DelegateCommand(SetReadDateExecute);
            AddBookCoverImageCommand           = new DelegateCommand(AddBookCoverImageExecute);
            AddAuthorAsABookAuthorCommand      = new DelegateCommand <LookupItem>(AddBookAuthorExecute);
            AddNewAuthorCommand                = new DelegateCommand(OnAddNewAuthorExecute);
            AddNewPublisherCommand             = new DelegateCommand(OnAddNewPublisherExecute);
            AddNewLanguageCommand              = new DelegateCommand(OnAddNewLanguageExecute);
            RemoveAuthorAsABookAuthorCommand   = new DelegateCommand <Guid?>(RemoveAuthorExecute);
            LanguageSelectionChangedCommand    = new DelegateCommand(OnLanguageSelectionChangedExecute);
            PublisherSelectionChangedCommand   = new DelegateCommand(OnPublisherSelectionChangedExecute);
            RemoveDateAsABookReadDateCommand   = new DelegateCommand <DateTime?>(OnRemoveDateAsABookReadDateExecute);
            ReleaseYearSelectionChangedCommand = new DelegateCommand(OnReleaseYearSelectionChangedExecute);
            ShowSelectedPublisherCommand
                = new DelegateCommand <Guid?>(OnShowSelectedPublisherExecute, OnShowSelectedPublisherCanExecute);
            ShowSelectedAuthorCommand         = new DelegateCommand <Guid?>(OnShowSelectedAuthorExecute, OnShowSelectedAuthorCanExecute);
            ShowSelectedSeriesCommand         = new DelegateCommand <Guid?>(OnShowSelectedSeriesExecute, OnShowSelectedSeriesCanExecute);
            BookFormatSelectionChangedCommand = new DelegateCommand <LookupItem>(OnBookFormatSelectionChangedExecute);
            BookGenreSelectionChangedCommand  = new DelegateCommand <LookupItem>(OnBookGenreSelectionChangedExecute);

            Repository = booksRepo ?? throw new ArgumentNullException(nameof(booksRepo));

            NewReadDate    = DateTime.Today;
            Languages      = new ObservableCollection <LookupItem>();
            Publishers     = new ObservableCollection <LookupItem>();
            Authors        = new ObservableCollection <LookupItem>();
            AllBookFormats = new ObservableCollection <Tuple <LookupItem, bool> >();
            AllBookGenres  = new ObservableCollection <Tuple <LookupItem, bool> >();
            SelectedItem   = new Book();

            YearsList = PopulateYearsMenu();
        }
        public LanguageDetailViewModel(IEventAggregator eventAggregator,
                                       IMetroDialogService metroDialogService,
                                       IRepository <Language> languageRepository,
                                       ILanguageLookupDataService languageLookupService)
            : base(eventAggregator, metroDialogService)
        {
            Repository = languageRepository;
            this.languageLookupService = languageLookupService ?? throw new ArgumentNullException(nameof(languageLookupService));

            ChangeEditedLanguageCommand = new DelegateCommand <Guid?>(OnChangeEditedLanguageExecute);

            SelectedItem = new Language();

            UserMode = (!UserMode.Item1, DetailViewState.EditMode, Brushes.LightGray, !UserMode.Item4).ToTuple();

            Languages = new ObservableCollection <LookupItem>();
        }
        public MainPageViewModel(IEventAggregator eventAggregator, ILanguageLookupDataService languageLookup,
                                 INationalityLookupDataService nationalityLookupDataService,
                                 IFormatLookupDataService formatLookupDataService,
                                 IGenreLookupDataService genreLookupDataService)
        {
            this.eventAggregator = eventAggregator ?? throw new ArgumentNullException(nameof(eventAggregator));
            this.languageLookup  = languageLookup ?? throw new ArgumentNullException(nameof(languageLookup));
            this.nationalityLookupDataService = nationalityLookupDataService ?? throw new ArgumentNullException(nameof(nationalityLookupDataService));
            this.formatLookupDataService      = formatLookupDataService ?? throw new ArgumentNullException(nameof(formatLookupDataService));
            this.genreLookupDataService       = genreLookupDataService ?? throw new ArgumentNullException(nameof(genreLookupDataService));

            AddNewItemCommand        = new DelegateCommand <Type>(OnAddNewItemExecute);
            EditLanguagesCommand     = new DelegateCommand(OnEditLanguagesExecute);
            EditNationalitiesCommand = new DelegateCommand(OnEditNationalitiesExecute);
            EditBookFormatsCommand   = new DelegateCommand(OnEditBookFormatsExecute);
            EditBookGenresCommand    = new DelegateCommand(OnEditBookGenresExecute);
        }
예제 #4
0
 public BookService(IRepository <Book, BookId> repository,
                    ILanguageLookupDataService languageLookupDataService   = null,
                    IPublisherLookupDataService publisherLookupDataService = null,
                    IAuthorLookupDataService authorLookupDataService       = null,
                    IFormatLookupDataService formatLookupDataService       = null,
                    IGenreLookupDataService genreLookupDataService         = null,
                    IGenreService genreService   = null,
                    IFormatService formatService = null)
 {
     Repository = repository ?? throw new ArgumentNullException(nameof(repository));
     _languageLookupDataService  = languageLookupDataService;
     _publisherLookupDataService = publisherLookupDataService;
     _authorLookupDataService    = authorLookupDataService;
     _formatLookupDataService    = formatLookupDataService;
     _genreLookupDataService     = genreLookupDataService;
     _genreService  = genreService;
     _formatService = formatService;
 }
예제 #5
0
 public BookService(IRepository <Book> repository,
                    IFormatRepository formatRepository,
                    IGenreRepository genreRepository,
                    ILanguageLookupDataService languageLookupDataService,
                    IPublisherLookupDataService publisherLookupDataService,
                    IAuthorLookupDataService authorLookupDataService,
                    IFormatLookupDataService formatLookupDataService,
                    IGenreLookupDataService genreLookupDataService)
 {
     Repository = repository ?? throw new ArgumentNullException(nameof(repository));
     this.languageLookupDataService  = languageLookupDataService ?? throw new ArgumentNullException(nameof(languageLookupDataService));
     this.publisherLookupDataService = publisherLookupDataService ?? throw new ArgumentNullException(nameof(publisherLookupDataService));
     this.authorLookupDataService    = authorLookupDataService ?? throw new ArgumentNullException(nameof(authorLookupDataService));
     this.formatLookupDataService    = formatLookupDataService ?? throw new ArgumentNullException(nameof(formatLookupDataService));
     this.genreLookupDataService     = genreLookupDataService ?? throw new ArgumentNullException(nameof(genreLookupDataService));
     this.formatRepository           = formatRepository ?? throw new ArgumentNullException(nameof(formatRepository));
     this.genreRepository            = genreRepository ?? throw new ArgumentNullException(nameof(genreRepository));
 }
        public LanguageDetailViewModel(IEventAggregator eventAggregator,
                                       ILogger logger,
                                       IDomainService <Language> domainService,
                                       ILanguageLookupDataService languageLookupDataService,
                                       IDialogService dialogService)
            : base(eventAggregator, logger, domainService, dialogService)
        {
            this.languageLookupDataService = languageLookupDataService ?? throw new ArgumentNullException(nameof(languageLookupDataService));

            ChangeEditedLanguageCommand = new DelegateCommand <Guid?>(OnChangeEditedLanguageExecute);
            SaveItemCommand             = new DelegateCommand(base.SaveItemExecute, base.SaveItemCanExecute)
                                          .ObservesProperty(() => SelectedItem.LanguageName);

            SelectedItem = CreateWrapper(domainService.CreateItem());

            Languages = new ObservableCollection <LookupItem>();

            UserMode = (!UserMode.Item1, DetailViewState.EditMode, Brushes.LightGray, !UserMode.Item4).ToTuple();
        }
예제 #7
0
        public FriendDetailViewModel(
            IFriendRepository dataService,
            IEventAggregator eventAggregator,
            IMessageDialogService messageDialogService,
            ILanguageLookupDataService languageLookupDataService) : base(eventAggregator)
        {
            _dataService               = dataService;
            _messageDialogService      = messageDialogService;
            _languageLookupDataService = languageLookupDataService;

            SaveCommand   = new DelegateCommand(OnSaveExecute, OnSaveCanExecute);
            DeleteCommand = new DelegateCommand(OnDeleteExecute); //No need for CanExecute since always true

            AddPhoneNumberCommand    = new DelegateCommand(OnAddPhoneNumberExecute);
            RemovePhoneNumberCommand = new DelegateCommand(OnRemovePhoneNumberExecute, OnRemovePhoneNumberCanExecute);

            Languages    = new ObservableCollection <LookupItem>();
            PhoneNumbers = new ObservableCollection <PhoneNumberWrapper>();
        }
        public MainPageViewModel([NotNull] IEventAggregator eventAggregator,
                                 [NotNull] INationalityLookupDataService nationalityLookupDataService,
                                 [NotNull] IFormatLookupDataService formatLookupDataService,
                                 [NotNull] IGenreLookupDataService genreLookupDataService,
                                 [NotNull] ILanguageLookupDataService languageLookupDataService)
        {
            _eventAggregator = eventAggregator ?? throw new ArgumentNullException(nameof(eventAggregator));
            _nationalityLookupDataService = nationalityLookupDataService
                                            ?? throw new ArgumentNullException(nameof(nationalityLookupDataService));
            _formatLookupDataService   = formatLookupDataService ?? throw new ArgumentNullException(nameof(formatLookupDataService));
            _genreLookupDataService    = genreLookupDataService ?? throw new ArgumentNullException(nameof(genreLookupDataService));
            _languageLookupDataService = languageLookupDataService ?? throw new ArgumentNullException(nameof(languageLookupDataService));

            ShowItemsCommand = new DelegateCommand <Type>(OnShowItemsExecute);

            AddNewItemCommand        = new DelegateCommand <Type>(OnAddNewItemExecute);
            EditLanguagesCommand     = new DelegateCommand(OnEditLanguagesExecute);
            EditNationalitiesCommand = new DelegateCommand(OnEditNationalitiesExecute);
            EditBookFormatsCommand   = new DelegateCommand(OnEditBookFormatsExecute);
            EditBookGenresCommand    = new DelegateCommand(OnEditBookGenresExecute);
        }
 public LanguageController(ISimpleDomainService <Language, LanguageId> service, ILanguageLookupDataService languageLookupDataService)
 {
     _service = service ?? throw new ArgumentNullException(nameof(service));
     _languageLookupDataService = languageLookupDataService ?? throw new ArgumentNullException(nameof(languageLookupDataService));
 }