Exemple #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
Exemple #2
0
 public static DialogResult ShowGrid(CommonBaseForm parentForm, IList <UiBroadcastService> list, UiBroadcastService currentService, EpgDatastore datastore)
 {
     using (var dialog = new EpgBasicGridDialog())
     {
         dialog.ServicesList   = list;
         dialog.InitialService = currentService;
         dialog.Datastore      = datastore;
         return(dialog.ShowDialog(parentForm));
     } // using
 }     // ShowGrid
Exemple #3
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
Exemple #4
0
        } // GetRecordAdvancedSettings

        public static bool ScheduleTask(CommonBaseForm ownerForm, RecordTask task)
        {
            // schedule task
            var scheduler = new Scheduler(ownerForm.GetExceptionHandler(),
                                          AppUiConfiguration.Current.Folders.RecordTasks, AppUiConfiguration.Current.User.Record.RecorderLauncherPath);

            if (scheduler.CreateTask(task))
            {
                MessageBox.Show(ownerForm, Properties.Resources.SchedulerCreateTaskOk, ownerForm.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(true);
            } // if

            return(false);
        } // ScheduleTask
Exemple #5
0
        } // GetDefaultRecorder

        private static bool VerifyIsInactive(CommonBaseForm ownerForm, UiBroadcastService service)
        {
            if (service.IsInactive)
            {
                var box = new ExceptionMessageBox()
                {
                    Caption       = ownerForm.Text,
                    Text          = string.Format(Properties.Resources.RecordDeadTvChannel, service.DisplayName),
                    Beep          = true,
                    Symbol        = ExceptionMessageBoxSymbol.Question,
                    Buttons       = ExceptionMessageBoxButtons.YesNo,
                    DefaultButton = ExceptionMessageBoxDefaultButton.Button2,
                };

                if (box.Show(ownerForm) != DialogResult.Yes)
                {
                    return(true);
                }
            } // if

            return(false);
        } // VerifyIsInactive
Exemple #6
0
 protected override void ExceptionHandler(CommonBaseForm form, ExceptionEventData ex)
 {
     MyApplication.HandleException(form, ex);
 } // ExceptionHandler