Example #1
0
        public EditTopicViewModel(
            MainWindowViewModel mainWindowViewModel,
            int topicId,
            RelayCommand.Factory relayCommand,
            RelayCommand <string> .Factory relayCommandString,
            RelayCommand <int?> .Factory relayCommandInt,
            RelayCommand <SectionDto> .Factory relayCommandSectionDto,
            RelayCommand <Flashcard> .Factory relayCommandFlashcard,
            RelayCommand <QueryRoundOptions> .Factory relayCommandQueryRoundOptions,
            ICreateSectionService createSectionService,
            IDeleteSectionService deleteSectionService,
            IDeleteFlashcardService deleteFlashcardService,
            IListSectionsService listSectionsService
            )
        {
            _mainWindowViewModel    = mainWindowViewModel;
            _topicId                = topicId;
            _createSectionService   = createSectionService;
            _deleteSectionService   = deleteSectionService;
            _deleteFlashcardService = deleteFlashcardService;
            _listSectionsService    = listSectionsService;

            BackToTopicsCommand    = relayCommand(BackToTopics);
            CreateSectionCommand   = relayCommandString(CreateSection);
            DeleteSectionCommand   = relayCommandSectionDto(DeleteSection);
            DeleteFlashcardCommand = relayCommandFlashcard(DeleteFlashcard);
            NewFlashcardCommand    = relayCommandInt(NewFlashcard, CanCreateFlashcard);
            StartQueryRoundCommand = relayCommandQueryRoundOptions(StartQueryRound, CanStartQueryRound);

            var topicList = _listSectionsService.ListSections(_topicId);

            Sections = new ObservableCollection <SectionDto>(topicList);

            QueryRoundOptions = new QueryRoundOptions
            {
                NumberOfQueries = 10,
                Stage           = 1,
            };
        }
Example #2
0
 public bool CanStartQueryRound(QueryRoundOptions options)
 {
     return(Section?.Flashcards.Any(f => f.Stage == options?.Stage) ?? false);
 }
Example #3
0
 public void StartQueryRound(QueryRoundOptions options)
 {
     options.SectionId = Section.SectionId;
     _mainWindowViewModel.StackNavigateTo <QueryRoundViewModel, QueryRoundOptions>(options);
 }