Esempio n. 1
0
        public void SaveAs(string Path)
        {
            XmlSerializer formatter = new XmlSerializer(typeof(DataStorage));

            using (FileStream fs = new FileStream(Path, FileMode.OpenOrCreate))
                formatter.Serialize(fs, DrawingController.Backup());
        }
Esempio n. 2
0
        public MainWindow()
        {
            InitializeComponent();

            DrawingController.CurrentStorage = new DataStorage();
            DrawingController.Scene          = Scene;
            DrawingController.BridgeCreated += drawingWertex_BridgeCreated;

            sceneController = new SceneController(Scene, DrawAreaCanvas);
            DrawingController.ConnectDrawingObject(sceneController);
            fileController = new FileController(DrawingController.Backup());
            fileController.ConnectToHistoryJournal(this);
            OpacityAnimationOut.Completed += OpacityAnimationOut_Completed;
            IsOriented.Checked            += IsOriented_Checked;
            IsOriented.Unchecked          += IsOriented_Unchecked;
        }
 public static DataStorage Backup()
 {
     StorageForCopy = new DataStorage();
     foreach (var x in CurrentStorage.BindingVertexWithAlgoVertex)
     {
         DrawingController.CopyVertex(x);
     }
     foreach (var x in CurrentStorage.BindingBridgeWithAlgoEdge)
     {
         var start = (from s in StorageForCopy.BindingVertexWithAlgoVertex where s.DataVertex.Name == x.DataEdge.FirstPoint.Name select s).ToList()[0];
         var end   = (from s in StorageForCopy.BindingVertexWithAlgoVertex where s.DataVertex.Name == x.DataEdge.SecondPoint.Name select s).ToList()[0];
         DrawingController.GetStartPointForBrige(start.GraphicVertex, true);
         DrawingController.CreateBridge(end.GraphicVertex, true);
         DrawingController.StorageForCopy.BindingBridgeWithAlgoEdge.Last().DataEdge.Weight = x.DataEdge.Weight;
     }
     return(StorageForCopy);
 }
Esempio n. 4
0
 private void AddVertexButton_Click(object sender, RoutedEventArgs e)
 {
     DrawingController.AddNewVertex();
 }
Esempio n. 5
0
 public void Undo_Holder(object sender, EventArgs e)
 {
     DrawingController.ConfigStorage(((StorageChangeEventArgs)e).Data);
 }
Esempio n. 6
0
 private void button2_Copy1_Click(object sender, RoutedEventArgs e)
 {
     DrawingController.ConfigStorage(fileController.History.Last());
 }