private void GoBackToStartupFormButton_Click(object sender, EventArgs e) { void OpenStartupForm() { this.Hide(); var startupForm = new StartupForm(); startupForm.Closed += (s, args) => this.Close(); startupForm.Show(); } bool anyChangesMade = CheckIfAnyChangesMade(); if (anyChangesMade) { CommonFormService.ShowConfirmAction( "Grįžti atgal", "Ar tikrai norite grįžti į pradžios formą ? (neišaugoti pakeitimai bus atšaukti)", OpenStartupForm); } else { OpenStartupForm(); } }
private void HandleNextWordButtonClickedEvent() { if (IDontKnowTheWordButton.Visible) { _learnedWords.Add(_unknownWords.First(uw => uw.Id == _currentUnknownWordPairId)); LearnedWordsCountLinkLabel.Text = _learnedWords.Count.ToString(); LearnedWordsCountLinkLabel.Enabled = _learnedWords.Count > 0; _unknownWords = _unknownWords.Where(unknownWord => unknownWord.Id != _currentUnknownWordPairId).ToArray(); } else { VerbalFormService.SetWordTextBoxVisibilityForSelectedLanguage(_selectedLanguage, FirstLanguageWordTextBox, SecondLanguageWordTextBox); } VerbalFormService.HandleNextWordButtonClickedEvent(IDontKnowTheWordButton, FirstLanguageWordTextBox, SecondLanguageWordTextBox, _selectedLanguage); if (_unknownWords.Length > 0) { CommonFormService.SetProgressLabelText(ProgressLabel, _unknownWords); WordPair nextWord = _unknownWords.First(); FirstLanguageWordTextBox.Text = nextWord.FirstLanguageWord; SecondLanguageWordTextBox.Text = nextWord.SecondLanguageWord; _currentUnknownWordPairId = nextWord.Id; } else { HandleFinishedTest(); } }
private void HandleCorrectlyEnteredWord() { WordPair currentLearnedWord = _allWords.First(uw => uw.Id == _currentWordPairId); bool learnedUnknownWord = _wordsService.RemoveLearnedUnknownWordIfExist(currentLearnedWord); if (learnedUnknownWord) { _learnedWords.Add(currentLearnedWord); NewLearnedWordsCountLinkLabel.Text = _learnedWords.Count.ToString(); } else { _knownWords.Add(currentLearnedWord); KnownWordsCountLinkLabel.Text = _knownWords.Count.ToString(); } _allWords = _allWords.Where(aw => aw.Id != _currentWordPairId).ToArray(); NewLearnedWordsCountLinkLabel.Enabled = _learnedWords.Count > 0; KnownWordsCountLinkLabel.Enabled = _knownWords.Count > 0; if (_allWords.Length > 0) { CommonFormService.SetProgressLabelText(ProgressLabel, _allWords); _currentWordPairId = _allWords.First().Id; GrammarFormService.HandleNextWordButtonEvent(ValidateWordButton, NextWordButton, CorrectWordTextBox, _selectedLanguage, FirstLanguageWordTextBox, SecondLanguageWordTextBox, _allWords); } else { HandleFinishedTest(); } }
private void UnknownWordsGrammarTestForm_Load(object sender, EventArgs e) { CommonFormService.InitializeTestTimer(TestTimerLabel, _stopWatch); GrammarFormService.ConfigureSelectedLanguage(_selectedLanguage, FirstLanguageWordTextBox, SecondLanguageWordTextBox, ValidateWordButton, NextWordButton); GrammarFormService.HanldeVerbalFormLoadedEvent(_unknownWords, out _currentUnknownWordPairId, ProgressLabel, FirstLanguageWordTextBox, SecondLanguageWordTextBox); LearnedWordsCountLinkLabel.Enabled = false; }
private void HandleNextWordButtonEvent() { if (_allWords.Length > 0) { CommonFormService.SetProgressLabelText(ProgressLabel, _allWords); GrammarFormService.HandleNextWordButtonEvent(ValidateWordButton, NextWordButton, CorrectWordTextBox, _selectedLanguage, FirstLanguageWordTextBox, SecondLanguageWordTextBox, _allWords); } else { HandleFinishedTest(); } }
private void AllWordsVerbalTestForm_Load(object sender, EventArgs e) { CommonFormService.InitializeTestTimer(TestTimerLabel, _stopWatch); VerbalFormService.SetWordTextBoxVisibilityForSelectedLanguage(_selectedLanguage, FirstLanguageWordTextBox, SecondLanguageWordTextBox); VerbalFormService.HanldeVerbalFormLoadedEvent(NextWordButton, _allWords, out _currentWordPairId, ProgressLabel, FirstLanguageWordTextBox, SecondLanguageWordTextBox); NewUnknownWordsCountLinkLabel.Enabled = false; UnknownWordsCountLinkLabel.Enabled = false; NewLearnedWordsCountLinkLabel.Enabled = false; KnownWordsCountLinkLabel.Enabled = false; }
private void HandleClearAllWordsSearchButtonClickedEvent() { bool anyChangesMade = CheckIfAnyChangesMade(); if (anyChangesMade) { CommonFormService.ShowConfirmAction( "Atšaukti paieška", "Ar tikrai norite atšaukti paieška ir užkrauti visus žodžius ? (neišaugoti pakeitimai bus atšaukti)", ReloadAllWordsToDataGridView); } else { ReloadAllWordsToDataGridView(); } }
private void HandleSearchAllWordsButtonClickedEvent() { void PerformSearchAction(string searchTextValue) { ClearAllWordsSearchButton.Visible = true; var searchCriteria = new QueryCriteria { SearchText = searchTextValue, OrderByCriteria = _orderByCreatedAtAscCriteria.OrderByCriteria }; var allWordsThatMatchedSearchCriteria = _wordsService.GetAllWords(searchCriteria).ToList(); UpdateOriginalAllWordsValues(allWordsThatMatchedSearchCriteria); List <WordPairForDataGridView> allWordsForDataGridView = MapToDataGridViewStructure(allWordsThatMatchedSearchCriteria); _allWordsBindingSource.DataSource = allWordsForDataGridView; DisableSaveAllWordsActions(); } string searchText = AllWordsSearchTextBox.Text; if (string.IsNullOrWhiteSpace(searchText)) { return; } bool anyChangesMade = CheckIfAnyChangesMade(); if (anyChangesMade) { CommonFormService.ShowConfirmAction( "Žodžio paieška", "Ar tikrai norite ieškoti žodžio ? (neišaugoti pakeitimai bus atšaukti)", () => { PerformSearchAction(searchText); }); } else { PerformSearchAction(searchText); } }
private void HandleCorrectlyEnteredWord() { _learnedWords.Add(_unknownWords.First(uw => uw.Id == _currentUnknownWordPairId)); LearnedWordsCountLinkLabel.Text = _learnedWords.Count.ToString(); LearnedWordsCountLinkLabel.Enabled = _learnedWords.Count > 0; _unknownWords = _unknownWords.Where(unknownWord => unknownWord.Id != _currentUnknownWordPairId).ToArray(); if (_unknownWords.Length > 0) { CommonFormService.SetProgressLabelText(ProgressLabel, _unknownWords); _currentUnknownWordPairId = _unknownWords.First().Id; GrammarFormService.HandleNextWordButtonEvent(ValidateWordButton, NextWordButton, CorrectWordTextBox, _selectedLanguage, FirstLanguageWordTextBox, SecondLanguageWordTextBox, _unknownWords); } else { HandleFinishedTest(); } }
private void ReloadAllWordsGridViewButton_Click(object sender, EventArgs e) { void PerformResetSearchAction() { ReloadAllWordsToDataGridView(); _wordsToDeleteOnSave.Clear(); } bool anyChangesMade = CheckIfAnyChangesMade(); if (anyChangesMade) { CommonFormService.ShowConfirmAction( "Atstatyti žodžius", "Ar tikrai norite atstatyti žodžius iš duomenų bazės ? (neišaugoti pakeitimai bus atšaukti)", PerformResetSearchAction); } else { PerformResetSearchAction(); } }
private void EndTestButton_MouseClick(object sender, EventArgs e) { CommonFormService.HandelEndTestButtonPressedEvent(_unknownWords, HandleFinishedTest); }
private void EndProgramButton_MouseClick(object sender, EventArgs e) { CommonFormService.CloseProgram(); }
private void SaveChangesButton_Click(object sender, EventArgs e) { void PerformSaveAction() { bool anyChangesPerssisted = false; DateTime currentDateTime = DateTime.Now; var currentWords = (IEnumerable <WordPairForDataGridView>)_allWordsBindingSource.DataSource; List <WordPairForDataGridView> currentWordsList = currentWords.ToList(); List <WordPairForDataGridView> wordsToDelete = _wordsToDeleteOnSave; if (wordsToDelete.Any()) { _wordsService.RemoveWordsDeletedInAdminPanel(wordsToDelete); anyChangesPerssisted = true; _wordsToDeleteOnSave.Clear(); } List <WordPairForDataGridView> modifiedWordPairs = currentWordsList.Where(w => w.DirtyRowUuid != Guid.Empty && w.Id > 0).ToList(); if (modifiedWordPairs.Any()) { _wordsService.UpdatedWordsChangedInAdminPanel(modifiedWordPairs, currentDateTime); anyChangesPerssisted = true; } List <WordPairForDataGridView> newWords = currentWordsList.Where(w => w.DirtyRowUuid != Guid.Empty && w.Id <= 0).ToList(); if (newWords.Any()) { _wordsService.SaveWordsNewlyAddedInAdminPanel(newWords, currentDateTime); anyChangesPerssisted = true; } if (anyChangesPerssisted) { ReloadAllWordsToDataGridView(); } } bool anyChangesMade = CheckIfAnyChangesMade(); if (anyChangesMade) { if (_wordsToDeleteOnSave.Count > 0) { CommonFormService.ShowConfirmAction( "Išsaugoti pakeitimus", "Ar tikrai norite išsaugoti pakeitimus ? (ištrinti žodžiai nus pašalinti iš duomenų bazės)", PerformSaveAction); } else { PerformSaveAction(); } } }