Пример #1
0
        // Deep Clone
        public TVService DeepCopy()
        {
            TVService ds = new TVService();

            if (!string.IsNullOrEmpty(this.UniqueId))
            {
                ds.UniqueId = string.Copy(this.UniqueId);
            }
            ds.MCChannelID = this.MCChannelID;
            if (!string.IsNullOrEmpty(this.Callsign))
            {
                ds.Callsign = string.Copy(this.Callsign);
            }
            ds.IsFavorite         = this.IsFavorite;
            ds.MCChannelNumber    = this.MCChannelNumber;
            ds.MCSubChannelNumber = this.MCSubChannelNumber;
            ds.UserSortOrder      = this.UserSortOrder;
            if (!string.IsNullOrEmpty(this.LogoUri))
            {
                ds.LogoUri = string.Copy(this.LogoUri);
            }
            if (!string.IsNullOrEmpty(this.FavoriteLineUpNames))
            {
                ds.FavoriteLineUpNames = string.Copy(this.FavoriteLineUpNames);
            }
            ds.WatchedDuration = this.WatchedDuration;

            return(ds);
        }
Пример #2
0
        public static bool GetScheduleEventForTVProgramme(CommonEPG.TVProgramme tvp, ref ScheduleEvent matchingEvent, ref ScheduleRequest matchingRequest)
        {
            CommonEPG.TVService tvc = EPGManager.TVServiceWithIDOrNull(tvp.ServiceID);
            if (tvc == null)
            {
                return(false);
            }

            return(GetScheduleEventAtExactTimeOnChannel(tvp.StartTimeDT(), tvc.Callsign, false, "", ref matchingEvent, ref matchingRequest));
        }
Пример #3
0
        /* NB: UPDATED 2011-04-10
         *
         * BE SURE TO COPY STRING VALUES RATHER THAN REFERENCES
         * I.E. STRING.COPY(...) TO AVOID DANGLING REFERENCES TO OBJECTS
         * MANAGED BY MEDIA CENTER ITSELF
         *
         * */
        public static TVService TVServiceFromChannel(Channel c)
        {
            TVService tvs = new TVService();

            tvs.Callsign = "Null Channel";

            try
            {
                if (
                    (c == null) ||
                    (c.Service == null)
                    )
                {
                    tvs.UniqueId = new Random().Next(999999).ToString();
                    return(tvs);
                }

                // Valid channel
                // IDs - story both a unique ID for the service, and the ID of the media center channel
                tvs.UniqueId    = string.Copy(c.Service.Id.ToString("G17")); // string copy may be redundant
                tvs.MCChannelID = c.Id;

                if (!string.IsNullOrEmpty(c.CallSign))
                {
                    tvs.Callsign = string.Copy(c.CallSign);
                }

                tvs.MCChannelNumber    = c.Number;
                tvs.MCSubChannelNumber = c.SubNumber;
                tvs.WatchedDuration    = c.WatchedDuration;


                if (c.Service.LogoImage != null)
                {
                    if (!(string.IsNullOrEmpty(c.Service.LogoImage.AbsoluteUri)))
                    {
                        tvs.LogoUri = string.Copy(c.Service.LogoImage.AbsoluteUri);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
                Debug.Print(ex.StackTrace);
            }

            return(tvs);
        }
Пример #4
0
        private void attemptMoveCachedChannelToNewIndex(TVService tvc, int newIndex)
        {
            LocalChannelCache.Remove(tvc);

            if (newIndex < 0) newIndex = 0;
            if (newIndex > LocalChannelCache.Count) newIndex = LocalChannelCache.Count;

            LocalChannelCache.Insert(newIndex, tvc);
            SetLocalChannelCacheDirty(true);
        }
Пример #5
0
        private bool GetLVIAndTVChannelForSelectedIndex(ref ListViewItem lvi, ref TVService tvc, ref int SelectedIndex)
        {
            if (lvChannelManager.SelectedIndices.Count < 1) return false;
            SelectedIndex = lvChannelManager.SelectedIndices[0];

            try
            {
                lvi = lvChannelManager.Items[SelectedIndex];
                tvc = LocalChannelCache[SelectedIndex];
                return true;
            }
            catch
            {
                return false;
            }
        }
Пример #6
0
        // Deep Clone
        public TVService DeepCopy()
        {
            TVService ds = new TVService();
            if (! string.IsNullOrEmpty(this.UniqueId))
                ds.UniqueId = string.Copy(this.UniqueId);
            ds.MCChannelID = this.MCChannelID;
            if (!string.IsNullOrEmpty(this.Callsign))
                ds.Callsign = string.Copy(this.Callsign);
            ds.IsFavorite = this.IsFavorite;
            ds.MCChannelNumber = this.MCChannelNumber;
            ds.MCSubChannelNumber = this.MCSubChannelNumber;
            ds.UserSortOrder = this.UserSortOrder;
            if (!string.IsNullOrEmpty(this.LogoUri))
                ds.LogoUri = string.Copy(this.LogoUri);
            if (!string.IsNullOrEmpty(this.FavoriteLineUpNames))
                ds.FavoriteLineUpNames = string.Copy(this.FavoriteLineUpNames);
            ds.WatchedDuration = this.WatchedDuration;

            return ds;
        }
Пример #7
0
        /* NB: UPDATED 2011-04-10
         *
         * BE SURE TO COPY STRING VALUES RATHER THAN REFERENCES
         * I.E. STRING.COPY(...) TO AVOID DANGLING REFERENCES TO OBJECTS
         * MANAGED BY MEDIA CENTER ITSELF
         *
         * */
        public static TVService TVServiceFromChannel(Channel c)
        {
            TVService tvs = new TVService();
            tvs.Callsign = "Null Channel";

            try
            {
                if (
                    (c == null) ||
                    (c.Service == null)
                    )
                {
                    tvs.UniqueId = new Random().Next(999999).ToString();
                    return tvs;
                }

                // Valid channel
                // IDs - story both a unique ID for the service, and the ID of the media center channel
                tvs.UniqueId = string.Copy(c.Service.Id.ToString("G17")); // string copy may be redundant
                tvs.MCChannelID = c.Id;

                if (!string.IsNullOrEmpty(c.CallSign))
                    tvs.Callsign = string.Copy( c.CallSign );

                tvs.MCChannelNumber = c.Number;
                tvs.MCSubChannelNumber = c.SubNumber;
                tvs.WatchedDuration = c.WatchedDuration;

                if (c.Service.LogoImage != null)
                {
                    if (!(string.IsNullOrEmpty(c.Service.LogoImage.AbsoluteUri)))
                        tvs.LogoUri = string.Copy(c.Service.LogoImage.AbsoluteUri);
                }

            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
                Debug.Print(ex.StackTrace);
            }

            return tvs;
        }