Archived
1
0

Stardet miniview implementation

This commit is contained in:
Michael Gordeev
2018-06-12 12:23:31 +03:00
parent 3ae4a5953b
commit 4a77a9f0d5
2 changed files with 27 additions and 2 deletions
+1 -1
View File
@@ -42,7 +42,7 @@
<TextBlock Name="title" Grid.Column="1" Text="This is Video title" Foreground="White" VerticalAlignment="Center" TextWrapping="WrapWholeWords" FontSize="20" Margin="10,0,0,0" MaxLines="1" ToolTipService.ToolTip="Title"/> <TextBlock Name="title" Grid.Column="1" Text="This is Video title" Foreground="White" VerticalAlignment="Center" TextWrapping="WrapWholeWords" FontSize="20" Margin="10,0,0,0" MaxLines="1" ToolTipService.ToolTip="Title"/>
<StackPanel Orientation="Horizontal" Grid.Column="2"> <StackPanel Orientation="Horizontal" Grid.Column="2">
<Button Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="&#xEC15;" Foreground="White" Width="50" Height="50" FontSize="25" ToolTipService.ToolTip="Cast to device"/> <Button Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="&#xEC15;" Foreground="White" Width="50" Height="50" FontSize="25" ToolTipService.ToolTip="Cast to device"/>
<Button Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="&#xE2B3;" Foreground="White" Width="50" Height="50" FontSize="25" ToolTipService.ToolTip="Picture-in-picture mode"/> <Button Name="miniView" Click="miniView_Click" Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="&#xE2B3;" Foreground="White" Width="50" Height="50" FontSize="25" ToolTipService.ToolTip="Picture-in-picture mode"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Grid> </Grid>
+26 -1
View File
@@ -25,6 +25,7 @@ using Windows.Networking.Connectivity;
using System.Diagnostics; using System.Diagnostics;
using Windows.Media; using Windows.Media;
using Windows.Storage.Streams; using Windows.Storage.Streams;
using Windows.UI.ViewManagement;
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
@@ -34,6 +35,9 @@ namespace FoxTube
{ {
public string videoId; public string videoId;
private bool miniViewed = false;
private bool fullScreen = false;
YouTubeQuality videoQuality; YouTubeQuality videoQuality;
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings; ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
@@ -237,9 +241,17 @@ namespace FoxTube
} }
private void fullscreen_Click(object sender, RoutedEventArgs e) private async void fullscreen_Click(object sender, RoutedEventArgs e)
{ {
if (miniViewed)
miniViewed = await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.Default);
if (fullScreen)
{
ApplicationView.GetForCurrentView().ExitFullScreenMode();
fullScreen = false;
}
else fullScreen = ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
} }
private void play_Click(object sender, RoutedEventArgs e) private void play_Click(object sender, RoutedEventArgs e)
@@ -280,5 +292,18 @@ namespace FoxTube
{ {
meteredNotification.Visibility = Visibility.Collapsed; meteredNotification.Visibility = Visibility.Collapsed;
} }
private async void miniView_Click(object sender, RoutedEventArgs e)
{
if(fullScreen)
{
ApplicationView.GetForCurrentView().ExitFullScreenMode();
fullScreen = false;
}
if (!miniViewed)
miniViewed = await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.CompactOverlay);
else miniViewed = await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.Default);
}
} }
} }