public DbConnectivityTester(IMetroDialogService metroDialogService, string connString = null)
        {
            this.metroDialogService = metroDialogService;
            connectionString        = connString;

            if (connectionString is null)
            {
                connectionString = ConnectivityService.GetConnectionString();
            }
        }
        public PublisherDetailViewModel(IEventAggregator eventAggregator,
                                        IMetroDialogService metroDialogService,
                                        IRepository <Publisher> publisherRepo)
            : base(eventAggregator, metroDialogService)
        {
            Repository = publisherRepo ?? throw new ArgumentNullException(nameof(publisherRepo));

            AddPublisherLogoCommand = new DelegateCommand(OnAddPublisherLogoExecute);

            SelectedItem = new Publisher();
        }
Пример #3
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 AuthorDetailViewModel(IEventAggregator eventAggregator,
                                     IMetroDialogService metroDialogService,
                                     IRepository <Author> authorRepo,
                                     INationalityLookupDataService nationalityLookupDataService)
            : base(eventAggregator, metroDialogService)
        {
            Repository = authorRepo ?? throw new ArgumentNullException(nameof(authorRepo));
            this.nationalityLookupDataService = nationalityLookupDataService
                                                ?? throw new ArgumentNullException(nameof(nationalityLookupDataService));

            AddAuthorPictureCommand            = new DelegateCommand(OnAddAuthorPictureExecute);
            NationalitySelectionChangedCommand = new DelegateCommand(OnNationalitySelectionChangedExecute);

            SelectedItem  = new Author();
            Nationalities = new ObservableCollection <LookupItem>();
        }
        public FormatDetailViewModel(IEventAggregator eventAggregator,
                                     IMetroDialogService metroDialogService,
                                     IRepository <Format> formatRepository,
                                     IFormatLookupDataService formatLookupService)
            : base(eventAggregator, metroDialogService)
        {
            Repository = formatRepository;
            this.formatLookupService = formatLookupService ?? throw new ArgumentNullException(nameof(formatLookupService));

            ChangeEditedFormatCommand = new DelegateCommand <Guid?>(OnChangeEditedFormatExecute);

            SelectedItem = new Format();

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

            Formats = new ObservableCollection <LookupItem>();
        }
        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 NationalityDetailViewModel(IEventAggregator eventAggregator,
                                          IMetroDialogService metroDialogService,
                                          IRepository <Nationality> nationalityRepository,
                                          INationalityLookupDataService nationalityLookupService)
            : base(eventAggregator, metroDialogService)
        {
            Repository = nationalityRepository;
            this.nationalityLookupService = nationalityLookupService ?? throw new ArgumentNullException(nameof(nationalityLookupService));

            ChangeEditedNationCommand = new DelegateCommand <Guid?>(OnChangeEditedNationExecute);

            SelectedItem = new Nationality();

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

            Nations = new ObservableCollection <LookupItem>();
        }
        public BaseDetailViewModel(IEventAggregator eventAggregator, IMetroDialogService metroDialogService)
        {
            this.eventAggregator    = eventAggregator ?? throw new ArgumentNullException(nameof(eventAggregator));
            this.metroDialogService = metroDialogService ?? throw new ArgumentNullException(nameof(metroDialogService));

            SwitchEditableStateCommand = new DelegateCommand(SwitchEditableStateExecute);
            SaveItemCommand            = new DelegateCommand(SaveItemExecute, SaveItemCanExecute)
                                         .ObservesProperty(() => HasChanges)
                                         .ObservesProperty(() => HasErrors);
            DeleteItemCommand       = new DelegateCommand(DeleteItemExecute);
            CloseDetailViewCommand  = new DelegateCommand(CloseDetailViewExecute);
            ShowSelectedBookCommand = new DelegateCommand <Guid?>(OnShowSelectedBookExecute, OnShowSelectedBookCanExecute);

            UserMode = (true, DetailViewState.ViewMode, Brushes.LightGray, false).ToTuple();

            Errors = new Dictionary <string, List <string> >();
        }
Пример #9
0
        public LoginViewModel(IIsolatedStorageManager storageService, IMetroDialogService dialogService)
        {
            this.storageService = storageService;
            this.dialogService = dialogService;

            // Instantiation des commandes
            this.ConnectionCommand = new RelayCommand(this.Connection, this.Connection_CanExecute);

            // Initialisation de l'interface
            if (Properties.Settings.Default.UserName != string.Empty)
            {
                this.SummonerName = Properties.Settings.Default.UserName;
            }

            // Pas besoin de tester si la valeur est null car c'est une enum
            this.Server = Properties.Settings.Default.Server;

            this.Servers = (IEnumerable<Region>)Enum.GetValues(typeof(Region));
        }
Пример #10
0
        public SeriesDetailViewModel(IEventAggregator eventAggregator,
                                     IMetroDialogService metroDialogService,
                                     IRepository <Series> seriesRepo,
                                     IBookLookupDataService bookLookupDataService)
            : base(eventAggregator, metroDialogService)
        {
            Repository = seriesRepo ?? throw new ArgumentNullException(nameof(seriesRepo));

            AddSeriesPictureCommand = new DelegateCommand(OnAddSeriesPictureExecute);
            FilterBookListCommand   = new DelegateCommand <string>(OnFilterBookListExecute);
            AddBookToSeriesCommand  = new DelegateCommand <Guid?>(OnAddBookToSeriesExecute, OnAddBookToSeriesCanExecute);

            this.bookLookupDataService = bookLookupDataService;

            Books    = new ObservableCollection <LookupItem>();
            AllBooks = new ObservableCollection <LookupItem>();

            SelectedItem = new Series();
        }
Пример #11
0
        public MainViewModel(IEventAggregator eventAggregator,
                             IIndex <string, IDetailViewModel> detailViewModelCreator,
                             IIndex <string, ISelectedViewModel> viewModelCreator,
                             IMetroDialogService metroDialogService)
        {
            this.detailViewModelCreator = detailViewModelCreator ?? throw new ArgumentNullException(nameof(detailViewModelCreator));
            this.viewModelCreator       = viewModelCreator ?? throw new ArgumentNullException(nameof(viewModelCreator));
            this.metroDialogService     = metroDialogService ?? throw new ArgumentNullException(nameof(metroDialogService));
            this.eventAggregator        = eventAggregator ?? throw new ArgumentNullException(nameof(eventAggregator));

            DetailViewModels      = new ObservableCollection <IDetailViewModel>();
            TEMP_DetailViewModels = new ObservableCollection <IDetailViewModel>();

            OpenSelectedViewCommand = new DelegateCommand <string>(OnOpenSelectedViewExecute);
            ShowMenuCommand         = new DelegateCommand(OnShowMenuExecute);
            CreateNewItemCommand    = new DelegateCommand <Type>(OnCreateNewItemExecute);

            IsMenuBarVisible = false;

            OnOpenSelectedViewExecute(nameof(MainPageViewModel));

            SubscribeToEvents();
        }