} // GetRecordDuration public static RecordDescription GetRecordDescription(EpgProgram epgProgram, RecordChannel channel) { if (epgProgram == null) { throw new ArgumentNullException(nameof(epgProgram)); } var description = RecordDescription.CreateWithDefaultValues(); description.Name = RecordDescription.CreateTaskName(channel, epgProgram.LocalStartTime); /* var extended = program as EpgProgramExtended; * if (extended != null) * { * * } * else */ { var buffer = new StringBuilder(); buffer.AppendLine(epgProgram.Title); buffer.Append(epgProgram.ParentalRating.Description); description.Description = buffer.ToString(); } // if-else return(description); } // GetRecordDescription
} // GetRecordTask public static RecordChannel GetRecordChannel(UiBroadcastService service) { var channel = new RecordChannel() { LogicalNumber = service.DisplayLogicalNumber, Name = service.DisplayName, Description = service.DisplayDescription, ServiceKey = service.Key, ServiceName = service.FullServiceName, ChannelUrl = service.LocationUrl, }; return(channel); } // GetRecordChannel
public RecorderViewModel() { _rootDir = Path.Combine(System.Environment.CurrentDirectory, "TestRecords"); if (!Directory.Exists(_rootDir)) { Directory.CreateDirectory(_rootDir); } this.Recorder = new WaveRecorder(_rootDir); _selectedChannel = this.Recorder.Channels.First(); this.Devices = UsbReader.GetUsbDeviceList(); if (this.Devices.Count > 0) { this.SelectedSerialNumber = this.Devices[0].Key; } this.RecordCommand = new RelayCommand(p => OnRecord(), p => CanRecord()); this.StopRecordCommand = new RelayCommand(p => OnStopRecord(), p => this.Recorder.IsStarted && !CanRecord()); this.OpenRecordFolderCommand = new RelayCommand(p => OpenRecordFolder()); this.OpenDeviceCommand = new RelayCommand(p => OnOpenDevice(), p => this.Recorder.IsStarted == false && !string.IsNullOrEmpty(this.SelectedSerialNumber)); this.CloseDeviceCommand = new RelayCommand(p => OnCloseDevice(), p => this.Recorder.IsStarted); }