예제 #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
예제 #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
예제 #3
0
        } // GetRecordDescription

        public static RecordAction GetRecordAction(UiBroadcastService service, EpgProgram epgProgram)
        {
            if (epgProgram == null)
            {
                throw new ArgumentNullException(nameof(epgProgram));
            }

            var action          = RecordAction.CreateWithDefaultValues();
            var defaultLocation = RecordSaveLocation.GetDefaultSaveLocation(AppUiConfiguration.Current.User.Record.SaveLocations);

            action.Filename         = string.Format("{0} - {1}", service.DisplayName, epgProgram.Title);
            action.FileExtension    = RecordChannelDialog.GetFilenameExtensions()[0];
            action.SaveLocationName = defaultLocation.Name;
            action.SaveLocationPath = defaultLocation.Path;
            action.Recorder         = GetDefaultRecorder();

            return(action);
        } // GetRecordAction