This repository has been archived by the owner on Jun 18, 2021. It is now read-only.
/
CategoryPage.xaml.cs
46 lines (41 loc) · 1.66 KB
/
CategoryPage.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
// The Basic Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234237
namespace KhanViewer
{
/// <summary>
/// A basic page that provides characteristics common to most applications.
/// </summary>
public sealed partial class CategoryPage : KhanViewer.Common.LayoutAwarePage
{
public CategoryPage()
{
this.InitializeComponent();
}
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
string categoryparam = e.Parameter.ToString();
App.ViewModel.TrackPageView(categoryparam, "/Playlist/" + categoryparam);
var category = App.ViewModel.GetCategory(categoryparam);
category.LoadVideos();
pageRoot.DataContext = category;
}
private void MainListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// If selected index is -1 (no selection) do nothing
if (MainListBox.SelectedIndex == -1)
return;
var item = MainListBox.SelectedItem as VideoItem;
// Navigate to the new page
//item.Navigate();
Frame.Navigate(typeof(VideoPlayer), item);
// Reset selected index to -1 (no selection)
MainListBox.SelectedIndex = -1;
}
}
}