Example #1
0
        public static bool RecordService(CommonBaseForm ownerForm, UiBroadcastService service)
        {
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }
            if (VerifyIsInactive(ownerForm, service))
            {
                return(false);
            }

            var task = GetRecordTask(service, null, new DateTime());

            using (var dlg = new RecordChannelDialog())
            {
                dlg.Task      = task;
                dlg.IsNewTask = true;
                dlg.ShowDialog(ownerForm);
                task = dlg.Task;
                if (dlg.DialogResult != DialogResult.OK)
                {
                    return(false);
                }
            } // using dlg

            return(ScheduleTask(ownerForm, task));
        } // RecordService
Example #2
0
        } // RecordService

        public static bool RecordProgram(CommonBaseForm ownerForm, UiBroadcastService service, EpgProgram program, DateTime localReferenceTime, bool allowRecordChannel = true)
        {
            RecordProgramOptions.RecordOption option;

            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }
            if (VerifyIsInactive(ownerForm, service))
            {
                return(false);
            }

            // select record options
            using (var dlg = new RecordProgramOptions())
            {
                dlg.SelectedService    = service;
                dlg.SelectedProgram    = program;
                dlg.LocalReferenceTime = localReferenceTime;
                dlg.AllowRecordChannel = allowRecordChannel;
                dlg.ShowDialog(ownerForm);
                option = dlg.SelectedOption;
            } // using

            if (option == RecordProgramOptions.RecordOption.None)
            {
                return(false);
            }
            if (option == RecordProgramOptions.RecordOption.Channel)
            {
                program = null;
            }

            // create record task and allow to edit it
            var task = GetRecordTask(service, program, localReferenceTime);

            if (option != RecordProgramOptions.RecordOption.Default)
            {
                using (var dlg = new RecordChannelDialog())
                {
                    dlg.Task               = task;
                    dlg.IsNewTask          = true;
                    dlg.LocalReferenceTime = localReferenceTime;
                    dlg.ShowDialog(ownerForm);
                    task = dlg.Task;
                    if (dlg.DialogResult != DialogResult.OK)
                    {
                        return(false);
                    }
                } // using dlg
            }     // if

            return(ScheduleTask(ownerForm, task));
        } // RecordProgram