public async virtual Task <IActionResult> CreateChannelMappingAsync([FromBody] ChannelMapping mapping) { // get the channelMapping for the request category var mappingDetails = await this.channelMappingRepository.GetByCategoryAsync(mapping.Category); if (mappingDetails != null) { return(this.Conflict(new UnsuccessfulResponse { Reason = "Category already in use" })); } mapping.Id = Guid.NewGuid(); mapping.CreatedDateTime = DateTime.Now; await this.channelMappingRepository.AddAsync(mapping); return(this.Ok(mapping)); }
private void ChannelCountChanged(object sender, SelectionChangedEventArgs e) { if (ChannelCount < Channels.Count) { while (Channels.Count > ChannelCount) { Channels.Remove(Channels[Channels.Count - 1]); } } else if (ChannelCount > Channels.Count) { for (int i = Channels.Count; i < ChannelCount; i++) { var channel = new ChannelMapping { Destination = (Channel)i, Filename = "", Source = Channel.R }; Channels.Add(channel); } } }
private void RefreshProgramme(object sender, RoutedEventArgs e) { Uri uri; if (ViewModel.IsSearching) { uri = new Uri(string.Format(RadioUrl.RadioUrl.PatternSearchFeed, ChannelMapping.GetUrlFriendlyName(ViewModel.SelectedChannel), Uri.EscapeUriString(ViewModel.SearchString))); } else { uri = new Uri(string.Format(RadioUrl.RadioUrl.PatternProgrammeFeed, ChannelMapping.GetUrlFriendlyName(ViewModel.SelectedChannel))); } var programmeClient = new WebClient(); programmeClient.OpenReadCompleted += programmeClient_OpenReadCompleted; programmeClient.OpenReadAsync(uri); ViewModel.IsLoading = true; }
public async Task <IActionResult> UpdateChannelMappingAsync(string id, [FromBody] ChannelMapping mapping) { // Get the channel mapping from database var originalMapping = await this.channelMappingRepository.GetAsync(new CosmosItemKey(id, id)); if (originalMapping == null) { this.logger.LogError("Failed to update channel mapping for mapping {ChannelMappingId}. The mapping does not exist.", id); return(this.NotFound(new UnsuccessfulResponse { Reason = "Channel mapping not found" })); } // Update channel mapping properties that are allowed to be updated originalMapping.Category = mapping.Category; originalMapping.ChannelId = mapping.ChannelId; originalMapping.Supervisors = mapping.Supervisors; originalMapping.BookingsBusiness = mapping.BookingsBusiness; originalMapping.BookingsService = mapping.BookingsService; await this.channelMappingRepository.UpsertAsync(originalMapping); return(this.NoContent()); }
private void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { try { if (e.Error != null) { throw e.Error; } // user token is unset, play live stream else play archive Uri uri; if (e.UserState == null) { uri = RadioUrl.RadioUrl.GetLiveStream(e.Result); } else { var timePart = e.UserState as string; uri = RadioUrl.RadioUrl.GetArchiveStream(e.Result, timePart, ViewModel.SelectedChannel); } BackgroundAudioPlayer.Instance.Track = new AudioTrack( uri, "MR-" + ViewModel.SelectedChannel, ChannelMapping.GetName(ViewModel.SelectedChannel), null, null); BackgroundAudioPlayer.Instance.Play(); ViewModel.IsPlaying = true; Thread.Sleep(1000); } catch (Exception) { MessageBox.Show("Lejátszás közben hiba történt"); } finally { ViewModel.IsLoading = false; } }