public virtual void AddMessage(ChatMessage message) { if (message.Author == null) { throw new ArgumentNullException("Author", "An author must be specified for each message added."); } bool flag = this.MessagesViewElement.VScrollBar.Value == this.MessagesViewElement.VScrollBar.Maximum - this.MessagesViewElement.VScrollBar.LargeChange + 1; BaseChatDataItem dataItem = this.ChatFactory.CreateDataItem(message); if (dataItem != null) { this.MessagesViewElement.Items.Add(dataItem); } ChatSuggestedActionsMessage suggestedActionsMessage = message as ChatSuggestedActionsMessage; if (suggestedActionsMessage != null) { this.SuggestedActionsElement.ClearActions(); this.SuggestedActionsElement.AddActions(suggestedActionsMessage.SuggestedActions); this.SuggestedActionsElement.Visibility = ElementVisibility.Visible; } ChatOverlayMessage message1 = message as ChatOverlayMessage; if (message1 != null) { this.ShowOverlay(message1); } if (!flag) { return; } for (int index = 0; index < 3; ++index) { this.MessagesViewElement.VScrollBar.Value = this.MessagesViewElement.VScrollBar.Maximum - this.MessagesViewElement.VScrollBar.LargeChange + 1; Application.DoEvents(); } }
public virtual void ShowOverlay(ChatOverlayMessage message) { this.ChatElement.ShowOverlay(message); }
public virtual void ShowOverlay(ChatOverlayMessage message) { if (this.IsOverlayShown || this.IsPopupOverlayShown) { if (this.IsOverlayShown) { BaseChatOverlay child = this.OverlayElement.Children[0] as BaseChatOverlay; if (child != null) { child.ChatElement = (RadChatElement)null; } this.OverlayElement.Children.Clear(); this.OverlayElement.Visibility = ElementVisibility.Collapsed; this.InputTextBox.Visibility = ElementVisibility.Visible; this.IsOverlayShown = false; } else if (this.IsPopupOverlayShown) { BaseChatOverlay child = this.OverlayPopupElement.Children[0] as BaseChatOverlay; if (child != null) { child.ChatElement = (RadChatElement)null; } this.OverlayPopupElement.Children.Clear(); this.OverlayPopupElement.Visibility = ElementVisibility.Collapsed; this.IsPopupOverlayShown = false; } } message.OverlayElement.ChatElement = this; if (message.ShowAsPopup) { message.OverlayElement.PrepareForPopupDisplay(); this.OverlayPopupElement.Children.Add((RadElement)message.OverlayElement); this.OverlayPopupElement.Visibility = ElementVisibility.Visible; this.IsPopupOverlayShown = true; } else { message.OverlayElement.PrepareForOverlayDisplay(); this.OverlayElement.Children.Add((RadElement)message.OverlayElement); this.OverlayElement.Visibility = ElementVisibility.Visible; this.InputTextBox.Visibility = ElementVisibility.Collapsed; this.IsOverlayShown = true; } message.OverlayElement.CurrentValue = message.OverlayElement.CurrentValue; foreach (RadHostItem descendant in message.OverlayElement.GetDescendants((Predicate <RadElement>)(x => x is RadHostItem), TreeTraversalMode.BreadthFirst)) { if (!string.IsNullOrEmpty(ThemeResolutionService.ApplicationThemeName)) { ThemeResolutionService.ApplyThemeToControlTree(descendant.HostedControl, ThemeResolutionService.ApplicationThemeName); } else { string themeName = this.ElementTree.ThemeName; if (string.IsNullOrEmpty(themeName)) { themeName = "ControlDefault"; } ThemeResolutionService.ApplyThemeToControlTree(descendant.HostedControl, themeName); } } }