//-----------------------------------------------------------------------
        public void SetData(DataItem item)
        {
            Path = System.IO.Path.ChangeExtension(Path, item.Definition.Extension);

            if (item is StructItem)
            {
                var si = item as StructItem;
                if (si.Children.Count == 0 && si.Attributes.Count == 0)
                {
                    using (si.UndoRedo.DisableUndoScope())
                    {
                        si.Create();
                    }
                }
            }
            else if (item is GraphStructItem)
            {
                var gni = item as GraphStructItem;
                if (gni.Children.Count == 0 && gni.Attributes.Count == 0)
                {
                    using (gni.UndoRedo.DisableUndoScope())
                    {
                        gni.Create();
                    }
                }
            }

            Data = new XmlDataModel(Workspace, this, item.UndoRedo);
            Data.SetRootItem(item);

            item.IsExpanded = true;
        }
Beispiel #2
0
        //-----------------------------------------------------------------------
        public static List <GraphCommentItem> ParseGraphComments(XmlDataModel model, UndoRedoManager undoRedo, string commentChain)
        {
            var output = new List <GraphCommentItem>();

            var comments = commentChain.Split('%');

            foreach (var commentString in comments)
            {
                var split   = commentString.Split('$');
                var comment = new GraphCommentItem(model, undoRedo, split[1], split[3].ToColour().Value);
                comment.GUID = split[0];

                output.Add(comment);
            }

            return(output);
        }
Beispiel #3
0
        //-----------------------------------------------------------------------
        public GraphCommentItem(XmlDataModel dataModel, UndoRedoManager undoRedo, string title, Color colour)
        {
            this.Model = dataModel;

            var def = dataModel.Workspace.RootDataTypes["graphcomment"];

            using (undoRedo.DisableUndoScope())
            {
                Item = def.CreateData(undoRedo);
            }

            Item.ChildPropertyChangedEvent += (e, args) =>
            {
                RaisePropertyChangedEvent("Title");
                RaisePropertyChangedEvent("Colour");
                RaisePropertyChangedEvent("ColourBrush");
            };

            using (undoRedo.DisableUndoScope())
            {
                Title  = title;
                Colour = colour;
            }
        }
 public DummyItem(string name, XmlDataModel dataModel)
     : base(new DummyDefinition(), null)
 {
     Name      = name;
     DataModel = dataModel;
 }