public async Task CloseChannel(ChatInstance chat) { await chat.DisconnectAsync(true); if (chat == ActiveChat) { ActiveChat = PreviousChat; } lock (OpenChannels) OpenChannels.Remove(chat); chat.Dispose(); }
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); }