Example #1
0
        public override ISchedule CreateSchedule(ScheduleType scheduleType, string name, IDictionary<string, object> parameters)
        {
            switch (scheduleType)
            {
                case ScheduleType.Periodic:
                    var triggerSettings = new PeriodicScheduleParameters(parameters);
                    var trigger = new SimpleTriggerImpl
                    {
                        Name = name,
                        RepeatCount = triggerSettings.RepeatCount, 
                        StartTimeUtc = triggerSettings.Start, 
                        RepeatInterval = triggerSettings.Interval
                    };
                    return new TriggerWrapper(trigger, scheduleType);
                
                case ScheduleType.CronBased:
                    var triggerSettingsCron = new CronScheduleParameters(parameters);
                    var triggerCron = new CronTriggerImpl
                    {
                        Name = name,
                        CronExpressionString = triggerSettingsCron.CronString
                    };
                    return new TriggerWrapper(triggerCron, scheduleType);

                default:
                    throw new Exception("Unsupported schedule type " + scheduleType.ToString());
            }
        }
 public static string GetSummary(ScheduleType frequency, int day, System.DayOfWeek dayOfWeek, string weekName = "")
 {
     string str = LocalizedObjectHelper.GetLocalizedStringFrom(frequency.ToString());
     if (((frequency == ScheduleType.EveryDay) || (frequency == ScheduleType.Weekend)) || (frequency == ScheduleType.Workday))
     {
         return str;
     }
     return string.Format("{0} {1}", str, (frequency == ScheduleType.EveryMonth) ? string.Format(LocalizedObjectHelper.GetLocalizedStringFrom("FrequencyDayOfMonthFormatter"), day) : weekName);
 }
Example #3
0
        public static string GetLogoForSchedule(ScheduleType scheduleType, bool isOneTime, bool isActive)
        {
            string suffix = String.Empty;

            if (!isOneTime)
            {
                suffix += "Series";
            }
            if (!isActive)
            {
                suffix += "Cancelled";
            }
            return(GUIGraphicsContext.Skin + @"\Media\ARGUS_" + scheduleType.ToString() + suffix + ".png");
        }
