/// <summary> /// Rename QSet /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void renameButton_Click(object sender, RoutedEventArgs e) { bool loop = true; string name = EditedQSet.Name; while (loop) { InputDialog inputDialog = new InputDialog("Zadejte nové jméno sady", name); if (inputDialog.ShowDialog() == true) { name = inputDialog.Answer; if (FileManager.ContainsInvalidChars(name)) //check if the name doesn't contain invalid characters { MessageBox.Show($"Zadaný název obsahuje nedovolené znaky.", "Chyba", MessageBoxButton.OK, MessageBoxImage.Error); continue; } if (qSetsManager.CheckName(name)) //check if the name isn't used already { MessageBox.Show("Sada otázek s názvem \"" + name + "\" už existuje.", "Chyba", MessageBoxButton.OK, MessageBoxImage.Error); continue; } string path = FileManager.GenerateFilePath(name); if (qSetsManager.CheckPath(path)) //check if generated file path isn't used already { MessageBox.Show("Pro název \"" + name + "\" nelze vygenerovat jedinečný název souboru.", "Chyba", MessageBoxButton.OK, MessageBoxImage.Error); continue; } EditedQSet.Path = path; EditedQSet.Name = name; Saved = false; nameChanged = true; loop = false; } else { loop = false; } } }