private void StartToPlayChannel(DataModel_Channel dc) { App.EngineInstance.PrepareToPlayChannel(dc); NavigationService.Navigate(new Uri("/player.xaml", UriKind.Relative)); ////TextBlock bl = FindFirstElementInVisualTree<TextBlock>(item); //if (bl != null) //{ // NavigationService.Navigate(new Uri("/player.xaml?SelectedItem=" + bl.Text + "&Id=" + c.ID, // UriKind.Relative)); //} }
private void FavoriteList_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (this.LbFavorite.SelectedIndex == -1) { return; } // navigate to the new page ListBoxItem item = LbFavorite.ItemContainerGenerator.ContainerFromIndex(LbFavorite.SelectedIndex) as ListBoxItem; DataModel_Channel c = item.DataContext as DataModel_Channel; this.StartToPlayChannel(c); LbFavorite.SelectedIndex = -1; }
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (listbox.SelectedIndex == -1) { return; } // navigate to the new page ListBoxItem item = listbox.ItemContainerGenerator.ContainerFromIndex(listbox.SelectedIndex) as ListBoxItem; DataModel_Channel c = item.DataContext as DataModel_Channel; StartToPlayChannel(c); listbox.SelectedIndex = -1; }
private void PgmLstPivot_LoadingPivotItem(object sender, PivotItemEventArgs e) { // var v = e.Item.Parent; // loading programs for current channel. PivotItem p = e.Item; if (p != null) { DataModel_Channel cur_channel = p.DataContext as DataModel_Channel; if (cur_channel != null) { //MessageBox.Show(d.ID + " " + d.Name); App.EngineInstance.GetUIDataModel.ReadProgramsToDCFromChannelID(cur_channel.ID); } } }
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(); }