Example #4
0
        private void _exportButton_Click(object sender, EventArgs e)
        {
            try
            {
                List <Schedule> schedules = new List <Schedule>();

                DialogResult result = MessageBox.Show(this,
                                                      "Hit 'Yes' to export all schedules or 'No' to only" + Environment.NewLine + "export the selected schedule(s).",
                                                      "Export", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    foreach (DataGridViewRow row in _schedulesDataGridView.Rows)
                    {
                        ScheduleSummary scheduleSummary = row.DataBoundItem as ScheduleSummary;
                        schedules.Add(Proxies.SchedulerService.GetScheduleById(scheduleSummary.ScheduleId).Result);
                    }
                }
                else if (result == DialogResult.No)
                {
                    foreach (DataGridViewRow selectedRow in _schedulesDataGridView.SelectedRows)
                    {
                        ScheduleSummary scheduleSummary = selectedRow.DataBoundItem as ScheduleSummary;
                        schedules.Add(Proxies.SchedulerService.GetScheduleById(scheduleSummary.ScheduleId).Result);
                    }
                }
                if (schedules.Count > 0)
                {
                    ExportScheduleList exportList = new ExportScheduleList(schedules);

                    _saveFileDialog.FileName = _scheduleType.ToString() + "Schedules_" + DateTime.Today.ToString("yyyyMMdd") + "_" + DateTime.Now.ToString("HHmmss") + ".xml";
                    if (_saveFileDialog.ShowDialog() == DialogResult.OK)
                    {
                        exportList.Serialize(_saveFileDialog.FileName);

                        MessageBox.Show(this, String.Format("{0} schedule(s) exported.", schedules.Count), "Export",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 protected void ToString(List <string> toStringOutput)
 {
     toStringOutput.Add($"Recipient = {(Recipient == null ? "null" : Recipient.ToString())}");
     toStringOutput.Add($"ExpiresAt = {(ExpiresAt == null ? "null" : ExpiresAt == string.Empty ? "" : ExpiresAt)}");
     toStringOutput.Add($"AutoCompleteDuration = {(AutoCompleteDuration == null ? "null" : AutoCompleteDuration == string.Empty ? "" : AutoCompleteDuration)}");
     toStringOutput.Add($"ScheduleType = {(ScheduleType == null ? "null" : ScheduleType.ToString())}");
     toStringOutput.Add($"PickupAt = {(PickupAt == null ? "null" : PickupAt == string.Empty ? "" : PickupAt)}");
     toStringOutput.Add($"PickupWindowDuration = {(PickupWindowDuration == null ? "null" : PickupWindowDuration == string.Empty ? "" : PickupWindowDuration)}");
     toStringOutput.Add($"PrepTimeDuration = {(PrepTimeDuration == null ? "null" : PrepTimeDuration == string.Empty ? "" : PrepTimeDuration)}");
     toStringOutput.Add($"Note = {(Note == null ? "null" : Note == string.Empty ? "" : Note)}");
     toStringOutput.Add($"PlacedAt = {(PlacedAt == null ? "null" : PlacedAt == string.Empty ? "" : PlacedAt)}");
     toStringOutput.Add($"AcceptedAt = {(AcceptedAt == null ? "null" : AcceptedAt == string.Empty ? "" : AcceptedAt)}");
     toStringOutput.Add($"RejectedAt = {(RejectedAt == null ? "null" : RejectedAt == string.Empty ? "" : RejectedAt)}");
     toStringOutput.Add($"ReadyAt = {(ReadyAt == null ? "null" : ReadyAt == string.Empty ? "" : ReadyAt)}");
     toStringOutput.Add($"ExpiredAt = {(ExpiredAt == null ? "null" : ExpiredAt == string.Empty ? "" : ExpiredAt)}");
     toStringOutput.Add($"PickedUpAt = {(PickedUpAt == null ? "null" : PickedUpAt == string.Empty ? "" : PickedUpAt)}");
     toStringOutput.Add($"CanceledAt = {(CanceledAt == null ? "null" : CanceledAt == string.Empty ? "" : CanceledAt)}");
     toStringOutput.Add($"CancelReason = {(CancelReason == null ? "null" : CancelReason == string.Empty ? "" : CancelReason)}");
     toStringOutput.Add($"IsCurbsidePickup = {(IsCurbsidePickup == null ? "null" : IsCurbsidePickup.ToString())}");
     toStringOutput.Add($"CurbsidePickupDetails = {(CurbsidePickupDetails == null ? "null" : CurbsidePickupDetails.ToString())}");
 }
Example #6
0
        private static string GetIconImageFileName(ScheduleType scheduleType, bool isPartOfSeries, UpcomingCancellationReason cancellationReason,
                                                   bool isRecording, CardChannelAllocation cardChannelAllocation, List <Guid> conflictingPrograms)
        {
            string suffix = String.Empty;

            if (isPartOfSeries)
            {
                suffix += "Series";
            }
            if (cancellationReason != UpcomingCancellationReason.None)
            {
                suffix += "Cancelled";
                if (cancellationReason == UpcomingCancellationReason.PreviouslyRecorded ||
                    cancellationReason == UpcomingCancellationReason.AlreadyQueued)
                {
                    suffix += "History";
                }
            }
            else
            {
                if (isRecording)
                {
                    if (cardChannelAllocation == null)
                    {
                        suffix += "InConflict";
                        //toolTip = ProcessUtility.CreateConflictingProgramsToolTip(_model.UpcomingRecordings,
                        //    upcoming.UpcomingRecording.ConflictingPrograms, Utility.GetLocalizedText(TextId.ConflictsHeader),
                        //    Utility.GetLocalizedText(TextId.NoCardFoundForRecording));
                    }
                    else if (conflictingPrograms.Count > 0)
                    {
                        suffix += "WithWarning";
                        //toolTip = ProcessUtility.CreateConflictingProgramsToolTip(_model.UpcomingRecordings,
                        //    upcoming.UpcomingRecording.ConflictingPrograms, Utility.GetLocalizedText(TextId.ConflictsHeader),
                        //    Utility.GetLocalizedText((TextId.NoCardFoundForRecording));
                    }
                }
            }
            return(GUIGraphicsContext.Skin + @"\Media\ARGUS_" + scheduleType.ToString() + suffix + ".png");
        }
Example #7
0
        private IMBotMessage DoShowUpcomingCommand(IMBotConversation conversation, ScheduleType type)
        {
            if (type == ScheduleType.Recording)
            {
                using (ControlServiceAgent tvControlAgent = new ControlServiceAgent())
                {
                    UpcomingRecording[] upcomingRecordings = tvControlAgent.GetAllUpcomingRecordings(UpcomingRecordingsFilter.Recordings, false);

                    StringBuilder replyText = new StringBuilder();

                    if (upcomingRecordings.Length > 0)
                    {
                        int index = 0;
                        foreach (UpcomingRecording upcomingRecording in upcomingRecordings)
                        {
                            if (replyText.Length > 0)
                            {
                                replyText.AppendLine();
                            }

                            PluginService pluginService = null;
                            if (upcomingRecording.CardChannelAllocation != null)
                            {
                                pluginService =
                                    RecorderTunersCache.GetRecorderTunerById(upcomingRecording.CardChannelAllocation.RecorderTunerId);
                            }

                            replyText.AppendFormat("{0,3}» ", ++index);
                            Utility.AppendProgramDetails(replyText, upcomingRecording.Program.Channel, upcomingRecording.Program);
                            replyText.AppendFormat(" [{0}]", pluginService == null ? "-" : pluginService.Name);
                        }

                        conversation.Session[SessionKey.Programs] = new Session.Programs(upcomingRecordings);

                        return new IMBotMessage(replyText.ToString(), true)
                        {
                            Footer = "Use 'cancel', 'uncancel' or 'delete schedule' with <number>."
                        };
                    }
                }
            }
            else
            {
                using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
                {
                    UpcomingProgram[] upcomingPrograms = tvSchedulerAgent.GetAllUpcomingPrograms(type, false);

                    StringBuilder replyText = new StringBuilder();

                    if (upcomingPrograms.Length > 0)
                    {
                        int index = 0;
                        foreach (UpcomingProgram upcomingProgram in upcomingPrograms)
                        {
                            if (replyText.Length > 0)
                            {
                                replyText.AppendLine();
                            }
                            replyText.AppendFormat("{0,3}» ", ++index);
                            Utility.AppendProgramDetails(replyText, upcomingProgram.Channel, upcomingProgram);
                        }

                        conversation.Session[SessionKey.Programs] = new Session.Programs(upcomingPrograms);

                        return new IMBotMessage(replyText.ToString(), true)
                        {
                            Footer = "Use 'record', 'cancel', 'uncancel' or 'delete schedule' with <number>."
                        };
                    }
                }
            }
            return new IMBotMessage("There are no upcoming " + type.ToString().ToLowerInvariant() + "s.");
        }
Example #8
0
 public static string GetLogoForSchedule(ScheduleType scheduleType, bool isOneTime, bool isActive)
 {
     string suffix = String.Empty;
     if (!isOneTime)
     {
         suffix += "Series";
     }
     if (!isActive)
     {
         suffix += "Cancelled";
     }
     return GUIGraphicsContext.Skin + @"\Media\ARGUS_" + scheduleType.ToString() + suffix + ".png";
 }
Example #9
0
 private static string GetIconImageFileName(ScheduleType scheduleType, bool isPartOfSeries, UpcomingCancellationReason cancellationReason,
     bool isRecording, CardChannelAllocation cardChannelAllocation, List<Guid> conflictingPrograms)
 {
     string suffix = String.Empty;
     if (isPartOfSeries)
     {
         suffix += "Series";
     }
     if (cancellationReason != UpcomingCancellationReason.None)
     {
         suffix += "Cancelled";
         if (cancellationReason == UpcomingCancellationReason.PreviouslyRecorded
             || cancellationReason == UpcomingCancellationReason.AlreadyQueued)
         {
             suffix += "History";
         }
     }
     else
     {
         if (isRecording)
         {
             if (cardChannelAllocation == null)
             {
                 suffix += "InConflict";
                 //toolTip = ProcessUtility.CreateConflictingProgramsToolTip(_model.UpcomingRecordings,
                 //    upcoming.UpcomingRecording.ConflictingPrograms, Utility.GetLocalizedText(TextId.ConflictsHeader),
                 //    Utility.GetLocalizedText(TextId.NoCardFoundForRecording));
             }
             else if (conflictingPrograms.Count > 0)
             {
                 suffix += "WithWarning";
                 //toolTip = ProcessUtility.CreateConflictingProgramsToolTip(_model.UpcomingRecordings,
                 //    upcoming.UpcomingRecording.ConflictingPrograms, Utility.GetLocalizedText(TextId.ConflictsHeader),
                 //    Utility.GetLocalizedText((TextId.NoCardFoundForRecording));
             }
         }
     }
     return GUIGraphicsContext.Skin + @"\Media\ARGUS_" + scheduleType.ToString() + suffix + ".png";
 }
Example #10
0
        private IMBotMessage DoShowUpcomingCommand(IMBotConversation conversation, ScheduleType type)
        {
            if (type == ScheduleType.Recording)
            {
                var upcomingRecordings = Proxies.ControlService.GetAllUpcomingRecordings(UpcomingRecordingsFilter.Recordings, false).Result;

                StringBuilder replyText = new StringBuilder();

                if (upcomingRecordings.Count > 0)
                {
                    int index = 0;
                    foreach (UpcomingRecording upcomingRecording in upcomingRecordings)
                    {
                        if (replyText.Length > 0)
                        {
                            replyText.AppendLine();
                        }

                        PluginService pluginService = null;
                        if (upcomingRecording.CardChannelAllocation != null)
                        {
                            pluginService =
                                RecorderTunersCache.GetRecorderTunerById(upcomingRecording.CardChannelAllocation.RecorderTunerId);
                        }

                        replyText.AppendFormat("{0,3}» ", ++index);
                        Utility.AppendProgramDetails(replyText, upcomingRecording.Program.Channel, upcomingRecording.Program);
                        replyText.AppendFormat(" [{0}]", pluginService == null ? "-" : pluginService.Name);
                    }

                    conversation.Session[SessionKey.Programs] = new Session.Programs(upcomingRecordings);

                    return(new IMBotMessage(replyText.ToString(), true)
                    {
                        Footer = "Use 'cancel', 'uncancel' or 'delete schedule' with <number>."
                    });
                }
            }
            else
            {
                var upcomingPrograms = Proxies.SchedulerService.GetAllUpcomingPrograms(type, false).Result;

                StringBuilder replyText = new StringBuilder();

                if (upcomingPrograms.Count > 0)
                {
                    int index = 0;
                    foreach (UpcomingProgram upcomingProgram in upcomingPrograms)
                    {
                        if (replyText.Length > 0)
                        {
                            replyText.AppendLine();
                        }
                        replyText.AppendFormat("{0,3}» ", ++index);
                        Utility.AppendProgramDetails(replyText, upcomingProgram.Channel, upcomingProgram);
                    }

                    conversation.Session[SessionKey.Programs] = new Session.Programs(upcomingPrograms);

                    return(new IMBotMessage(replyText.ToString(), true)
                    {
                        Footer = "Use 'record', 'cancel', 'uncancel' or 'delete schedule' with <number>."
                    });
                }
            }
            return(new IMBotMessage("There are no upcoming " + type.ToString().ToLowerInvariant() + "s."));
        }
        public override System.Xml.XmlDocument XmlSerialize()
        {
            System.Xml.XmlDocument document = base.XmlSerialize();

            System.Xml.XmlNode propertiesNode = document.ChildNodes[1].ChildNodes[0];


            #region Properties

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "ScheduleTypeInt32", ((Int32)ScheduleType).ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "ScheduleType", ScheduleType.ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "ScheduleValue", ScheduleValue.ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "ScheduleQualifierInt32", ((Int32)ScheduleQualifier).ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "ScheduleQualifier", ScheduleQualifier.ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "AnchorDateInt32", ((Int32)AnchorDate).ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "AnchorDate", AnchorDate.ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "Reoccurring", Reoccurring.ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "PerformActionDateTypeInt32", ((Int32)PerformActionDateType).ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "PerformActionDateType", PerformActionDateType.ToString());

            #endregion


            #region Object Nodes

            if (Action != null)
            {
                document.LastChild.AppendChild(document.ImportNode(Action.XmlSerialize().LastChild, true));
            }

            #endregion


            return(document);
        }