Exemplo n.º 1
0
        public static void Redo(ICanvas canvas, IDiagramCreator creator, bool pushUndo)
        {
            var history = Get(canvas);
            var undo    = history.Undo;
            var redo    = history.Redo;

            if (redo.Count <= 0)
            {
                return;
            }

            // save current model
            if (pushUndo == true)
            {
                var current = ModelEditor.GenerateDiagram(canvas, null, canvas.GetProperties());
                undo.Push(current);
            }

            // restore previous model
            var model = redo.Pop();

            ModelEditor.Clear(canvas);
            ModelEditor.Parse(model,
                              canvas, creator,
                              0, 0,
                              false, true, false, true);

            NotifyCanvasHistoryChanged(new CanvasHistoryChangedEventArgs()
            {
                Canvas = canvas,
                Undo   = undo,
                Redo   = redo
            });
        }
Exemplo n.º 2
0
 public void Paste(string model, double offsetX, double offsetY, bool select)
 {
     Snapshot(Context.CurrentCanvas, true);
     SelectNone();
     ModelEditor.Parse(model,
                       Context.CurrentCanvas, Context.DiagramCreator,
                       offsetX, offsetY,
                       true, true, select, true);
 }
Exemplo n.º 3
0
 public TreeSolution OpenSolution(string fileName)
 {
     using (var reader = new System.IO.StreamReader(fileName))
     {
         return(ModelEditor.Parse(reader.ReadToEnd(),
                                  null, Context.DiagramCreator,
                                  0, 0,
                                  false, false, false, false));
     }
 }
Exemplo n.º 4
0
        public void OpenDiagram(string fileName, ICanvas canvas)
        {
            string diagram = ModelEditor.Open(fileName);

            Snapshot(canvas, true);

            ModelEditor.Clear(canvas);
            ModelEditor.Parse(diagram,
                              canvas, Context.DiagramCreator,
                              0, 0,
                              false, true, false, true);
        }