private void liveChannelGridView_ItemClick(object sender, ItemClickEventArgs e) { var item = e.ClickedItem as LiveListItem; if (item == null) { return; } if (LiveCenterFactoryBase.IsDirectPlay(item.ChannelInfo.LiveType)) { if (IsStart(item)) { this.Frame.Navigate(typeof(PlayPage), item); } } else { if (_settingsFlyout == null) { _settingsFlyout = new SettingsFlyout(); _settingsFlyout.CloseAction += liveDetailClose; _liveDetailControl = new LiveDetailControl(); _liveDetailControl.CloseAction += liveDetailClose; _liveDetailControl.HttpTimeOutOrFail += http_FailorTimeOut; _settingsFlyout.ShowFlyout(_liveDetailControl, 510, false); emptyGrid.Width = 510; } _liveDetailControl.SetSource(item); } }
private bool IsStart(LiveListItem item) { if (LiveCenterFactoryBase.IsDirectPlay(item.ChannelInfo.LiveType)) { if (!(item.ChannelInfo.StartTime <= DateTime.Now && item.ChannelInfo.EndTime >= DateTime.Now)) { liveDetailClose(); return(false); } } return(true); }
protected override DataTemplate SelectTemplateCore(object item, DependencyObject container) { var dataItem = item as LiveListItem; if (dataItem != null) { if (dataItem.ChannelInfo.Id <= 0) { return(Application.Current.Resources["LiveCenterNoResultTemplate"] as DataTemplate); } else if (LiveCenterFactoryBase.IsDirectPlay(dataItem.ChannelInfo.LiveType)) { return(Application.Current.Resources["SnapLiveCenterTemplate"] as DataTemplate); } } return(Application.Current.Resources["SnapLiveListTemplate"] as DataTemplate); }