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; }
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); }
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); } }
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; }
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; }
public void Remove(ConversationSection targetSection) { _sections.Remove(targetSection); Document.Blocks.Remove(targetSection.Content); }
public void AddLast(ConversationSection section) { _sections.Add(section); Document.Blocks.Add(section.Content); }
public void AddBefore(ConversationSection section, ConversationSection point) { var index = _sections.IndexOf(point); _sections.Insert(index, section); Document.Blocks.InsertBefore(point.Content, section.Content); }
public void AddAfter(ConversationSection section, ConversationSection point) { var index = _sections.IndexOf(point); _sections.Insert(index + 1, section); Document.Blocks.InsertAfter(point.Content, section.Content); }