Archived
1
0

Menu opening fixed

Related Work Items: #228
This commit is contained in:
Michael Gordeev
2018-12-23 14:08:13 +03:00
parent 18a4cdafaa
commit e71761c38f
3 changed files with 25 additions and 21 deletions
+1 -1
View File
@@ -38,7 +38,7 @@
<Hyperlink Click="Hyperlink_Click">Log in</Hyperlink> to manage your subscriptions <Hyperlink Click="Hyperlink_Click">Log in</Hyperlink> to manage your subscriptions
</TextBlock> </TextBlock>
<Grid Visibility="Visible" Grid.Column="2" VerticalAlignment="Bottom" Margin="10" Name="subscriptionPane" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Grid Visibility="Collapsed" Grid.Column="2" VerticalAlignment="Bottom" Margin="10" Name="subscriptionPane" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Button Click="subscribe_Click" Name="subscribe" Width="250" Height="50" Background="Red" Foreground="White" FontSize="18" FontWeight="SemiBold" Content="Subscirbe"/> <Button Click="subscribe_Click" Name="subscribe" Width="250" Height="50" Background="Red" Foreground="White" FontSize="18" FontWeight="SemiBold" Content="Subscirbe"/>
</Grid> </Grid>
</Grid> </Grid>
+6 -13
View File
@@ -54,7 +54,7 @@ namespace FoxTube.Pages
public ChannelPage() public ChannelPage()
{ {
this.InitializeComponent(); InitializeComponent();
loading = grid.Children[2] as LoadingPage; loading = grid.Children[2] as LoadingPage;
playlistLoading = playlists.Children[1] as LoadingPage; playlistLoading = playlists.Children[1] as LoadingPage;
@@ -83,7 +83,7 @@ namespace FoxTube.Pages
loading.Refresh(); loading.Refresh();
playlistLoading.Refresh(); playlistLoading.Refresh();
try //try
{ {
channelId = id; channelId = id;
if (Methods.NeedToResponse) if (Methods.NeedToResponse)
@@ -136,32 +136,25 @@ namespace FoxTube.Pages
if (SecretsVault.IsAuthorized) if (SecretsVault.IsAuthorized)
{ {
bool b = false; if (SecretsVault.Subscriptions.Any(i => i.Snippet.ResourceId.ChannelId == channelId))
foreach (Subscription s in SecretsVault.Subscriptions)
{ {
if (s.Snippet.ResourceId.ChannelId == item.Id)
{
Debug.WriteLine($"{s.Snippet.ResourceId.ChannelId} ({item.Snippet.Title}: {item.Id})");
subscribe.Background = new SolidColorBrush(Colors.Transparent); subscribe.Background = new SolidColorBrush(Colors.Transparent);
subscribe.Foreground = new SolidColorBrush(Colors.Gray); subscribe.Foreground = new SolidColorBrush(Colors.Gray);
subscribe.Content = "Subscribed"; subscribe.Content = "Subscribed";
b = true;
break;
}
} }
subscriptionPane.Visibility = Visibility.Visible; subscriptionPane.Visibility = Visibility.Visible;
} }
loading.Close(); loading.Close();
} }
catch (System.Net.Http.HttpRequestException) /*catch (System.Net.Http.HttpRequestException)
{ {
loading.Error("System.Net.Http.HttpRequestException", "Unable to connect to Google servers.", true); loading.Error("System.Net.Http.HttpRequestException", "Unable to connect to Google servers.", true);
} }
catch (Exception e) catch (Exception e)
{ {
loading.Error(e.GetType().ToString(), e.Message); loading.Error(e.GetType().ToString(), e.Message);
} }*/
} }
async void LoadPlaylist() async void LoadPlaylist()
@@ -290,7 +283,7 @@ namespace FoxTube.Pages
private void refresh_Click(object sender, RoutedEventArgs e) private void refresh_Click(object sender, RoutedEventArgs e)
{ {
Initialize(channelId); Methods.MainPage.GoToChannel(channelId);
} }
private async void inBrowser_Click(object sender, RoutedEventArgs e) private async void inBrowser_Click(object sender, RoutedEventArgs e)
+15 -4
View File
@@ -335,11 +335,10 @@ namespace FoxTube
return; return;
videoPlaceholder.Content = null; videoPlaceholder.Content = null;
MaximizeVideo();
Fullscreen(false); Fullscreen(false);
videoPlaceholder.Navigate(typeof(VideoPage), new string[2] { id, playlistId }); videoPlaceholder.Navigate(typeof(VideoPage), new string[2] { id, playlistId });
nav.Header = "Video"; MaximizeVideo();
} }
public void GoToDeveloper(string id) public void GoToDeveloper(string id)
@@ -402,6 +401,15 @@ namespace FoxTube
{ typeof(Downloads), () => nav.Header = "Downloads" } { typeof(Downloads), () => nav.Header = "Downloads" }
}; };
if (content.SourcePageType == typeof(Home) || content.SourcePageType == typeof(Settings) || content.SourcePageType == typeof(Subscriptions))
{
nav.ExpandedModeThresholdWidth = 1008;
if (nav.DisplayMode == NavigationViewDisplayMode.Expanded)
nav.IsPaneOpen = true;
}
else
nav.ExpandedModeThresholdWidth = short.MaxValue;
try { switchCase[content.SourcePageType](); } try { switchCase[content.SourcePageType](); }
catch { } catch { }
} }
@@ -417,7 +425,11 @@ namespace FoxTube
nav.IsBackEnabled = true; nav.IsBackEnabled = true;
if (videoPlaceholder.Content != null) if (videoPlaceholder.Content != null)
{
nav.Header = "Video"; nav.Header = "Video";
nav.ExpandedModeThresholdWidth = short.MaxValue;
nav.IsPaneOpen = false;
}
} }
public void Fullscreen(bool on) public void Fullscreen(bool on)
@@ -531,7 +543,6 @@ namespace FoxTube
public void content_Navigated(object sender, NavigationEventArgs e) public void content_Navigated(object sender, NavigationEventArgs e)
{ {
Debug.WriteLine($"Navigated to {e.SourcePageType}");
Dictionary<Type, Action> switchCase = new Dictionary<Type, Action>() Dictionary<Type, Action> switchCase = new Dictionary<Type, Action>()
{ {
{ typeof(Settings), () => nav.Header = "Settings" }, { typeof(Settings), () => nav.Header = "Settings" },
@@ -682,7 +693,7 @@ namespace FoxTube
nav.IsPaneOpen = true; nav.IsPaneOpen = true;
} }
else else
nav.ExpandedModeThresholdWidth = int.MaxValue; nav.ExpandedModeThresholdWidth = short.MaxValue;
if (videoPlaceholder.Content != null && videoPlaceholder.HorizontalAlignment == HorizontalAlignment.Stretch) if (videoPlaceholder.Content != null && videoPlaceholder.HorizontalAlignment == HorizontalAlignment.Stretch)
MinimizeAsInitializer(); MinimizeAsInitializer();