Offline errors fix
This commit is contained in:
+66
-24
@@ -57,6 +57,15 @@ namespace FoxTube
|
||||
trendMore.Clicked += TrendMore_Clicked;
|
||||
subsMore.Clicked += SubsMore_Clicked;
|
||||
|
||||
recLoading.RefreshPage += refreshPage;
|
||||
subsLoading.RefreshPage += refreshPage;
|
||||
trendLoading.RefreshPage += refreshPage;
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
private void refreshPage(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
@@ -196,40 +205,73 @@ namespace FoxTube
|
||||
|
||||
async void LoadTrending()
|
||||
{
|
||||
VideosResource.ListRequest request = SecretsVault.Service.Videos.List("id");
|
||||
request.MaxResults = 48;
|
||||
|
||||
request.Chart = VideosResource.ListRequest.ChartEnum.MostPopular;
|
||||
request.RegionCode = reg;
|
||||
VideoListResponse response = await request.ExecuteAsync();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(response.NextPageToken))
|
||||
trendToken = response.NextPageToken;
|
||||
else
|
||||
trendMore.Complete(true);
|
||||
|
||||
foreach (Video vid in response.Items)
|
||||
try
|
||||
{
|
||||
VideoCard vCard = new VideoCard(vid.Id);
|
||||
trendGrid.Add(vCard);
|
||||
}
|
||||
VideosResource.ListRequest request = SecretsVault.Service.Videos.List("id");
|
||||
request.MaxResults = 48;
|
||||
|
||||
trendLoading.Close();
|
||||
trendLoaded = true;
|
||||
request.Chart = VideosResource.ListRequest.ChartEnum.MostPopular;
|
||||
request.RegionCode = reg;
|
||||
VideoListResponse response = await request.ExecuteAsync();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(response.NextPageToken))
|
||||
trendToken = response.NextPageToken;
|
||||
else
|
||||
trendMore.Complete(true);
|
||||
|
||||
foreach (Video vid in response.Items)
|
||||
{
|
||||
VideoCard vCard = new VideoCard(vid.Id);
|
||||
trendGrid.Add(vCard);
|
||||
}
|
||||
|
||||
trendLoading.Close();
|
||||
trendLoaded = true;
|
||||
}
|
||||
catch (System.Net.Http.HttpRequestException)
|
||||
{
|
||||
trendLoading.Error("System.Net.Http.HttpRequestException", "Unable to connect to Google servers.", true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
trendLoading.Error();
|
||||
}
|
||||
}
|
||||
|
||||
void LoadRecommendations()
|
||||
{
|
||||
recLoading.Close();
|
||||
recLoaded = true;
|
||||
recLoading.Block();
|
||||
try
|
||||
{
|
||||
recLoading.Close();
|
||||
recLoaded = true;
|
||||
recLoading.Block();
|
||||
}
|
||||
catch (System.Net.Http.HttpRequestException)
|
||||
{
|
||||
recLoading.Error("System.Net.Http.HttpRequestException", "Unable to connect to Google servers.", true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
recLoading.Error();
|
||||
}
|
||||
}
|
||||
|
||||
void LoadSubscriptions()
|
||||
{
|
||||
subsLoading.Close();
|
||||
subsLoaded = true;
|
||||
subsLoading.Block();
|
||||
try
|
||||
{
|
||||
subsLoading.Close();
|
||||
subsLoaded = true;
|
||||
subsLoading.Block();
|
||||
}
|
||||
catch (System.Net.Http.HttpRequestException)
|
||||
{
|
||||
subsLoading.Error("System.Net.Http.HttpRequestException", "Unable to connect to Google servers.", true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
subsLoading.Error();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user