private void ChangeVolume(int volumeValue) { if (volumeValue > 10) { volumeValue = 10; } else if (volumeValue < 0) { volumeValue = 0; } using (var context = new SwpEntities()) { context.Settings.First().Volume = volumeValue; context.SaveChanges(); SetVolumeDetails(volumeValue); } }
private void SetProgram(int channelId) { using (var context = new SwpEntities()) { var currentChannel = context.TvChannels.Find(channelId); if (currentChannel == null) { speechSynthesizer.Speak(string.Format(VoiceCommand.ChannelNotFound, channelId)); return; } context.Settings.First().TvChannel = currentChannel; context.SaveChanges(); CloseProgramDescriptionPanel(); SetChannelDetails(currentChannel); SetProgramDetails(currentChannel); } }