Archived
1
0

Offline errors fix

This commit is contained in:
Michael Gordeev
2018-08-15 16:57:31 +03:00
parent 8e454c3375
commit 26907c9aac
12 changed files with 172 additions and 113 deletions
+8
View File
@@ -141,6 +141,10 @@ namespace FoxTube.Pages
loading.Close();
}
catch (System.Net.Http.HttpRequestException)
{
loading.Error("System.Net.Http.HttpRequestException", "Unable to connect to Google servers.", true);
}
catch
{
loading.Error();
@@ -175,6 +179,10 @@ namespace FoxTube.Pages
playlistLoading.Close();
}
catch (System.Net.Http.HttpRequestException)
{
playlistLoading.Error("System.Net.Http.HttpRequestException", "Unable to connect to Google servers.", true);
}
catch
{
playlistLoading.Error();
+66 -24
View File
@@ -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();
}
}
}
}
+4 -4
View File
@@ -20,8 +20,8 @@
</StackPanel>
<TextBlock Text="OR" FontSize="20" HorizontalAlignment="Center"/>
<Button Name="wifiRefresh" Click="wifiRefresh_Click" Content="Refresh page" HorizontalAlignment="Center" Background="Red" Foreground="White" Margin="5"/>
<TextBlock Name="wifiException" Foreground="Gray" Text="Exception:" HorizontalAlignment="Center"/>
<TextBlock Name="wifiMessage" Foreground="Gray" Text="Message:" HorizontalAlignment="Center"/>
<TextBlock Name="wifiException" Foreground="Gray" Text="Exception:" HorizontalAlignment="Center" IsTextSelectionEnabled="True"/>
<TextBlock Name="wifiMessage" Foreground="Gray" Text="Message:" HorizontalAlignment="Center" IsTextSelectionEnabled="True"/>
</StackPanel>
<StackPanel Name="trouble" Visibility="Collapsed" VerticalAlignment="Center">
@@ -32,8 +32,8 @@
<Button Name="refresh" Click="wifiRefresh_Click" Content="Refresh page" Margin="5"/>
<Button Content="Leave feedback" Background="Red" Foreground="White" Margin="5" Name="feedback" Click="feedback_Click"/>
</StackPanel>
<TextBlock Name="exception" Foreground="Gray" Text="Exception:" HorizontalAlignment="Center"/>
<TextBlock Name="message" Foreground="Gray" Text="Message:" HorizontalAlignment="Center"/>
<TextBlock Name="exception" Foreground="Gray" Text="Exception:" HorizontalAlignment="Center" IsTextSelectionEnabled="True"/>
<TextBlock Name="message" Foreground="Gray" Text="Message:" HorizontalAlignment="Center" IsTextSelectionEnabled="True"/>
</StackPanel>
<FontIcon Name="blockIcon" Visibility="Collapsed" Glyph="&#xE25B;" FontSize="100" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Gray"/>
+4 -4
View File
@@ -38,15 +38,15 @@ namespace FoxTube
if (isWifiTrouble)
{
wifiException.Text = exceptionId;
wifiMessage.Text = details;
wifiException.Text = $"ID: {exceptionId}";
wifiMessage.Text = $"Details: {details}";
wifiTrouble.Visibility = Visibility.Visible;
}
else
{
exception.Text = exceptionId;
message.Text = details;
exception.Text = $"ID: {exceptionId}";
message.Text = $"Details: {details}";
trouble.Visibility = Visibility.Visible;
}
+5 -3
View File
@@ -91,9 +91,6 @@ namespace FoxTube
SecretsVault.AuthorizationStateChanged += Vault_AuthorizationStateChanged;
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
SecretsVault.CheckAuthorization();
if (!SecretsVault.IsAuthorized)
nav.SelectedItem = toHome;
}
protected override void OnNavigatedTo(NavigationEventArgs e)
@@ -492,5 +489,10 @@ namespace FoxTube
else
content.GoBack();
}
public void CloseApp()
{
CoreApplication.Exit();
}
}
}
+4
View File
@@ -104,6 +104,10 @@ namespace FoxTube.Pages
loading.Close();
}
catch (System.Net.Http.HttpRequestException)
{
loading.Error("System.Net.Http.HttpRequestException", "Unable to connect to Google servers.", true);
}
catch
{
loading.Error();
+4
View File
@@ -168,6 +168,10 @@ namespace FoxTube
loading.Close();
}
catch (System.Net.Http.HttpRequestException)
{
loading.Error("System.Net.Http.HttpRequestException", "Unable to connect to Google servers.", true);
}
catch
{
loading.Error();
@@ -148,40 +148,5 @@ namespace FoxTube.Pages.SettingsPages
debugData = meta;
debugAttached.Visibility = Visibility.Visible;
}
/*
private void feedbackSubmit_Click(object sender, EventArgs e)
{
if (feedbackTitle.Text == "") MessageBox.Show("Please, fill the first field before submitting.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
else
{
string type()
{
if (feedbackSuggestion.Checked) return "Suggestion";
else return "Problem";
}
try
{
MailMessage msg = new MailMessage();
msg.To.Add("foxgameofficial@gmail.com");
msg.From = new MailAddress("sender@gmail.com");
msg.Subject = "Stream2String feedback";
msg.Body = "Type: " + type() + "\n\nTitle: " + feedbackTitle.Text + "\nDetails: " + feedbackDetails.Text + "\n\n" + feedbackMail.Text;
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
client.EnableSsl = true;
client.Credentials = new NetworkCredential("sender@gmail.com", "Thisisthepassword07734");
//Send the msg
client.Send(msg);
MessageBox.Show("Thank you for your feedback. You've just helped us to make our program better!", "Congratulations!", MessageBoxButtons.OK, MessageBoxIcon.Information);
proceedFeedback();
Properties.Settings.Default.feedback = true;
Properties.Settings.Default.Save();
}
catch { MessageBox.Show("Unfortunately, we can't send your feedback now. Please, try again later.", "Server connection error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
}
}*/
}
}
+4
View File
@@ -193,6 +193,10 @@ namespace FoxTube.Pages
loading.Close();
}
catch (System.Net.Http.HttpRequestException)
{
loading.Error("System.Net.Http.HttpRequestException", "Unable to connect to Google servers.", true);
}
catch
{
loading.Error();