private void onFileBtnClick(object sender, RoutedEventArgs e) { OpenFileDialog file = new OpenFileDialog(); file.Multiselect = false; file.Filter = "Edg Files (.edg)|*.edg"; file.FilterIndex = 1; if (file.ShowDialog() == true) { fileName = file.FileName; fileTextLabel.Content = System.IO.Path.GetFileName(fileName); try { List <Tuple <int, int> > edges = ReadWriteParser.ReadToEdges(fileName); rawNodes = Node.TupleToNodes(edges); gr = new Layers(rawNodes); fillRichTextBox(); MakeGraphFromTuples(edges); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void onSaveBtnClick(object sender, RoutedEventArgs e) { try { ReadWriteParser.Write(gr, fileName); MessageBox.Show($"Description saved to {System.IO.Path.GetFileName(fileName)}.descr"); } catch (NullReferenceException ex) { MessageBox.Show(ex.Message); } }