예제 #1
0
        public bool UpdateServiceItem(DataModel_Channel data)
        {
            // 1. find the item in DB to update
            var item = from c in _dbEngine.CmtvDBContext.Service_items where c.ID == data.ID select c;

            Table_Service t = item.FirstOrDefault();

            // 2. assign values
            t.ServiceName = data.ChannelName;
            t.Description = data.Description;
            t.ForFree     = data.Free;
            t.Genre       = data.Genre;

            // 3. submit changes
            try
            {
                _dbEngine.CmtvDBContext.SubmitChanges();
            }
            catch
            {
                return(false);
            }

            return(true);
        }
예제 #2
0
        public void ReadAllChannelsToDC()
        {
            //if (!isAddedToCollection)

            // refresh the view everytime
            this.DC_AllChannels.Clear();
            IEnumerator <Table_Service> enumerator = _dbEngine.CmtvDBContext.Service_items.GetEnumerator();

            while (enumerator.MoveNext())
            {
                DataModel_Channel d = new DataModel_Channel
                {
                    ChannelName = enumerator.Current.ServiceName,
                    Description = enumerator.Current.Description,
                    ID          = enumerator.Current.ID,
                    Genre       = enumerator.Current.Genre,
                    Free        = enumerator.Current.ForFree,
                    IsFavorite  = enumerator.Current.IsFavorite
                };
                // get the content from service ID
                var contents = QueryContentFromServiceID(enumerator.Current.ID);

                // only pickup the first item
                if (contents.Count > 0)
                {
                    d.CurrentContentName      = contents.FirstOrDefault().ProgramName;
                    d.CurrentContentStartTime = contents.FirstOrDefault().StartTime;
                    d.CurrentContentEndTime   = contents.FirstOrDefault().EndTime;
                }

                this.DC_AllChannels.Add(d);
            }
        }
예제 #3
0
        public void PrepareToPlayNextChannel()
        {
            IEnumerator <DataModel_Channel> enumerator = _uiDataModel.DC_AllChannels.GetEnumerator();

            while (enumerator.MoveNext())
            {
                if (enumerator.Current.ID == m_curPlayingChannel.ID)
                {
                    if (enumerator.MoveNext())
                    {
                        m_curPlayingChannel = enumerator.Current;
                    }
                    else
                    {
                        // reach the end, back to the first
                        enumerator.Reset();
                        while (enumerator.MoveNext())
                        {
                            m_curPlayingChannel = enumerator.Current;
                            break;
                        }
                    }
                    break;
                }
            }

            _provider.CancelProviding();
        }
예제 #4
0
        public void PrepareToPlayChannel(DataModel_Channel dc)
        {
            m_curPlayingChannel = dc;

            _provider.CancelProviding();
            // _provider.StartToProvide();
            //_provider.
        }
예제 #5
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            // when this page is loaded.

            base.OnNavigatedTo(e);
            string id = "";
            if (NavigationContext.QueryString.TryGetValue("SelectedItem", out id))
            {

                // Initializing data collections
                var dataset = App.EngineInstance.GetUIDataModel.QueryServiceFromID(id);
                currentService = dataset.FirstOrDefault();

                serviceExts = App.EngineInstance.GetUIDataModel.QueryServiceExtFromID(currentService.ID);
            }

            UpdateView();
        }
예제 #6
0
        public bool UpdateServiceItem(DataModel_Channel data)
        {
            // 1. find the item in DB to update
            var item = from c in _dbEngine.CmtvDBContext.Service_items where c.ID == data.ID select c;

            Table_Service t = item.FirstOrDefault();

            // 2. assign values
            t.ServiceName = data.ChannelName;
            t.Description = data.Description;
            t.ForFree = data.Free;
            t.Genre = data.Genre;

            // 3. submit changes
            try
            {
                _dbEngine.CmtvDBContext.SubmitChanges();
            }
            catch
            {
                return false;
            }

            return true;
        }
예제 #7
0
        public void ReadAllChannelsToDC()
        {
            //if (!isAddedToCollection)

            // refresh the view everytime
            this.DC_AllChannels.Clear();
            IEnumerator<Table_Service> enumerator = _dbEngine.CmtvDBContext.Service_items.GetEnumerator();
            while (enumerator.MoveNext())
            {
                DataModel_Channel d = new DataModel_Channel
                {
                    ChannelName = enumerator.Current.ServiceName,
                    Description = enumerator.Current.Description,
                    ID = enumerator.Current.ID,
                    Genre = enumerator.Current.Genre,
                    Free = enumerator.Current.ForFree,
                    IsFavorite = enumerator.Current.IsFavorite
                };
                // get the content from service ID
                var contents = QueryContentFromServiceID(enumerator.Current.ID);

                // only pickup the first item
                if (contents.Count > 0)
                {
                    d.CurrentContentName = contents.FirstOrDefault().ProgramName;
                    d.CurrentContentStartTime = contents.FirstOrDefault().StartTime;
                    d.CurrentContentEndTime = contents.FirstOrDefault().EndTime;
                }

                this.DC_AllChannels.Add(d);
            }
        }
예제 #8
0
파일: Engine.cs 프로젝트: yspxman/CMTVDemo
        public void PrepareToPlayNextChannel()
        {
            IEnumerator<DataModel_Channel> enumerator = _uiDataModel.DC_AllChannels.GetEnumerator();

            while (enumerator.MoveNext())
            {
                if (enumerator.Current.ID == m_curPlayingChannel.ID)
                {
                    if (enumerator.MoveNext())
                        m_curPlayingChannel = enumerator.Current;
                    else
                    {
                        // reach the end, back to the first
                        enumerator.Reset();
                        while (enumerator.MoveNext())
                        {
                            m_curPlayingChannel = enumerator.Current;
                            break;
                        }
                    }
                    break;
                }
            }

            _provider.CancelProviding();
        }
예제 #9
0
파일: Engine.cs 프로젝트: yspxman/CMTVDemo
        public void PrepareToPlayChannel(DataModel_Channel dc)
        {
            m_curPlayingChannel = dc;

            _provider.CancelProviding();
               // _provider.StartToProvide();
            //_provider.
        }