#144: Fixed
This commit is contained in:
@@ -14,6 +14,7 @@ namespace FoxTube
|
|||||||
{
|
{
|
||||||
public static class Methods
|
public static class Methods
|
||||||
{
|
{
|
||||||
|
public static bool NeedToResponse { get; set; } = false;
|
||||||
public static MainPage MainPage
|
public static MainPage MainPage
|
||||||
{
|
{
|
||||||
get { return (Window.Current.Content as Frame).Content as MainPage; }
|
get { return (Window.Current.Content as Frame).Content as MainPage; }
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ namespace FoxTube.Pages
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
channelId = id;
|
channelId = id;
|
||||||
|
if (Methods.NeedToResponse)
|
||||||
|
Methods.MainPage.content_Navigated(this, null);
|
||||||
|
|
||||||
ChannelsResource.ListRequest request = SecretsVault.Service.Channels.List("snippet,statistics,brandingSettings");
|
ChannelsResource.ListRequest request = SecretsVault.Service.Channels.List("snippet,statistics,brandingSettings");
|
||||||
request.Id = id;
|
request.Id = id;
|
||||||
if (content.Items.Count == 4)
|
if (content.Items.Count == 4)
|
||||||
@@ -133,8 +136,6 @@ namespace FoxTube.Pages
|
|||||||
|
|
||||||
if (SecretsVault.IsAuthorized)
|
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;
|
bool b = false;
|
||||||
foreach (Subscription s in SecretsVault.Subscriptions)
|
foreach (Subscription s in SecretsVault.Subscriptions)
|
||||||
{
|
{
|
||||||
@@ -148,7 +149,6 @@ namespace FoxTube.Pages
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Debug.WriteLine($"Channel was found: {b}");
|
|
||||||
subscriptionPane.Visibility = Visibility.Visible;
|
subscriptionPane.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -502,7 +502,7 @@ namespace FoxTube
|
|||||||
s = Sender.None;
|
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>()
|
Dictionary<Type, Action> switchCase = new Dictionary<Type, Action>()
|
||||||
{
|
{
|
||||||
@@ -535,38 +535,54 @@ namespace FoxTube
|
|||||||
} },
|
} },
|
||||||
{ typeof(ChannelPage), () =>
|
{ 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)
|
if((content.Content as ChannelPage).channelId == SecretsVault.UserChannel.Id)
|
||||||
nav.SelectedItem = toChannel;
|
{
|
||||||
|
if(nav.SelectedItem != toChannel)
|
||||||
|
nav.SelectedItem = toChannel;
|
||||||
|
else
|
||||||
|
s = Sender.None;
|
||||||
|
}
|
||||||
else
|
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
|
else
|
||||||
{
|
nav.SelectedItem = null;
|
||||||
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;
|
|
||||||
} },
|
} },
|
||||||
{ typeof(PlaylistPage), () =>
|
{ 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((content.Content as PlaylistPage).playlistId == SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes)
|
||||||
{
|
{
|
||||||
if(nav.SelectedItem != toLiked)
|
if(nav.SelectedItem != toLiked)
|
||||||
@@ -617,7 +633,7 @@ namespace FoxTube
|
|||||||
} }
|
} }
|
||||||
};
|
};
|
||||||
|
|
||||||
try { navCase[e.SourcePageType](); }
|
try { navCase[content.SourcePageType](); }
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
nav.SelectedItem = null;
|
nav.SelectedItem = null;
|
||||||
@@ -631,7 +647,7 @@ namespace FoxTube
|
|||||||
else
|
else
|
||||||
nav.IsBackEnabled = false;
|
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;
|
nav.ExpandedModeThresholdWidth = 1008;
|
||||||
if (nav.DisplayMode == NavigationViewDisplayMode.Expanded)
|
if (nav.DisplayMode == NavigationViewDisplayMode.Expanded)
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ namespace FoxTube.Pages
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
playlistId = id;
|
playlistId = id;
|
||||||
|
if (Methods.NeedToResponse)
|
||||||
|
Methods.MainPage.content_Navigated(this, null);
|
||||||
|
|
||||||
PlaylistsResource.ListRequest request = SecretsVault.Service.Playlists.List("snippet,contentDetails");
|
PlaylistsResource.ListRequest request = SecretsVault.Service.Playlists.List("snippet,contentDetails");
|
||||||
request.Id = id;
|
request.Id = id;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user