コード例 #1
0
        public async Task CloseChannel(ChatInstance chat)
        {
            await chat.DisconnectAsync(true);

            if (chat == ActiveChat)
            {
                ActiveChat = PreviousChat;
            }

            lock (OpenChannels)
                OpenChannels.Remove(chat);

            chat.Dispose();
        }
コード例 #2
0
        public ChatInstance OpenChannel(ServerRecord channel, Uri baseUri)
        {
            ChatInstance i;

            lock (OpenChannels) {
                i = OpenChannels.Find(s => s.Channel.Equals(channel));

                if (i == null)
                {
                    i = new ChatInstance(channel, baseUri);
                    OpenChannels.Add(i);
                }
            }
            if (i != ActiveChat)
            {
                PreviousChat = ActiveChat;
            }

            return(ActiveChat = i);
        }