Esempio n. 1
0
        async Task Process(JoinChannelResponse response)
        {
            if (response.Success)
            {
                var chan = new Channel()
                {
                    Name  = response.Channel.ChannelName,
                    Topic = response.Channel.Topic,
                };

                JoinedChannels[response.ChannelName] = chan;

                foreach (var u in response.Channel.Users)
                {
                    User user;
                    if (existingUsers.TryGetValue(u, out user))
                    {
                        chan.Users[u] = user;
                    }
                }

                var cancelEvent = new CancelEventArgs <Channel>(chan);
                PreviewChannelJoined(this, cancelEvent);
                if (!cancelEvent.Cancel)
                {
                    ChannelJoined(this, chan);
                    ChannelUserAdded(this, new ChannelUserInfo()
                    {
                        Channel = chan, Users = chan.Users.Values.ToList()
                    });
                    if (!string.IsNullOrEmpty(chan.Topic.Text))
                    {
                        ChannelTopicChanged(this, new ChangeTopic()
                        {
                            ChannelName = chan.Name,
                            Topic       = chan.Topic
                        });
                    }
                }
            }
            else
            {
                ChannelJoinFailed(this, response);
            }
        }
Esempio n. 2
0
        async Task Process(JoinChannelResponse response)
        {
            if (response.Success)
            {
                var chan = new Channel()
                {
                    Name         = response.Channel.ChannelName,
                    Topic        = response.Channel.Topic,
                    TopicSetBy   = response.Channel.TopicSetBy,
                    TopicSetDate = response.Channel.TopicSetDate,
                };

                JoinedChannels[response.ChannelName] = chan;

                foreach (var u in response.Channel.Users)
                {
                    User user;
                    if (existingUsers.TryGetValue(u, out user))
                    {
                        chan.Users[u] = user;
                    }
                }

                var cancelEvent = new CancelEventArgs <Channel>(chan);
                PreviewChannelJoined(this, cancelEvent);
                if (!cancelEvent.Cancel)
                {
                    ChannelJoined(this, new EventArgs <Channel>(chan));
                    ChannelUserAdded(this, new EventArgs <ChannelUserInfo>(new ChannelUserInfo()
                    {
                        Channel = chan, Users = chan.Users.Values.ToList()
                    }));
                }
            }
            else
            {
                ChannelJoinFailed(this, new EventArgs <JoinChannelResponse>(response));
            }
        }
Esempio n. 3
0
 void TasClient_ChannelJoinFailed(object sender, JoinChannelResponse joinChannelResponse)
 {
     WarningBar.DisplayWarning("Channel Joining Error - " + joinChannelResponse.Reason, "Cannot join channel");
 }