/// <summary> /// Put up the series type menu, and, if an item is selected, set up a series recording for the program /// </summary> /// <param name="program"></param> public static void RecordSeries(IProgram program) { var wf = ServiceRegistration.Get <IWorkflowManager>(); SlimTvExtScheduleModel model = wf.GetModel(SlimTvExtScheduleModel.MODEL_ID) as SlimTvExtScheduleModel; model.InitModel(); model._selectedProgram = program; model.RecordSeries(); }
protected virtual void ShowProgramActions(IProgram program) { if (program == null) { return; } ILocalization loc = ServiceRegistration.Get <ILocalization>(); ItemsList actions = new ItemsList(); // if program is over already, there is nothing to do. if (program.EndTime < DateTime.Now) { actions.Add(new ListItem(Consts.KEY_NAME, loc.ToString("[SlimTvClient.ProgramOver]"))); } else { // Check if program is currently running. bool isRunning = DateTime.Now >= program.StartTime && DateTime.Now <= program.EndTime; if (isRunning) { actions.Add(new ListItem(Consts.KEY_NAME, loc.ToString("[SlimTvClient.WatchNow]")) { Command = new AsyncMethodDelegateCommand(() => TuneChannelByProgram(program)) }); } if (_tvHandler.ScheduleControl != null) { var result = _tvHandler.ScheduleControl.GetRecordingStatusAsync(program).Result; if (result.Success) { if (isRunning && result.Result != RecordingStatus.None) { actions.Add( new ListItem(Consts.KEY_NAME, loc.ToString("[SlimTvClient.WatchFromBeginning]")) { Command = new AsyncMethodDelegateCommand(() => _tvHandler.WatchRecordingFromBeginningAsync(program)) }); } AddRecordingOptions(actions, program, result.Result); } } } SlimTvExtScheduleModel.ShowDialog("[SlimTvClient.ChooseProgramAction]", actions); }
public static void ShowDialog(string title, ItemsList list) { var wf = ServiceRegistration.Get <IWorkflowManager>(); SlimTvExtScheduleModel model = wf.GetModel(SlimTvExtScheduleModel.MODEL_ID) as SlimTvExtScheduleModel; model.InitModel(); model.DialogHeader = title; model._dialogActionsList.Clear(); foreach (ListItem i in list) // ItemsList doesn't have AddRange method :-( { model._dialogActionsList.Add(i); } IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>(); screenManager.ShowDialog("DialogExtSchedule"); }
private void ShowAndEditPrograms(ISchedule schedule) { SlimTvExtScheduleModel.Show(schedule); }
/// <summary> /// Add series recording options for program /// </summary> protected void AddRecordingOptions(ItemsList items, IProgram program, RecordingStatus status) { bool isRecording = status.HasFlag(RecordingStatus.Recording); if (program != null) { bool isRunning = DateTime.Now >= program.StartTime && DateTime.Now <= program.EndTime; ILocalization localization = ServiceRegistration.Get <ILocalization>(); if (status.HasFlag(RecordingStatus.SeriesScheduled)) { if (isRecording || program.EndTime > DateTime.Now) { items.Add(new ListItem(Consts.KEY_NAME, localization.ToString(isRecording ? "[SlimTvClient.StopCurrentRecording]" : "[SlimTvClient.DeleteSingle]", program.Title)) { Command = new AsyncMethodDelegateCommand(() => CreateOrDeleteSchedule(program, ScheduleRecordingType.Once)) }); } items.Add(new ListItem(Consts.KEY_NAME, "[SlimTvClient.DeleteFullSchedule]") { Command = new AsyncMethodDelegateCommand(() => CreateOrDeleteSchedule(program, ScheduleRecordingType.EveryTimeOnEveryChannel)) }); } else { string prompt = null; if (isRecording) { prompt = "[SlimTvClient.StopCurrentRecording]"; } else if (isRunning) { prompt = "[SlimTvClient.RecordCurrentProgram]"; } else if (status.HasFlag(RecordingStatus.Scheduled)) { prompt = "[SlimTvClient.DeleteSchedule]"; } else if (program.EndTime > DateTime.Now) { prompt = "[SlimTvClient.CreateSchedule]"; } if (prompt != null) { items.Add(new ListItem(Consts.KEY_NAME, localization.ToString(prompt, program.Title)) { Command = new AsyncMethodDelegateCommand(() => CreateOrDeleteSchedule(program)) }); } items.Add( new ListItem(Consts.KEY_NAME, "[SlimTvClient.RecordSeries]") { Command = new MethodDelegateCommand(() => SlimTvExtScheduleModel.RecordSeries(program)) }); } } if (_programExtensions == null) { BuildExtensions(); } ILocalization loc = ServiceRegistration.Get <ILocalization>(); foreach (KeyValuePair <Guid, TvExtension> programExtension in _programExtensions) { TvExtension extension = programExtension.Value; // First check if this extension applies for the selected program if (!extension.Extension.IsAvailable(program)) { continue; } items.Add( new ListItem(Consts.KEY_NAME, loc.ToString(extension.Caption)) { Command = new MethodDelegateCommand(() => extension.Extension.ProgramAction(program)) }); } }