Example #1
0
        public static string GenerateItemModel(ICanvas canvas, ITreeItem item, bool update)
        {
            string model = null;

            if (item != null)
            {
                string uid       = item.GetUid();
                bool   isDiagram = StringUtil.StartsWith(uid, Constants.TagHeaderDiagram);

                if (isDiagram == true)
                {
                    var prop = (canvas == null) ? DiagramProperties.Default : canvas.GetProperties();
                    model = GenerateDiagram(canvas, uid, prop);
                    if (update == true)
                    {
                        UndoRedo undoRedo = (canvas == null) ?
                                            new UndoRedo(new Stack <string>(), new Stack <string>()) :
                                            canvas.GetTag() as UndoRedo;

                        item.SetTag(new Diagram(model, undoRedo));
                    }
                }
            }

            return(model);
        }
Example #2
0
        public static void Store(ICanvas canvas, ITreeItem item)
        {
            string model = (canvas == null) ?
                           GenerateItemModel(null, item, true) :
                           GenerateDiagram(canvas, item.GetUid(), canvas == null ? null : canvas.GetProperties());

            item.SetTag(new Diagram(model, canvas != null ? canvas.GetTag() as UndoRedo : null));
        }