public void Load(SignalConversation conversation)
        {
            SignalConversation = conversation;
            if (SignalConversation is SignalContact contact)
            {
                Blocked            = contact.Blocked;
                SendMessageVisible = !Blocked;
            }
            else
            {
                // Need to make sure to reset the Blocked and SendMessageVisible values in case
                // a group chat is selected. Group chats can never be blocked.
                Blocked            = false;
                SendMessageVisible = !Blocked;
            }
            LastMarkReadRequest    = -1;
            InputTextBox.IsEnabled = false;
            DisposeCurrentThread();
            UpdateHeader(conversation);

            /*
             * When selecting a small (~650 messages) conversation after a bigger (~1800 messages) one,
             * ScrollToBottom would scroll so far south that the entire screen was white. Seems like the
             * scrollbar is not properly notified that the collection changed. I tried things like throwing
             * CollectionChanged (reset) event, but to no avail. This hack works, though.
             */
            ConversationItemsControl.ItemsSource = new List <object>();
            UpdateLayout();
            Collection = new VirtualizedCollection(conversation, this);
            ConversationItemsControl.ItemsSource = Collection;
            UpdateLayout();
            InputTextBox.IsEnabled = conversation.CanReceive;
            ScrollToUnread();
        }
        public void Load(SignalConversation conversation)
        {
            bool conversationThreadIdChanged = SignalConversation?.ThreadId != conversation?.ThreadId;

            SignalConversation = conversation;
            if (SignalConversation is SignalContact contact)
            {
                Blocked            = contact.Blocked;
                SendMessageVisible = !Blocked;
            }
            else
            {
                // Need to make sure to reset the Blocked and SendMessageVisible values in case
                // a group chat is selected. Group chats can never be blocked.
                Blocked            = false;
                SendMessageVisible = !Blocked;
            }
            LastMarkReadRequest = -1;
            SendButtonEnabled   = false;

            /*
             * On app resume this method (Load()) gets called with the same conversation, but new object.
             * Only load draft if it is acutally a different conversation,
             * because on mobile app gets supended during file picking and
             * the new conversation does not have the DraftFileTokens
             */
            if (conversationThreadIdChanged)
            {
                // We don't need to wait for this
                _ = LoadDraft();
            }
            UserInputBar.FocusTextBox();
            DisposeCurrentThread();
            UpdateHeader(conversation);
            SpellCheckEnabled = GlobalSettingsManager.SpellCheckSetting;

            /*
             * When selecting a small (~650 messages) conversation after a bigger (~1800 messages) one,
             * ScrollToBottom would scroll so far south that the entire screen was white. Seems like the
             * scrollbar is not properly notified that the collection changed. I tried things like throwing
             * CollectionChanged (reset) event, but to no avail. This hack works, though.
             */
            ConversationItemsControl.ItemsSource = new List <object>();
            UpdateLayout();
            Collection = new VirtualizedCollection(conversation);
            ConversationItemsControl.ItemsSource = Collection;
            UpdateLayout();
            SendButtonEnabled = conversation.CanReceive;
            ScrollToUnread();
        }
Пример #3
0
        public void Load(SignalConversation conversation)
        {
            SignalConversation     = conversation;
            InputTextBox.IsEnabled = false;
            DisposeCurrentThread();
            UpdateHeader(conversation);

            /*
             * When selecting a small (~650 messages) conversation after a bigger (~1800 messages) one,
             * ScrollToBottom would scroll so far south that the entire screen was white. Seems like the
             * scrollbar is not properly notified that the collection changed. I tried things like throwing
             * CollectionChanged (reset) event, but to no avail. This hack works, though.
             */
            ConversationItemsControl.ItemsSource = new List <object>();
            UpdateLayout();
            Collection = new VirtualizedCollection(conversation);
            ConversationItemsControl.ItemsSource = Collection;
            UpdateLayout();
            InputTextBox.IsEnabled = conversation.CanReceive;
            ScrollToUnread();
        }