Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var filePath = Library.Tools.IO.MyDirectory.GetSolutionDirectory() + ResultXmindFolder + Guid.NewGuid() + ".xmind";

            // Create a new, empty workbook. If the workbook exists it will be overwritten:
            XMindWorkBook xwb = new XMindWorkBook(filePath);

            //Ajout des styles
            var underlineType = xwb.AddStyleTopic(XMindTopicShape.underline, System.Drawing.Color.LightGray);

            // Create a new sheet (at least one per workbook required):
            string sheetId = xwb.AddSheet("Vehicles");

            string centralTopicId = xwb.AddCentralTopic(sheetId, "Brands", XMindStructure.TreeRight);

            string mazdaTopicId  = xwb.AddTopicWithStyle(centralTopicId, "Mazda", underlineType);
            string fordTopicId   = xwb.AddTopic(centralTopicId, "Ford");
            string bmwTopicId    = xwb.AddTopic(centralTopicId, "BMW");
            string nissanTopicId = xwb.AddTopic(centralTopicId, "Nissan", XMindStructure.TreeRight);

            string cx7TopicId = xwb.AddTopic(mazdaTopicId, "CX7");

            xwb.AddTopic(mazdaTopicId, "323");
            xwb.AddLink(mazdaTopicId, Library.Tools.IO.MyDirectory.GetSolutionDirectory() + DOC1);
            xwb.AddTopic(mazdaTopicId, "Mazda6");

            var imagePath = Library.Tools.IO.MyDirectory.GetSolutionDirectory() + IMG1;

            xwb.AddPicture(mazdaTopicId, imagePath);

            xwb.AddTopic(fordTopicId, "Bantam");
            xwb.AddTopic(fordTopicId, "Focus");
            xwb.AddTopic(fordTopicId, "Ranger");

            xwb.AddTopic(bmwTopicId, "3 series");
            xwb.AddTopic(bmwTopicId, "5 series");
            xwb.AddTopic(bmwTopicId, "7 series");

            xwb.AddTopic(nissanTopicId, "Nirvada");
            xwb.AddTopic(nissanTopicId, "Sentra");
            xwb.AddTopic(nissanTopicId, "Micra");

            xwb.AddLabel(cx7TopicId, "This is a SUV");

            xwb.AddMarker(bmwTopicId, XMindMarkers.FlagBlue);

            xwb.CollapseChildren(bmwTopicId);

            xwb.Save();
            Library.Tools.Debug.MyDebug.PrintInformation(filePath);
        }
Ejemplo n.º 2
0
        public static void ConfigureXMindWorkBook(XMindWorkBook book, string sheetId, IDictionary <string, List <UserStory> > data)
        {
            string centralTopicId = book.AddCentralTopic(sheetId, "Phase 2 Scope", XMindStructure.Map);

            foreach (KeyValuePair <string, List <UserStory> > entry in data)
            {
                var currentTopicId = book.AddTopic(centralTopicId, entry.Key);
                entry.Value.ForEach(userStory =>
                {
                    var userStoryTopicId = book.AddTopic(currentTopicId, $"{userStory.Reference}: {userStory.Name}");
                    book.AddUserTag(userStoryTopicId, userStory.Reference, userStory.Reference);
                    // add label
                    book.AddLabel(userStoryTopicId, $"{jiraBaseUrl}{userStory.Reference}");
                    // add comments
                    if (!String.IsNullOrEmpty(userStory.Comments))
                    {
                        foreach (var item in userStory.Comments.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
                        {
                            book.AddTopic(userStoryTopicId, item);
                        }
                    }
                }
                                    );
            }
            foreach (UserStory story in data.Values.SelectMany(l => l.AsEnumerable()))
            {
                if (!String.IsNullOrEmpty(story.DependsOn))
                {
                    foreach (var parent in story.DependsOn.Split(','))
                    {
                        book.AddTopicLink(
                            book.GetTopicIdsByUserTagValue(story.Reference, story.Reference).FirstOrDefault(),
                            book.GetTopicIdsByUserTagValue(parent, parent).FirstOrDefault()
                            );
                    }
                }
            }
        }