Development 1.1
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using System.Globalization;
|
||||
|
||||
using Google.Apis.YouTube.v3;
|
||||
using Google.Apis.YouTube.v3.Data;
|
||||
using Windows.Storage;
|
||||
|
||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace FoxTube
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class Home : Page
|
||||
{
|
||||
public Home()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public async void Initialize()
|
||||
{
|
||||
#region Vairables declaring
|
||||
VideoGrid videoGrid = new VideoGrid();
|
||||
string reg;
|
||||
|
||||
try
|
||||
{
|
||||
reg = (ApplicationData.Current.LocalSettings.Values["region"] as string).ToUpper().Remove(0, 3);
|
||||
}
|
||||
catch(ArgumentOutOfRangeException)
|
||||
{
|
||||
reg = (ApplicationData.Current.LocalSettings.Values["region"] as string).ToUpper();
|
||||
}
|
||||
#endregion
|
||||
|
||||
pivot.Items.Clear();
|
||||
grid.RowDefinitions[0].Height = new GridLength(0);
|
||||
|
||||
#region Request-Response
|
||||
VideosResource.ListRequest request = SecretsVault.NoAuthService.Videos.List("snippet,contentDetails,statistics");
|
||||
request.Chart = VideosResource.ListRequest.ChartEnum.MostPopular;
|
||||
request.RegionCode = reg;
|
||||
request.MaxResults = 48;
|
||||
|
||||
VideoListResponse response = await request.ExecuteAsync();
|
||||
#endregion
|
||||
|
||||
foreach (Google.Apis.YouTube.v3.Data.Video vid in response.Items)
|
||||
{
|
||||
VideoCard vCard = new VideoCard(vid.Id);
|
||||
videoGrid.AddCards(vCard);
|
||||
}
|
||||
|
||||
pivot.Items.Add(new PivotItem()
|
||||
{
|
||||
Margin = new Thickness(0,-48,0,0),
|
||||
Name = "trending",
|
||||
Content = videoGrid
|
||||
});
|
||||
|
||||
/*if((Parent as MainPage).Logged)
|
||||
{
|
||||
grid.RowDefinitions[0].Height = new GridLength(47);
|
||||
//TO-DO: Add initializing recommended and subscriptions tabs
|
||||
}*/
|
||||
}
|
||||
|
||||
private void toRecommended_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void toTrending_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void tosubs_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void refresh_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user