Beispiel #1
0
        private void ExamButton_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();

            ChooseAlgorithmView algorithmView = new ChooseAlgorithmView("Tryb egzaminu");
            algorithmView.ShowDialog();

            this.Show();
        }
Beispiel #2
0
        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);
                }
            }
        }
Beispiel #3
0
        private void LearningButton_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();

            ChooseAlgorithmView algorithmView = new ChooseAlgorithmView("Tryb nauki");
            algorithmView.ShowDialog();

            this.Show();
        }