Esempio n. 1
0
        public async Task ClosePlanetChatChannel(ChannelWindowComponent window)
        {
            ClientPlanetChatChannel channel = window.Channel;

            OpenPlanetChatWindows.Remove(window);

            // If there are no longer any windows open for the channel, leave
            if (!OpenPlanetChatWindows.Any(x => x.Channel.Id == channel.Id))
            {
                // Leaves channel via signalr
                await signalRManager.hubConnection.SendAsync("LeaveChannel", channel.Id);

                // Remove from list
                OpenPlanetChatChannels.Remove(channel.Id);

                Console.WriteLine($"Left SignalR group for channel {channel.Id}");
            }
        }
Esempio n. 2
0
        public async Task OpenPlanetChatChannel(ChannelWindowComponent window)
        {
            ClientPlanetChatChannel channel = window.Channel;

            if (!OpenPlanetChatChannels.ContainsKey(channel.Id))
            {
                ClientPlanet planet = await channel.GetPlanetAsync();

                // Ensure planet is opened
                await OpenPlanet(planet);

                // Joins channel via SignalR
                await signalRManager.hubConnection.SendAsync("JoinChannel", channel.Id, ClientUserManager.UserSecretToken);

                // Add to open channel list
                OpenPlanetChatChannels.Add(channel.Id, window.Channel);

                Console.WriteLine($"Joined SignalR group for channel {channel.Id}");
            }

            OpenPlanetChatWindows.Add(window);
        }