Пример #1
0
        public static void GetIconAndToolTip(ScheduleType scheduleType, UpcomingCancellationReason cancellationReason,
            bool isPartOfSeries, UpcomingOrActiveProgramsList upcomingRecordings, UpcomingRecording upcomingRecording,
            out Icon icon, out string toolTip)
        {
            toolTip = null;
            bool isCancelled = (cancellationReason != UpcomingCancellationReason.None);
            switch (scheduleType)
            {
                case ScheduleType.Recording:
                    GetRecordingIconAndToolTip(upcomingRecordings, cancellationReason, isPartOfSeries, upcomingRecording,
                        out icon, out toolTip);
                    break;

                case ScheduleType.Alert:
                    icon = isCancelled ? (isPartOfSeries ? Properties.Resources.AlertSeriesCancelledIcon : Properties.Resources.AlertCancelledIcon)
                        : GetIcon(ScheduleType.Alert, isPartOfSeries);
                    break;

                case ScheduleType.Suggestion:
                    icon = isCancelled ? (isPartOfSeries ? Properties.Resources.SuggestionSeriesCancelledIcon : Properties.Resources.SuggestionCancelledIcon)
                        : GetIcon(ScheduleType.Suggestion, isPartOfSeries);
                    break;

                default:
                    icon = Properties.Resources.TransparentIcon;
                    break;
            }
        }
Пример #2
0
        public void Show(Point location, ServerStatus serverStatus, IList<ActiveRecording> activeRecordings, IList<LiveStream> liveStreams, UpcomingRecording upcomingRecording)
        {
            _serverStatus = serverStatus;
            _activeRecordings = activeRecordings;
            _liveStreams = liveStreams;
            _upcomingRecording = upcomingRecording;

            int fontHeight = SystemFonts.MessageBoxFont.Height;
            int height = _programsTop;
            if (_serverStatus != ServerStatus.NotConnected)
            {
                if (activeRecordings.Count > 0)
                {
                    height += fontHeight;
                    height += (2 * fontHeight + _programsGap) * activeRecordings.Count;
                    if (liveStreams.Count > 0
                        || upcomingRecording != null)
                    {
                        height += _programsExtraGap;
                    }
                }
                if (liveStreams.Count > 0)
                {
                    height += fontHeight;
                    height += (fontHeight + _programsGap) * liveStreams.Count;
                    if (upcomingRecording != null)
                    {
                        height += _programsExtraGap;
                    }
                }
                if (upcomingRecording != null)
                {
                    height += 2 * fontHeight + _programsGap;
                }
            }
            height += fontHeight;
            height += 10;
            this.Size = new Size(this.Width, height);

            int left = location.X;
            int top;
            Rectangle workArea = Screen.GetWorkingArea(location);
            if (workArea.Contains(location))
            {
                top = location.Y - 12 - this.Height;
            }
            else
            {
                top = int.MaxValue;
            }

            this.Opacity = 0.0;
            SetBounds(Math.Min(left, workArea.Width - this.Width - 1), Math.Min(top, workArea.Height - this.Height),
                this.Width, this.Height);

            this.Show();
        }
Пример #3
0
 public static string BuildRecordingBaseFilePath(string format, UpcomingRecording upcomingRecording, string scheduleName, int? episodeNumber, int? seriesNumber)
 {
     UpcomingProgram upcoming = upcomingRecording.Program;
     return BuildRecordingBaseFilePath(format, upcoming.Channel.DisplayName, scheduleName, upcoming.Title, upcoming.CreateProgramTitle(),
         upcoming.SubTitle, upcoming.EpisodeNumberDisplay, episodeNumber, seriesNumber, upcoming.StartTime, upcoming.Category);
 }
Пример #4
0
 public static string BuildRecordingInfoToolTip(UpcomingRecording upcomingRecording, string onText)
 {
     return BuildRecordingInfoToolTip(upcomingRecording.ActualStartTime, upcomingRecording.ActualStopTime,
         upcomingRecording.CardChannelAllocation, onText);
 }
Пример #5
0
 private static void GetRecordingIconAndToolTip(UpcomingOrActiveProgramsList upcomingRecordings,
     UpcomingCancellationReason cancellationReason, bool isPartOfSeries, UpcomingRecording recording,
     out Icon icon, out string toolTip)
 {
     toolTip = null;
     if (cancellationReason == UpcomingCancellationReason.Manual)
     {
         icon = isPartOfSeries ? Properties.Resources.RecordSeriesCancelledIcon : Properties.Resources.RecordCancelledIcon;
     }
     else if (cancellationReason == UpcomingCancellationReason.PreviouslyRecorded
         || cancellationReason == UpcomingCancellationReason.AlreadyQueued)
     {
         icon = isPartOfSeries ? Properties.Resources.RecordSeriesCancelledHistoryIcon : Properties.Resources.RecordCancelledHistoryIcon;
     }
     else
     {
         if (recording != null && recording.CardChannelAllocation == null)
         {
             icon = (isPartOfSeries ? Properties.Resources.RecordSeriesInConflictIcon : Properties.Resources.RecordInConflictIcon);
             toolTip = CreateConflictingProgramsToolTip(upcomingRecordings, recording.ConflictingPrograms);
         }
         else if (recording != null && recording.ConflictingPrograms.Count > 0)
         {
             icon = (isPartOfSeries ? Properties.Resources.RecordSeriesWithWarningIcon : Properties.Resources.RecordWithWarningIcon);
             toolTip = CreateConflictingProgramsToolTip(upcomingRecordings, recording.ConflictingPrograms);
         }
         else
         {
             icon = GetIcon(ScheduleType.Recording, isPartOfSeries);
         }
     }
 }
