Example #1
0
 private void SerializeToFile(Diagram diagram, string path)
 {
     using (FileStream stream = File.Create(path))
     {
         XmlSerializer serializer = new XmlSerializer(typeof(Diagram));
         serializer.Serialize(stream, diagram);
     }
 }
Example #2
0
 //commandd to save diagram
 private void SaveDiagram()
 {
     string path = dialogVM.ShowSave();
     if (path != null)
     {
         Diagram diagram = new Diagram() { Nodes = Nodes.Select(n => n.Node).ToList(), Lines = Lines.Select(l => l.Line).ToList() };
         XMLserializer.Instance.AsyncSerializeToFile(diagram, path);
     }
 }
Example #3
0
 public async void AsyncSerializeToFile(Diagram diagram, string path)
 {
     await Task.Run(() => SerializeToFile(diagram, path));
 }