Exemplo n.º 1
0
 public static void Save(GraphModelSerialization model)
 {
     if (string.IsNullOrEmpty(model.FileName))
     {
         SaveAs(model);
     }
     else if (GraphSerializer.Serialization(model, model.FileName))
     {
         model.Changed = false;
     }
 }
Exemplo n.º 2
0
        public static GraphModelSerialization Load()
        {
            var loadDialog = new OpenFileDialog
            {
                Filter           = "Graph file (*.ge)|*.ge| All files (*.*)|*.*",
                InitialDirectory = _initialDirectory ?? Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
            };

            if (loadDialog.ShowDialog() == true)
            {
                var model = GraphSerializer.Deserialization(loadDialog.FileName);
                _initialDirectory = loadDialog.FileName;
                model.FileName    = loadDialog.FileName;
                return(model);
            }
            return(null);
        }