Archived
1
0
This commit is contained in:
Michael Gordeev
2018-09-22 23:07:10 +03:00
parent 10a6f028c0
commit 8bb0a0e11b
4 changed files with 50 additions and 30 deletions
+3 -3
View File
@@ -86,6 +86,9 @@ namespace FoxTube.Pages
try
{
channelId = id;
if (Methods.NeedToResponse)
Methods.MainPage.content_Navigated(this, null);
ChannelsResource.ListRequest request = SecretsVault.Service.Channels.List("snippet,statistics,brandingSettings");
request.Id = id;
if (content.Items.Count == 4)
@@ -133,8 +136,6 @@ namespace FoxTube.Pages
if (SecretsVault.IsAuthorized)
{
SecretsVault.Subscriptions.ForEach(x => Debug.WriteLine($"{x.Snippet.Title}: {x.Snippet.ResourceId.ChannelId}"));
Debug.WriteLine($"Current channel ID: {item.Id}");
bool b = false;
foreach (Subscription s in SecretsVault.Subscriptions)
{
@@ -148,7 +149,6 @@ namespace FoxTube.Pages
break;
}
}
Debug.WriteLine($"Channel was found: {b}");
subscriptionPane.Visibility = Visibility.Visible;
}
+43 -27
View File
@@ -502,7 +502,7 @@ namespace FoxTube
s = Sender.None;
}
private void content_Navigated(object sender, NavigationEventArgs e)
public void content_Navigated(object sender, NavigationEventArgs e)
{
Dictionary<Type, Action> switchCase = new Dictionary<Type, Action>()
{
@@ -535,38 +535,54 @@ namespace FoxTube
} },
{ typeof(ChannelPage), () =>
{
if(SecretsVault.IsAuthorized)
if(sender.GetType() != typeof(ChannelPage))
{
if((content.Content as ChannelPage).channelId == SecretsVault.AccountId)
Methods.NeedToResponse = true;
s = Sender.None;
return;
}
Methods.NeedToResponse = false;
if(SecretsVault.IsAuthorized)
{
if(nav.SelectedItem != toChannel)
nav.SelectedItem = toChannel;
if((content.Content as ChannelPage).channelId == SecretsVault.UserChannel.Id)
{
if(nav.SelectedItem != toChannel)
nav.SelectedItem = toChannel;
else
s = Sender.None;
}
else
s = Sender.None;
{
bool found = false;
for(int k = 0; k < SecretsVault.Subscriptions.Count && k < 10; k++)
if(SecretsVault.Subscriptions[k].Snippet.ResourceId.ChannelId == (content.Content as ChannelPage).channelId)
{
if(nav.SelectedItem != nav.MenuItems[k + 9])
nav.SelectedItem = nav.MenuItems[k + 9];
else
s = Sender.None;
found = true;
break;
}
if(!found)
{
nav.SelectedItem = null;
}
}
}
else
{
bool found = false;
for(int k = 0; k < SecretsVault.Subscriptions.Count && k < 10; k++)
if(SecretsVault.Subscriptions[k].Snippet.ResourceId.ChannelId == (content.Content as ChannelPage).channelId)
{
if(nav.SelectedItem != nav.MenuItems[k + 9])
nav.SelectedItem = nav.MenuItems[k + 9];
else
s = Sender.None;
found = true;
break;
}
if(!found)
nav.SelectedItem = null;
}
}
else
nav.SelectedItem = null;
nav.SelectedItem = null;
} },
{ typeof(PlaylistPage), () =>
{
if(sender.GetType() != typeof(PlaylistPage))
{
Methods.NeedToResponse = true;
s = Sender.None;
return;
}
Methods.NeedToResponse = false;
if((content.Content as PlaylistPage).playlistId == SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes)
{
if(nav.SelectedItem != toLiked)
@@ -617,7 +633,7 @@ namespace FoxTube
} }
};
try { navCase[e.SourcePageType](); }
try { navCase[content.SourcePageType](); }
catch
{
nav.SelectedItem = null;
@@ -631,7 +647,7 @@ namespace FoxTube
else
nav.IsBackEnabled = false;
if (e.SourcePageType == typeof(Home) || e.SourcePageType == typeof(Settings) || e.SourcePageType == typeof(Subscriptions))
if (content.SourcePageType == typeof(Home) || content.SourcePageType == typeof(Settings) || content.SourcePageType == typeof(Subscriptions))
{
nav.ExpandedModeThresholdWidth = 1008;
if (nav.DisplayMode == NavigationViewDisplayMode.Expanded)
+3
View File
@@ -62,6 +62,9 @@ namespace FoxTube.Pages
try
{
playlistId = id;
if (Methods.NeedToResponse)
Methods.MainPage.content_Navigated(this, null);
PlaylistsResource.ListRequest request = SecretsVault.Service.Playlists.List("snippet,contentDetails");
request.Id = id;