Archived
1
0

Development 1.1

This commit is contained in:
Michael Gordeev
2018-06-29 01:00:33 +03:00
parent 8dd78f9853
commit 0782f9a506
48 changed files with 2403 additions and 825 deletions
+104
View File
@@ -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();
}
}
}