diff --git a/TrueLove.Lib/Models/UI/LocalSettings.cs b/TrueLove.Lib/Models/UI/LocalSettings.cs index 2d5298e..6fda561 100644 --- a/TrueLove.Lib/Models/UI/LocalSettings.cs +++ b/TrueLove.Lib/Models/UI/LocalSettings.cs @@ -15,6 +15,11 @@ public static bool isBottomBarHidden get => (bool)localSettings.Values["isBottomBarHidden"]; set => localSettings.Values["isBottomBarHidden"] = value; } + public static bool isMidnightTheme + { + get => (bool)localSettings.Values["isMidnightTheme"]; + set => localSettings.Values["isMidnightTheme"] = value; + } public static ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; } diff --git a/TrueLove.UWP/App.xaml.cs b/TrueLove.UWP/App.xaml.cs index 3154e9f..0273e3d 100644 --- a/TrueLove.UWP/App.xaml.cs +++ b/TrueLove.UWP/App.xaml.cs @@ -8,6 +8,7 @@ using Windows.ApplicationModel.Activation; using Windows.ApplicationModel.Core; using Windows.UI; +using Windows.UI.Core; using Windows.UI.ViewManagement; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; @@ -74,10 +75,10 @@ protected override void OnLaunched(LaunchActivatedEventArgs e) a = null; } - if (Generic.DeviceFamilyMatch(DeviceFamilyType.Mobile)) - HideStatusBar(); - else + if (Generic.DeviceFamilyMatch(DeviceFamilyType.Desktop)) HideTitleBar(); + //else + // HideStatusBar(); } } @@ -148,7 +149,12 @@ private void HideStatusBar() { var applicationView = ApplicationView.GetForCurrentView(); applicationView.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow); - applicationView.VisibleBoundsChanged += MainPage.Current.VisibleBounds_Changed; + var s = StatusBar.GetForCurrentView(); + + applicationView.VisibleBoundsChanged += (e,o) => + { + + }; } } } diff --git a/TrueLove.UWP/Package.appxmanifest b/TrueLove.UWP/Package.appxmanifest index c860327..7462134 100644 --- a/TrueLove.UWP/Package.appxmanifest +++ b/TrueLove.UWP/Package.appxmanifest @@ -1,6 +1,6 @@  - + True Love - Tim Bergling Foundtion diff --git a/TrueLove.UWP/Template/Button.xaml b/TrueLove.UWP/Template/Button.xaml index 78ec400..92701c6 100644 --- a/TrueLove.UWP/Template/Button.xaml +++ b/TrueLove.UWP/Template/Button.xaml @@ -326,8 +326,8 @@ diff --git a/TrueLove.UWP/Template/Colors.xaml b/TrueLove.UWP/Template/Colors.xaml index d1e30f9..66fb24a 100644 --- a/TrueLove.UWP/Template/Colors.xaml +++ b/TrueLove.UWP/Template/Colors.xaml @@ -1,8 +1,7 @@  + xmlns:muxm="using:Microsoft.UI.Xaml.Media"> Black @@ -15,23 +14,11 @@ #18797B #136263 - - - + FallbackColor="#FF1F1F1F"/> #1AEBFF - - - + + + diff --git a/TrueLove.UWP/Template/Navigation.xaml b/TrueLove.UWP/Template/Navigation.xaml index a14b057..c774b4e 100644 --- a/TrueLove.UWP/Template/Navigation.xaml +++ b/TrueLove.UWP/Template/Navigation.xaml @@ -1,7 +1,6 @@  @@ -86,9 +85,6 @@ - - - diff --git a/TrueLove.UWP/Views/DeviceFamily-Mobile/HomePage.xaml b/TrueLove.UWP/Views/DeviceFamily-Mobile/HomePage.xaml index 1e21371..d4a45bc 100644 --- a/TrueLove.UWP/Views/DeviceFamily-Mobile/HomePage.xaml +++ b/TrueLove.UWP/Views/DeviceFamily-Mobile/HomePage.xaml @@ -42,97 +42,102 @@ - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - + + + + - - - + + + - - - - - - - - - + + + + + + + + + - - - - + + + + Tim created music that brought people together with timeless memories from all over the world. We created this space so you could share your memories with all of us and let the world know what Avicii meant to you. His music and your memories are forever. - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + @@ -171,5 +176,5 @@ - + \ No newline at end of file diff --git a/TrueLove.UWP/Views/HomePage.xaml b/TrueLove.UWP/Views/HomePage.xaml index 1303c92..fdb62a5 100644 --- a/TrueLove.UWP/Views/HomePage.xaml +++ b/TrueLove.UWP/Views/HomePage.xaml @@ -23,7 +23,7 @@ - + @@ -42,97 +42,102 @@ - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - + + + + - - - + + + - - - - - - - - - + + + + + + + + + - - - - + + + + Tim created music that brought people together with timeless memories from all over the world. We created this space so you could share your memories with all of us and let the world know what Avicii meant to you. His music and your memories are forever. - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + @@ -171,5 +176,6 @@ - + + \ No newline at end of file diff --git a/TrueLove.UWP/Views/MainPage.xaml b/TrueLove.UWP/Views/MainPage.xaml index dac3fbf..e0d49ee 100644 --- a/TrueLove.UWP/Views/MainPage.xaml +++ b/TrueLove.UWP/Views/MainPage.xaml @@ -10,14 +10,11 @@ mc:Ignorable="d" x:Name="Main" RequestedTheme="Dark" Background="{ThemeResource PageBackgroundColor}" Loaded="Main_Loaded"> - + - - - + VerticalScrollMode="Auto"> @@ -43,7 +40,7 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -211,6 +175,9 @@ + + + diff --git a/TrueLove.UWP/Views/MainPage.xaml.cs b/TrueLove.UWP/Views/MainPage.xaml.cs index a32474a..7ce23c3 100644 --- a/TrueLove.UWP/Views/MainPage.xaml.cs +++ b/TrueLove.UWP/Views/MainPage.xaml.cs @@ -9,7 +9,7 @@ using Windows.System; using Windows.UI; using Windows.UI.Core; -using Windows.UI.ViewManagement; +using Windows.UI.Popups; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Input; @@ -45,12 +45,7 @@ private void Main_Loaded(object sender, RoutedEventArgs e) if (Generic.DeviceFamilyMatch(DeviceFamilyType.Mobile)) // = WP { TopBar.Background = new SolidColorBrush(Colors.Black); - ToolBar.Background = new SolidColorBrush { Color = Colors.Black, Opacity = 0.7 }; - - // 调整界面,默认抬高底部工具栏以免重叠 - var applicationView = ApplicationView.GetForCurrentView(); - applicationView.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow); - VisualStateManager.GoToState(this, WPNavBarVisible.Name, true); + ToolBar.Background = new SolidColorBrush { Color = Colors.Black, Opacity = 0.7 }; } else if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5)) // > OS15063 { @@ -226,19 +221,12 @@ private void Sv_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e) if (sv.VerticalOffset < scrlocation) canSlideDown = false; - if (canSlideDown && isShowBar) - { // 通过动画来隐藏 - // bar.Translation = new Vector3(0, 40, 0); + if (canSlideDown && canHideBottomBar) // 通过动画来隐藏 BottomBar_Storyboard_SlideDown.Begin(); - isShowBar = false; - - } - else if (!canSlideDown && !isShowBar) - { // 通过动画来显示 - // bar.Translation = new Vector3(0, 0, 0); + else if (!canSlideDown && !canHideBottomBar) // 通过动画来显示 BottomBar_Storyboard_SlideUp.Begin(); - isShowBar = true; - } + + canHideBottomBar = !canSlideDown; scrlocation = sv.VerticalOffset; } } @@ -247,7 +235,7 @@ private void Sv_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e) double scrlocation = 0; // 导航栏当前显示状态(这个是为了减少不必要的开销,因为我做的是动画隐藏显示效果如果不用一个变量来记录当前导航栏状态的会重复执行隐藏或显示) - bool isShowBar = true; + bool canHideBottomBar = true; /// /// 宽屏时锁死工具栏位置 @@ -268,8 +256,24 @@ private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e) /// /// 刷新按钮。 /// - private void Refresh_Click(object sender, RoutedEventArgs e) + private async void Refresh_Click(object sender, RoutedEventArgs e) { + var messageDialog = new MessageDialog("No internet connection has been found."); + + // Add commands and set their callbacks; both buttons use the same callback function instead of inline event handlers + messageDialog.Commands.Add(new UICommand( + "Try again")); + messageDialog.Commands.Add(new UICommand( + "Close")); + + // Set the command that will be invoked by default + messageDialog.DefaultCommandIndex = 0; + + // Set the command to be invoked when escape is pressed + messageDialog.CancelCommandIndex = 1; + + // Show the message dialog + await messageDialog.ShowAsync(); } /// @@ -281,33 +285,6 @@ private void Refresh_Click(object sender, RoutedEventArgs e) private void OnWindowActivated(object sender, WindowActivatedEventArgs e) => VisualStateManager.GoToState(this, e.WindowActivationState == CoreWindowActivationState.Deactivated ? WindowNotFocused.Name : WindowFocused.Name, false); - public void VisibleBounds_Changed(ApplicationView e, object sender) - { - var applicationView = ApplicationView.GetForCurrentView(); - - var currentHeight = e.VisibleBounds.Height; - - switch (applicationView.Orientation) - { // 横向 - case ApplicationViewOrientation.Landscape: - // 控制 bar 宽度 - if (Window.Current.Bounds.Width < 641) - VisualStateManager.GoToState(this, MinLandscape.Name, true); - else VisualStateManager.GoToState(this, MediumLandscape.Name, true); - break; - - // 纵向 - case ApplicationViewOrientation.Portrait: - // 控制底部导航栏高度 - if (currentHeight < oldHeight) - VisualStateManager.GoToState(this, WPNavBarVisible.Name, true); - else VisualStateManager.GoToState(this, WPNavBarCollapsed.Name, true); - break; - } - oldHeight = e.VisibleBounds.Height; - } - double oldHeight; - double OpaqueIfEnabled(bool isEnabled) => isEnabled ? 1.0 : 0.7; #endregion diff --git a/TrueLove.UWP/Views/SettingsPage.xaml b/TrueLove.UWP/Views/SettingsPage.xaml index bb7b203..a474d20 100644 --- a/TrueLove.UWP/Views/SettingsPage.xaml +++ b/TrueLove.UWP/Views/SettingsPage.xaml @@ -44,7 +44,7 @@ Settings - + @@ -62,6 +62,7 @@ + @@ -72,12 +73,12 @@ Hot Keys - Refresh - F5 + Back to Top F6 - Create Comment - F6 + Back ESC or Win + Backspace Fullscreen diff --git a/TrueLove.UWP/Views/SettingsPage.xaml.cs b/TrueLove.UWP/Views/SettingsPage.xaml.cs index 2ddac67..be4d482 100644 --- a/TrueLove.UWP/Views/SettingsPage.xaml.cs +++ b/TrueLove.UWP/Views/SettingsPage.xaml.cs @@ -50,6 +50,9 @@ private async void ToggleSwitch_Toggled(object sender, RoutedEventArgs e) case "hideToolBarSwitch": LocalSettings.isBottomBarHidden = HideToolBarSwitch.IsOn; break; + //case "midnightThemeSwitch": + // LocalSettings.isMidnightTheme = MidnightThemeSwitch.IsOn; + // break; } } @@ -106,6 +109,7 @@ public void AppFirstRun() { EnableLiveTileSwitch.IsOn = LocalSettings.isLiveTiles = true; HideToolBarSwitch.IsOn = LocalSettings.isBottomBarHidden = false; + //MidnightThemeSwitch.IsOn = LocalSettings.isMidnightTheme = true; } string versionInfo