Exemplo n.º 1
0
        void combobox_private_message_channel_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            PrivateMessageChannel channel = mainwindow.combobox_private_message_channel.SelectedItem as PrivateMessageChannel;

            if (channel != null)
            {
                mainwindow.listbox_privateMessages.listbox_items.ItemsSource = channel.items;
                if (switchTabActive)
                {
                    mainwindow.tabItem_pm.IsSelected = true;
                }
                else
                {
                    switchTabActive = true;
                }
                mainwindow.updateCurrentTarget();
            }
        }
Exemplo n.º 2
0
        public void updateCurrentTarget(bool dontDetectTab = false)
        {
            TabItem tabitem = tabControl_main.SelectedItem as TabItem;

            if (tabitem != null)
            {
                textblock_enterPostHere.Text = "Enter your post...";
                if (currentPostTarget.isPm)
                {
                    textblock_enterPostHere.Text = "Enter your private message...";
                }
                textblock_composeOverlay.Text = "";
                lastTab    = currentTab;
                currentTab = tabitem;
                if (tabitem.Name.StartsWith("user_") && !dontDetectTab && string.IsNullOrEmpty(textbox_postText.textBoxContent.Text))
                {
                    User user = tabitem.DataContext as User;
                    textbox_postText.textBoxContent.Text = "@" + user.username + " ";
                }
                else if (tabitem.Name.StartsWith("channel_") && !dontDetectTab)
                {
                    IChapperCollection collection = tabitem.DataContext as IChapperCollection;
                    currentPostTarget.channelName = collection.displayName;
                    currentPostTarget.channelId   = tabitem.Name;
                    textblock_composeOverlay.Text = "Send message to " + collection.displayName;
                    textblock_enterPostHere.Text  = "Enter your message...";
                }
                else if (tabitem.Name == "tabItem_patter" && !dontDetectTab)
                {
                    PatterRoom patterRoom = combobox_patterrooms.SelectedItem as PatterRoom;
                    if (patterRoom != null)
                    {
                        currentPostTarget.channelName = patterRoom.displayName;
                        currentPostTarget.channelId   = patterRoom.id;
                        textblock_composeOverlay.Text = "Send message to Patter room " + patterRoom.displayName;
                        textblock_enterPostHere.Text  = "Enter your message...";
                    }
                    else
                    {
                        textblock_composeOverlay.Text = "Error getting channel name";
                    }
                }
                else if (tabitem.Name == "tabItem_pm" && !dontDetectTab)
                {
                    PrivateMessageChannel privateMessageChannel = combobox_private_message_channel.SelectedItem as PrivateMessageChannel;
                    if (privateMessageChannel != null)
                    {
                        currentPostTarget.channelName = privateMessageChannel.displayName;
                        currentPostTarget.channelId   = privateMessageChannel.id;
                        textblock_composeOverlay.Text = "Send private message to " + privateMessageChannel.displayName;
                        textblock_enterPostHere.Text  = "Enter your message...";
                    }
                    else
                    {
                        textblock_composeOverlay.Text = "Error getting channel name";
                    }
                }
                else
                {
                    currentPostTarget.channelName = null;
                    currentPostTarget.channelId   = null;
                    if (currentPostTarget.pmToUser != null)
                    {
                        textblock_composeOverlay.Text = "Write private message to @" + currentPostTarget.pmToUser.username;
                        textblock_enterPostHere.Text  = "Enter your message...";
                    }
                    if (currentPostTarget.replyToItem != null)
                    {
                        textblock_composeOverlay.Text = "Write reply post to @" + currentPostTarget.replyToItem.user.username;
                    }
                    else
                    {
                        textblock_composeOverlay.Text = "";
                    }
                }

                if (currentPostTarget.channelName != null)
                {
                    maxNumberOfChars = AppController.Current.account.configuration.message.text_max_length;
                }
                else
                {
                    maxNumberOfChars = AppController.Current.account.configuration.post.text_max_length;
                }

                textbox_postText_TextChanged_1(null, null);
            }
        }