Пример #6
0
 public async void RefreshStatus()
 {
     RefreshStatusResult result = null;
     if (Proxies.IsInitialized)
     {
         try
         {
             result = new RefreshStatusResult()
             {
                 ActiveRecordings = await Proxies.ControlService.GetActiveRecordings(),
                 LiveStreams = await Proxies.ControlService.GetLiveStreams(),
                 UpcomingRecording = await Proxies.ControlService.GetNextUpcomingRecording(false)
             };
         }
         catch
         {
             result = null;
         }
     }
     if (result == null)
     {
         _activeRecordings = new ActiveRecording[0];
         _liveStreams = new LiveStream[0];
         _upcomingRecording = null;
         SetStatusIcon(ServerStatus.NotConnected);
     }
     else
     {
         _activeRecordings = result.ActiveRecordings;
         _liveStreams = result.LiveStreams;
         _upcomingRecording = result.UpcomingRecording;
         SetStatusIcon(GetServerStatus(result.ActiveRecordings, result.LiveStreams));
     }
 }
Пример #7
0
 internal static string GetIconImageFileName(ScheduleType scheduleType, bool isPartOfSeries, UpcomingCancellationReason cancellationReason,
     UpcomingRecording upcomingRecording)
 {
     if (upcomingRecording != null)
     {
         return GetIconImageFileName(scheduleType, isPartOfSeries, cancellationReason,
             true, upcomingRecording.CardChannelAllocation, upcomingRecording.ConflictingPrograms);
     }
     else
     {
         return GetIconImageFileName(scheduleType, isPartOfSeries, cancellationReason, false, null, null);
     }
 }
Пример #8
0
 private void _refreshStatusBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (e.Error != null
         || e.Cancelled
         || e.Result == null)
     {
         _activeRecordings = new ActiveRecording[0];
         _liveStreams = new LiveStream[0];
         _upcomingRecording = null;
         SetStatusIcon(ServerStatus.NotConnected);
     }
     else
     {
         RefreshStatusResult result = (RefreshStatusResult)e.Result;
         _activeRecordings = result.ActiveRecordings;
         _liveStreams = result.LiveStreams;
         _upcomingRecording = result.UpcomingRecording;
         SetStatusIcon(GetServerStatus(result.ActiveRecordings, result.LiveStreams));
     }
 }
Пример #9
0
 internal static bool GetUpcomingRecordingAndSchedule(Guid channelId, GuideProgram program, out UpcomingRecording upcomingRecording, out Schedule schedule)
 {
     schedule = null;
     if (HasUpcomingRecording(channelId, program, out upcomingRecording))
     {
         schedule = Proxies.SchedulerService.GetScheduleById(upcomingRecording.Program.ScheduleId).Result;
         return (schedule != null);
     }
     return false;
 }
Пример #10
0
        internal static bool HasUpcomingRecording(Guid channelId, GuideProgram program, out UpcomingRecording upcomingRecording)
        {
            upcomingRecording = null;
            Guid upcomingProgramId = program.GetUniqueUpcomingProgramId(channelId);

            var upcomingRecordings = Proxies.ControlService.GetAllUpcomingRecordings(UpcomingRecordingsFilter.All, true).Result;
            foreach (UpcomingRecording recording in upcomingRecordings)
            {
                if (recording.Program.UpcomingProgramId == upcomingProgramId)
                {
                    upcomingRecording = recording;
                    return true;
                }
            }
            return false;
        }
Пример #11
0
 public Programs(UpcomingRecording[] upcomingRecordings)
 {
     _upcomingRecordings = upcomingRecordings;
 }
 public UpcomingOrActiveProgramView(UpcomingRecording upcomingRecording)
 {
     _upcomingRecording = upcomingRecording;
     _upcomingProgram = upcomingRecording.Program;
 }
Пример #13
0
        internal static bool HasUpcomingRecording(Guid channelId, GuideProgram program, out UpcomingRecording upcomingRecording)
        {
            using (ControlServiceAgent tvControlAgent = new ControlServiceAgent())
            {
                upcomingRecording = null;
                Guid upcomingProgramId = program.GetUniqueUpcomingProgramId(channelId);

                UpcomingRecording[] upcomingRecordings = tvControlAgent.GetAllUpcomingRecordings(UpcomingRecordingsFilter.All, true);
                foreach (UpcomingRecording recording in upcomingRecordings)
                {
                    if (recording.Program.UpcomingProgramId == upcomingProgramId)
                    {
                        upcomingRecording = recording;
                        return true;
                    }
                }
                return false;
            }
        }
Пример #14
0
 internal static bool GetUpcomingRecordingAndSchedule(Guid channelId, GuideProgram program, out UpcomingRecording upcomingRecording, out Schedule schedule)
 {
     schedule = null;
     if (HasUpcomingRecording(channelId, program, out upcomingRecording))
     {
         using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
         {
             schedule = tvSchedulerAgent.GetScheduleById(upcomingRecording.Program.ScheduleId);
             return (schedule != null);
         }
     }
     return false;
 }
Пример #15
0
 public GuideUpcomingProgram(UpcomingRecording upcomingRecording)
 {
     _type = ScheduleType.Recording;
     _upcomingRecording = upcomingRecording;
 }