/// <summary> /// Adds new category after clicking a button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddNewCategoryButton_Click(object sender, RoutedEventArgs e) { string polishNameOfCategory = PolishNameTextBox.Text; string englishNameOfCategory = EnglishNameTextBox.Text; if (polishNameOfCategory == "Polska" || polishNameOfCategory == null || englishNameOfCategory == "Angielska" || englishNameOfCategory == null) { MessageBox.Show("Nie zostały podane wszystkie potrzebne dane."); } else { string nameOfTextFile = englishNameOfCategory.ToLower() + ".txt"; string foo = "..\\..\\"; string pathToTextFile = foo + nameOfTextFile; try { FileStream fileStream = new FileStream(@pathToTextFile, FileMode.CreateNew, FileAccess.Write); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } if (File.Exists(@pathToTextFile)) { var build = new Microsoft.Build.Evaluation.Project(@"..\\..\\Fiszki.csproj"); build.AddItem("Resource", nameOfTextFile); build.Save(); Directory.CreateDirectory(@"..\\..\\Photos\\" + englishNameOfCategory); FileStream fileStream = new FileStream(@"..\\..\\myOwnCategories.txt", FileMode.Open, FileAccess.ReadWrite); try { using (StreamWriter sw = new StreamWriter(fileStream)) { sw.BaseStream.Seek(0, SeekOrigin.End); sw.WriteLine(polishNameOfCategory + " " + englishNameOfCategory); sw.Close(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } MessageBoxResult result = MessageBox.Show("Dodano kategorię o nazwie: " + polishNameOfCategory + ". Jeśli chcesz dodać następną kategorię, naciśnij tak, a jeśli chcesz wrócić do menu, naciśnij nie.", "Fiszki", MessageBoxButton.YesNo, MessageBoxImage.Information, MessageBoxResult.Yes); if (result == MessageBoxResult.Yes) { setPage = new SetPage(5, MessageBoxResult.Yes); } else { PolishNameTextBox.Name = "Polska"; EnglishNameTextBox.Name = "Angielska"; } }
private void BackToMainPage_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz opuścić dodawanie nowej kategorii i wrócić do strony głównej? Żadne dokonane zmiany nie zostaną zapisane.", "Uwaga", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); setPage = new SetPage(5, result); }
private void AddNewWord_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz opuścić dodawanie nowej kategorii i przejść do tworzenia własnego słowa? Żadne dokonane zmiany nie zostaną zapisane.", "Uwaga", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); setPage = new SetPage(3, result); }
private void SetTestMode_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz opuścić dodawanie nowej kategorii i przejść do trybu testu? Żadne dokonane zmiany nie zostaną zapisane.", "Uwaga", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); setPage = new SetPage(2, result); }
/// <summary> /// Handles the Click event of the BackToMainPage control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void BackToMainPage_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz anulować przejście do testu i przejść do strony głównej?", "Uwaga", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); setPage = new SetPage(5, result); }
/// <summary> /// Handles the Click event of the AddNewCategory control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void AddNewCategory_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz anulować przejście do testu i przejść do dodawania nowej kategorii?", "Uwaga", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); setPage = new SetPage(4, result); }
/// <summary> /// These methods are using setPage object to switch pages after clicking a menu button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SetTrainingMode_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz anulować przejście do testu i przejść do trybu treningu?", "Uwaga", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); setPage = new SetPage(1, result); }
/// <summary> /// Handles the Click event of the AddNewCategoryButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void AddNewCategoryButton_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz opuścić dodawanie nowego słowa i przejść do dodawania nowej kategorii? Żadne zmiany nie zostaną zapisane.", "Uwaga", MessageBoxButton.YesNo, MessageBoxImage.Question); setPage = new SetPage(4, result); }
/// <summary> /// Handles the Click event of the AddNewCategory control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void AddNewCategory_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz opuścić test i przejść do dodawania nowej kategorii? Postęp testu nie zostanie zapisany.", "Uwaga", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); setPage = new SetPage(4, result); }
/// <summary> /// Handles the Click event of the SetTrainingMode control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void SetTrainingMode_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz opuścić test i przejść do trybu treningu? Postęp testu nie zostanie zapisany.", "Uwaga", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); setPage = new SetPage(1, result); }
/// <summary> /// Handles the Click event of the AddNewWord control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void AddNewWord_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz opuścić trening i przejść do tworzenia własnego słowa?", "Uwaga", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); setPage = new SetPage(3, result); }
/// <summary> /// Handles the Click event of the SetTestMode control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void SetTestMode_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz opuścić trening i przejść do trybu testu?", "Uwaga", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); setPage = new SetPage(2, result); }
/// <summary> /// Handles the Click event of the BackToMainPage control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void BackToMainPage_Click(object sender, RoutedEventArgs e) { setPage = new SetPage(5, MessageBoxResult.Yes); }
/// <summary> /// Handles the Click event of the AddNewCategory control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void AddNewCategory_Click(object sender, RoutedEventArgs e) { setPage = new SetPage(4, MessageBoxResult.Yes); }
/// <summary> /// Handles the Click event of the SetTrainingMode control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void SetTrainingMode_Click(object sender, RoutedEventArgs e) { setPage = new SetPage(1, MessageBoxResult.Yes); }
private void Exit_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz opuścić program?", "Uwaga", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); setPage = new SetPage(6, result); }
/// <summary> /// Handles the Click event of the BackToMainPage control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void BackToMainPage_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz opuścić test i przejść do strony głównej? Postęp testu nie zostanie zapisany.", "Uwaga", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); setPage = new SetPage(5, result); }
/// <summary> /// Handles the Click event of the Exit control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void Exit_Click(object sender, RoutedEventArgs e) { setPage = new SetPage(6, MessageBoxResult.Yes); }