public void Append(SignalMessageContainer sm)
        {
            var  sourcePanel = (ItemsStackPanel)ConversationItemsControl.ItemsPanelRoot;
            bool bottom      = sourcePanel.LastVisibleIndex == Collection.Count - 2; // -2 because we already incremented Count

            Collection.Add(sm, sm.Message.Author == null);
            if (bottom)
            {
                UpdateLayout();
                ScrollToBottom();
            }
        }
        public void Append(SignalMessageContainer sm, bool forceScroll)
        {
            var  sourcePanel = (ItemsStackPanel)ConversationItemsControl.ItemsPanelRoot;
            bool bottom      = sourcePanel.LastVisibleIndex == Collection.Count - 2; /* -2 because we already incremented Count */

            Collection.Add(sm, true);
            if (forceScroll || bottom)
            {
                UpdateLayout();
                ScrollToBottom();
            }
        }
        public AppendResult Append(SignalMessageContainer sm)
        {
            AppendResult result = null;
            bool         bottom = GetBottommostIndex() == Collection.Count - 2; // -2 because we already incremented Count

            Collection.Add(sm, sm.Message.Author == null);
            if (bottom)
            {
                UpdateLayout();
                ScrollToBottom();
                if (ActivationState != CoreWindowActivationState.Deactivated)
                {
                    result = new AppendResult(sm.Index);
                }
            }
            return(result);
        }
        protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
        {
            FrameworkElement element = container as FrameworkElement;

            if (item is SignalMessageContainer)
            {
                SignalMessageContainer smc = (SignalMessageContainer)item;
                SignalMessage          sm  = smc.Message;
                if (sm.Type == SignalMessageType.IdentityKeyChange)
                {
                    return(IdentityKeyChangeMessage);
                }
                return(NormalMessage);
            }
            if (item is SignalUnreadMarker)
            {
                return(UnreadMarker);
            }
            return(null);
        }
 public void AddToOutgoingMessagesCache(SignalMessageContainer m)
 {
     OutgoingCache[m.Message.Id] = m;
 }