示例#1
0
        /// <summary>
        ///     Called when the server reports that the client has left a chat channel.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void OnLeftChatChannel(object sender, LeftChatChannelEventArgs e)
        {
            var channel = JoinedChatChannels.Find(x => x.Name == e.ChannelName);

            // If the channel no longer exists in the joined chat channels, then don't do anything with it.
            if (channel == null)
            {
                return;
            }

            JoinedChatChannels.Remove(channel);

            // The previous selected button.
            var oldSelected = Dialog.ChatChannelList.SelectedButton;

            // The channel exists, so we have to kick them out in the overlay.
            var channelButton = Dialog.ChatChannelList.Buttons.Find(x => x.Channel == channel);

            // Make sure the channel is selected temporarily.
            if (channelButton != oldSelected)
            {
                channelButton.SelectChatChannel();
            }

            // Leave the channel
            Dialog.CurrentTopic.CloseActiveChatChannel();

            // Select the old channel that was originally there.
            if (channelButton != oldSelected)
            {
                oldSelected.SelectChatChannel();
            }
        }
示例#2
0
        /// <summary>
        ///     Called when we've left a chat channel successfully.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnLeftChatChannel(object sender, LeftChatChannelEventArgs e)
        {
            if (e.ChannelName != Channel.Name)
            {
                return;
            }

            JoinLeaveButton.OriginalColor = Colors.MainAccent;
            JoinLeaveButton.Text.Text     = "Join";
            JoinLeaveButton.IsClickable   = true;
        }