Example #1
0
        private void Parse(IdCounter counter,
                           TreeDiagram diagram,
                           ITreeItem project,
                           List <ITreeItem> diagrams)
        {
            var    lines = diagram.Reverse();
            var    first = lines.First().Split(new char[] { Constants.ArgumentSeparator, '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries);
            string name  = first.Length >= 1 ? first[1] : null;

            var sb = new StringBuilder();

            foreach (var line in lines)
            {
                sb.AppendLine(line);
            }

            var item = TreeEditor.CreateDiagramItem(name, Context.CreateDiagram, counter);

            item.SetTag(new Diagram(sb.ToString(), null));

            project.Add(item);
            diagrams.Add(item);

            int id = int.Parse(name.Split(Constants.TagNameSeparator)[1]);

            counter.Set(Math.Max(counter.Count, id + 1));
        }
Example #2
0
        private IEnumerable <ITreeItem> Parse(IEnumerable <TreeProject> projects,
                                              IdCounter counter,
                                              ITreeItem solution)
        {
            var items = new List <ITreeItem>();

            foreach (var project in projects)
            {
                string name     = project.Name;
                var    diagrams = project.Diagrams.Reverse();
                var    item     = TreeEditor.CreateProjectItem(name, Context.CreateProject, counter);
                solution.Add(item);

                int id = int.Parse(name.Split(Constants.TagNameSeparator)[1]);
                counter.Set(Math.Max(counter.Count, id + 1));

                Parse(counter, diagrams, item, items);
            }

            var first = items.FirstOrDefault();

            if (first != null)
            {
                first.SetSelected(true);
            }

            return(items);
        }
        public static void AddDiagram(ITreeItem project,
            bool select,
            Func<ITreeItem> createDiagram,
            IdCounter counter)
        {
            var diagram = CreateDiagramItem(null, createDiagram, counter);

            project.Add(diagram);

            ModelEditor.Store(null, diagram);

            if (select == true)
                diagram.SetSelected(true);
        }
        public static void AddDiagram(ITreeItem project,
                                      bool select,
                                      Func <ITreeItem> createDiagram,
                                      IdCounter counter)
        {
            var diagram = CreateDiagramItem(null, createDiagram, counter);

            project.Add(diagram);

            ModelEditor.Store(null, diagram);

            if (select == true)
            {
                diagram.SetSelected(true);
            }
        }
        private void Parse(IdCounter counter,
            TreeDiagram diagram,
            ITreeItem project,
            List<ITreeItem> diagrams)
        {
            var lines = diagram.Reverse();
            var first = lines.First().Split(new char[] { Constants.ArgumentSeparator, '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries);
            string name = first.Length >= 1 ? first[1] : null;

            var sb = new StringBuilder();
            foreach (var line in lines)
                sb.AppendLine(line);

            var item = TreeEditor.CreateDiagramItem(name, Context.CreateDiagram, counter);
            item.SetTag(new Diagram(sb.ToString(), null));

            project.Add(item);
            diagrams.Add(item);

            int id = int.Parse(name.Split(Constants.TagNameSeparator)[1]);
            counter.Set(Math.Max(counter.Count, id + 1));
        }
        private IEnumerable<ITreeItem> Parse(IEnumerable<TreeProject> projects,
            IdCounter counter,
            ITreeItem solution)
        {
            var items = new List<ITreeItem>();

            foreach (var project in projects)
            {
                string name = project.Name;
                var diagrams = project.Diagrams.Reverse();
                var item = TreeEditor.CreateProjectItem(name, Context.CreateProject, counter);
                solution.Add(item);

                int id = int.Parse(name.Split(Constants.TagNameSeparator)[1]);
                counter.Set(Math.Max(counter.Count, id + 1));

                Parse(counter, diagrams, item, items);
            }

            var first = items.FirstOrDefault();
            if (first != null)
                first.SetSelected(true);

            return items;
        }
 public static void AddProject(ITreeItem solution,
                               Func <ITreeItem> createProject,
                               IdCounter counter)
 {
     solution.Add(CreateProjectItem(null, createProject, counter));
 }
 public static void AddProject(ITreeItem solution,
     Func<ITreeItem> createProject,
     IdCounter counter)
 {
     solution.Add(CreateProjectItem(null, createProject, counter));
 }