private void ExamButton_Click(object sender, RoutedEventArgs e) { this.Hide(); ChooseAlgorithmView algorithmView = new ChooseAlgorithmView("Tryb egzaminu"); algorithmView.ShowDialog(); this.Show(); }
private void CustomGraphButton_Click(object sender, RoutedEventArgs e) { string path = Path.GetFullPath("../../../GraphGenerator/CustomGraphs"); OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Custom graph files (*.huu)|*.huu"; dlg.InitialDirectory = path; if ( dlg.ShowDialog() == true ) { try { List<Graph> graphsList; CustomXmlSerializer xmlSerializer = new CustomXmlSerializer(typeof(List<Graph>)); string encryptedXml = File.ReadAllText(dlg.FileName); string plainXml = StringEncryption.Decrypt(encryptedXml, "Yaranaika?"); using (StringReader reader = new StringReader(plainXml)) { graphsList = (List<Graph>)xmlSerializer.Deserialize(reader); } if (graphsList.Count != 1) throw new Exception("W pliku powinien być dokładnie jeden graf."); this.Hide(); ChooseAlgorithmView algorithmView = new ChooseAlgorithmView(graphsList[0]); // First graph is always user graph algorithmView.ShowDialog(); this.Show(); } catch (Exception) { MessageBox.Show("Wystąpił błąd podczas wczytywania pliku. Upewnij się, że nie jest on uszkodzony.", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void LearningButton_Click(object sender, RoutedEventArgs e) { this.Hide(); ChooseAlgorithmView algorithmView = new ChooseAlgorithmView("Tryb nauki"); algorithmView.ShowDialog(); this.Show(); }