public async Task UpdateChannelSystemIsModerator(string channelName, bool systemIsModerator) { var model = new UpdateSystemIsModeratorStatusModel { SystemIsModerator = systemIsModerator }; var channel = await apiGateway.Post <ChannelModel, UpdateSystemIsModeratorStatusModel>(model, "channels", routeValues : new string[] { channelName, "systemIsModerator" }).ConfigureAwait(false); var existingChannel = Channels.Find(x => string.Equals(x.ChannelName, channelName, StringComparison.OrdinalIgnoreCase)); if (existingChannel != null) { Channels.Remove(existingChannel); Channels.Add(channel); } var existingChannelWithoutUser = ChannelsWithoutUser.Find(x => string.Equals(x.ChannelName, channelName, StringComparison.OrdinalIgnoreCase)); if (existingChannelWithoutUser != null) { ChannelsWithoutUser.Remove(existingChannelWithoutUser); ChannelsWithoutUser.Add(channel); } NotifyStateChanged(); }
private void UpdateConnectedStateForChannels(string channelName, bool shouldListen) { var channel = Channels.Find(x => x.ChannelName == channelName); if (channel != null) { channel.ShouldListen = shouldListen; } var channelWithoutUser = ChannelsWithoutUser.Find(x => x.ChannelName == channelName); if (channelWithoutUser != null) { channelWithoutUser.ShouldListen = shouldListen; } }
private void UpdateAutoModListenerForChannels(string channelName, bool autoModIsListening) { var channel = Channels.Find(x => x.ChannelName == channelName); if (channel != null) { channel.ShouldListenForAutoModdedMessages = autoModIsListening; } var channelWithoutUser = ChannelsWithoutUser.Find(x => x.ChannelName == channelName); if (channelWithoutUser != null) { channelWithoutUser.ShouldListenForAutoModdedMessages = autoModIsListening; } }