示例#1
0
        private Section GetOrAddMessageSection()
        {
            var target = ConversationModel.Sections
                    .LastOrDefault(conversationSection => conversationSection.Type == SectionType.Message);
            if (target != null)
            {
                return target.Content;
            }

            var newSection = new ConversationSection
            {
                Content = new Section(),
                Type = SectionType.Message
            };
            var status = ConversationModel.Sections
                .LastOrDefault(section => section.Type == SectionType.Status);
            if (status == null)
            {
                ConversationModel.AddLast(newSection);
            }
            else
            {
                ConversationModel.AddBefore(newSection, status);
            }
            return newSection.Content;
        }
示例#2
0
 public override void Execute()
 {
     var section = new ConversationSection
     {
         Content = new Section(),
         Type = SectionType.HistoryControl
     };
     var block = _builder.CreateBlock(_message);
     section.Content.Blocks.Add(block);
     ConversationModel.AddFirst(section);
 }
示例#3
0
 public void AddFirst(ConversationSection section)
 {
     if (Document.Blocks.Count == 0)
     {
         _sections.Add(section);
         Document.Blocks.Add(section.Content);
     }
     else
     {
         _sections.Insert(0, section);
         var first = Document.Blocks.FirstBlock;
         Document.Blocks.InsertBefore(first, section.Content);
     }
 }
示例#4
0
        private Section GetOrAddMessageSection()
        {
            var target = ConversationModel.Sections
                    .FirstOrDefault(conversationSection => conversationSection.Type == SectionType.Message);
            if (target != null)
            {
                return target.Content;
            }

            var newSection = new ConversationSection
            {
                Content = new Section(),
                Type = SectionType.Message
            };
            ConversationModel.AddFirst(newSection);
            return newSection.Content;
        }
示例#5
0
        private Section GetOrAddStatusSection()
        {
            var target = ConversationModel.Sections
                    .LastOrDefault(conversationSection => conversationSection.Type == SectionType.Status);
            if (target != null)
            {
                return target.Content;
            }

            var newSection = new ConversationSection
            {
                Content = new Section(),
                Type = SectionType.Status
            };
            ConversationModel.AddLast(newSection);
            return newSection.Content;
        }
示例#6
0
 public void Remove(ConversationSection targetSection)
 {
     _sections.Remove(targetSection);
     Document.Blocks.Remove(targetSection.Content);
 }
示例#7
0
 public void AddLast(ConversationSection section)
 {
     _sections.Add(section);
     Document.Blocks.Add(section.Content);
 }
示例#8
0
 public void AddBefore(ConversationSection section, ConversationSection point)
 {
     var index = _sections.IndexOf(point);
     _sections.Insert(index, section);
     Document.Blocks.InsertBefore(point.Content, section.Content);
 }
示例#9
0
 public void AddAfter(ConversationSection section, ConversationSection point)
 {
     var index = _sections.IndexOf(point);
     _sections.Insert(index + 1, section);
     Document.Blocks.InsertAfter(point.Content, section.Content);
 }