From a23774275f4c4518ecb639f93dae00b22bc31356 Mon Sep 17 00:00:00 2001 From: Michael Gordeev Date: Sun, 30 Sep 2018 20:36:05 +0300 Subject: [PATCH] #200: Fixed, Orientation support cut --- FoxTube/Controls/CommentCard.xaml | 2 +- FoxTube/Controls/CommentCard.xaml.cs | 8 +++++-- FoxTube/Controls/VideoPlayer.xaml.cs | 36 ---------------------------- 3 files changed, 7 insertions(+), 39 deletions(-) diff --git a/FoxTube/Controls/CommentCard.xaml b/FoxTube/Controls/CommentCard.xaml index 4881343..effe425 100644 --- a/FoxTube/Controls/CommentCard.xaml +++ b/FoxTube/Controls/CommentCard.xaml @@ -82,7 +82,7 @@ - + diff --git a/FoxTube/Controls/CommentCard.xaml.cs b/FoxTube/Controls/CommentCard.xaml.cs index c55af90..067a108 100644 --- a/FoxTube/Controls/CommentCard.xaml.cs +++ b/FoxTube/Controls/CommentCard.xaml.cs @@ -218,7 +218,7 @@ namespace FoxTube.Controls private void editorClose_Click(object sender, RoutedEventArgs e) { - ((grid.Children[0] as Grid).Children[1] as Grid).RowDefinitions[2].Height = GridLength.Auto; + ((grid.Children[0] as Grid).Children[1] as Grid).RowDefinitions[3].Height = GridLength.Auto; text.Visibility = Visibility.Visible; editor.Visibility = Visibility.Collapsed; } @@ -236,11 +236,15 @@ namespace FoxTube.Controls item.Snippet.UpdatedAt = DateTime.Now; if (type == CommentType.Reply) + { await SecretsVault.Service.Comments.Update(item, "snippet").ExecuteAsync(); + Initialize(item); + } else { thread.Snippet.TopLevelComment = item; await SecretsVault.Service.CommentThreads.Update(thread, "snippet").ExecuteAsync(); + Initialize(thread); } editorClose_Click(this, null); @@ -265,7 +269,7 @@ namespace FoxTube.Controls private void editBtn_Click(object sender, RoutedEventArgs e) { - ((grid.Children[0] as Grid).Children[1] as Grid).RowDefinitions[2].Height = new GridLength(0); + ((grid.Children[0] as Grid).Children[1] as Grid).RowDefinitions[3].Height = new GridLength(0); text.Visibility = Visibility.Collapsed; editorText.Text = text.Text; editor.Visibility = Visibility.Visible; diff --git a/FoxTube/Controls/VideoPlayer.xaml.cs b/FoxTube/Controls/VideoPlayer.xaml.cs index bd98229..b2d6adc 100644 --- a/FoxTube/Controls/VideoPlayer.xaml.cs +++ b/FoxTube/Controls/VideoPlayer.xaml.cs @@ -44,12 +44,9 @@ using Windows.System.Profile; namespace FoxTube { - public enum DeviceType { Other, Desktop, Mobile } - public sealed partial class VideoPlayer : UserControl { public string videoId; - private DeviceType deviceType = DeviceType.Other; private bool miniview = false; public bool MiniView @@ -107,21 +104,6 @@ namespace FoxTube if (!ApplicationView.GetForCurrentView().IsViewModeSupported(ApplicationViewMode.CompactOverlay)) miniViewBtn.Visibility = Visibility.Collapsed; - switch(AnalyticsInfo.VersionInfo.DeviceFamily) - { - case "Windows.Mobile": - deviceType = DeviceType.Mobile; - break; - - case "Windows.Desktop": - deviceType = DeviceType.Desktop; - break; - - default: - deviceType = DeviceType.Other; - break; - } - captions = grid.Children[2] as LiveCaptions; volume.Value = Convert.ToDouble(settings.Values["volume"]); @@ -136,18 +118,6 @@ namespace FoxTube audioSource.CurrentStateChanged += AudioSource_CurrentStateChanged; t.Elapsed += T_Elapsed; seekTimer.Elapsed += SeekTimer_Elapsed; - - if(SimpleOrientationSensor.GetDefault() != null && deviceType == DeviceType.Mobile) - { - if (SimpleOrientationSensor.GetDefault().GetCurrentOrientation() == SimpleOrientation.Rotated270DegreesCounterclockwise || SimpleOrientationSensor.GetDefault().GetCurrentOrientation() == SimpleOrientation.Rotated90DegreesCounterclockwise) - fullscreen_Click(this, null); - SimpleOrientationSensor.GetDefault().OrientationChanged += (s, arg) => - { - if (((SimpleOrientationSensor.GetDefault().GetCurrentOrientation() == SimpleOrientation.NotRotated || SimpleOrientationSensor.GetDefault().GetCurrentOrientation() == SimpleOrientation.Rotated180DegreesCounterclockwise) && fullScreen) || - ((SimpleOrientationSensor.GetDefault().GetCurrentOrientation() == SimpleOrientation.Rotated270DegreesCounterclockwise || SimpleOrientationSensor.GetDefault().GetCurrentOrientation() == SimpleOrientation.Rotated90DegreesCounterclockwise) && !fullScreen)) - fullscreen_Click(this, null); - }; - } } public async void Initialize(Video meta, string channelAvatar) @@ -497,18 +467,12 @@ namespace FoxTube ApplicationView.GetForCurrentView().TryEnterFullScreenMode(); fullscreen.Content = "\xE1D8"; Height = Methods.MainPage.Height; - - if (deviceType == DeviceType.Mobile) - DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape; } else { ApplicationView.GetForCurrentView().ExitFullScreenMode(); fullscreen.Content = "\xE1D9"; Height = double.NaN; - - if (deviceType == DeviceType.Mobile) - DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait; } }