diff --git a/True Love/App.xaml b/True Love/App.xaml index 6b230fd..64f24a1 100644 --- a/True Love/App.xaml +++ b/True Love/App.xaml @@ -8,6 +8,7 @@ + diff --git a/True Love/App.xaml.cs b/True Love/App.xaml.cs index 716c804..868d5d7 100644 --- a/True Love/App.xaml.cs +++ b/True Love/App.xaml.cs @@ -1,11 +1,11 @@ using Microsoft.QueryStringDotNET; using System; using TrueLove.Lib.Helpers; +using TrueLove.Lib.Models; using TrueLove.UWP.Pages; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; using Windows.ApplicationModel.Core; -using Windows.Storage; using Windows.UI; using Windows.UI.Notifications; using Windows.UI.ViewManagement; @@ -20,8 +20,6 @@ namespace TrueLove.UWP /// sealed partial class App : Application { - public static ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; - /// /// 初始化单一实例应用程序对象。这是执行的创作代码的第一行, /// 已执行,逻辑上等同于 main() 或 WinMain()。 @@ -71,11 +69,8 @@ protected override void OnLaunched(LaunchActivatedEventArgs e) // 确保当前窗口处于活动状态 Window.Current.Activate(); - if (localSettings.Values["SetLiveTiles"] == null) - { // 首次打开先过一边设置 - localSettings.Values["SetLiveTiles"] = true; - localSettings.Values["SetHideCommandBar"] = false; - localSettings.Values["SetPageBackgroundColor"] = true; + if (SettingsVariableConverter.localSettings.Values["SetLiveTiles"] == null) + { // 首次打开先过一边设置 var a = new SettingsPage(); a.AppFirstRun(); a = null; @@ -83,7 +78,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e) } if (!Generic.DeviceFamilyMatch(DeviceFamilyList.Mobile)) HideTitleBar(); - else HideStatusBar(); + else HideStatusBarAsync(); } } @@ -98,10 +93,10 @@ protected override async void OnActivated(IActivatedEventArgs e) case "Settings": var settings = new Uri("ms-settings:network-status"); var success = await Windows.System.Launcher.LaunchUriAsync(settings); - localSettings.Values["IsToastPush"] = true; - break; + goto case "Close"; + case "Close": - localSettings.Values["IsToastPush"] = true; + GenericVariableConverter.isNetworkToastPush = true; break; } } @@ -145,12 +140,35 @@ private void HideTitleBar() /// /// 沉淀状态栏 for Phone /// - private void HideStatusBar() + private async void HideStatusBarAsync() { var applicationView = ApplicationView.GetForCurrentView(); applicationView.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow); + //applicationView.TryEnterFullScreenMode(); + var statusbar = StatusBar.GetForCurrentView(); - statusbar.BackgroundColor = Colors.Transparent; + await statusbar.ShowAsync(); + //await statusbar.ProgressIndicator.HideAsync(); + + ApplicationView.GetForCurrentView().VisibleBoundsChanged += (s, e) => + { + var currentHeight = s.VisibleBounds.Height; + + switch (applicationView.Orientation) + { // 横向 + case ApplicationViewOrientation.Landscape: + MainPage.Current.LayoutRoot.Margin = new Thickness(0); + + break; + + // 纵向 + case ApplicationViewOrientation.Portrait: + if (currentHeight < GenericVariableConverter.oldHeight) MainPage.Current.LayoutRoot.Margin = new Thickness(0, 0, 0, 50); + else if (currentHeight > GenericVariableConverter.oldHeight) MainPage.Current.LayoutRoot.Margin = new Thickness(0); + break; + } + GenericVariableConverter.oldHeight = s.VisibleBounds.Height; + }; } } } diff --git a/True Love/Pages/DeviceFamily-Mobile/HomePage.xaml b/True Love/Pages/DeviceFamily-Mobile/HomePage.xaml index eb0ea92..77aad22 100644 --- a/True Love/Pages/DeviceFamily-Mobile/HomePage.xaml +++ b/True Love/Pages/DeviceFamily-Mobile/HomePage.xaml @@ -171,7 +171,8 @@ - + diff --git a/True Love/Pages/DeviceFamily-Mobile/MainPage.xaml b/True Love/Pages/DeviceFamily-Mobile/MainPage.xaml new file mode 100644 index 0000000..a1fae6a --- /dev/null +++ b/True Love/Pages/DeviceFamily-Mobile/MainPage.xaml @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/True Love/Pages/DeviceFamily-Mobile/SettingsPage.xaml b/True Love/Pages/DeviceFamily-Mobile/SettingsPage.xaml new file mode 100644 index 0000000..8878a5a --- /dev/null +++ b/True Love/Pages/DeviceFamily-Mobile/SettingsPage.xaml @@ -0,0 +1,261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Settings + + + + + + + + + + + + + + + + + + + + + + + + Hot Keys + + + + Refresh + F5 + Back To Top + F6 + Back + ESC or Win + Backspace + Fullscreen + Shift + Win + Enter + + + + + + + + + Why don't upload at Microsoft Store? + Sorry, Ain't Developer ID right now. + + + 为什么不能购买 Tim 的商品以及发表评论? + Google + + + + + + + + What's New + + + + 🔧 解决物理内存使用翻倍问题 + 🔧 解决界面处于宽屏下右滑滑出空白汉堡菜单问题 + 🔧 解决工具栏走位问题 + 🔧 解决打开应用围绕一圈白线问题 + 🔧 删除不能正确工作的快捷键 + + + + + + + + + + + + About This App + TRUE LOVE + + + + 2021 © ProJend + Tim Bergling Foundation + + + + + + + + Links + ProJend + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/True Love/Pages/HomePage.xaml b/True Love/Pages/HomePage.xaml index c84c965..30b0896 100644 --- a/True Love/Pages/HomePage.xaml +++ b/True Love/Pages/HomePage.xaml @@ -157,7 +157,8 @@ - + diff --git a/True Love/Pages/ImagesPage.xaml b/True Love/Pages/ImagesPage.xaml index 4da3a20..922e03b 100644 --- a/True Love/Pages/ImagesPage.xaml +++ b/True Love/Pages/ImagesPage.xaml @@ -12,7 +12,7 @@ I M A G E S - + diff --git a/True Love/Pages/MainPage.xaml b/True Love/Pages/MainPage.xaml index 8ff1f25..3cd28fa 100644 --- a/True Love/Pages/MainPage.xaml +++ b/True Love/Pages/MainPage.xaml @@ -3,8 +3,8 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:Windows10version1709="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 5)" - xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)" + xmlns:upOS1709="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 5)" + xmlns:upOS1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:muxc="using:Microsoft.UI.Xaml.Controls" mc:Ignorable="d" x:Name="Main" RequestedTheme="Dark" @@ -34,40 +34,45 @@ - - + + - - + + - + - + - + - + - + - + - @@ -77,24 +82,24 @@ - + upOS1709:Style="{StaticResource AppBarButtonRevealStyle}"> + - + - + IsEnabled="{Binding ElementName=CommentPage,Path=IsSelected}" upOS1709:Style="{StaticResource AppBarButtonRevealStyle}"> + - + - + upOS1709:Style="{StaticResource AppBarButtonRevealStyle}"> + - + - + - - - - - - + + + + + + + + + + + + + + + - + - - - - - + + diff --git a/True Love/Pages/MainPage.xaml.cs b/True Love/Pages/MainPage.xaml.cs index 0883da3..dab054c 100644 --- a/True Love/Pages/MainPage.xaml.cs +++ b/True Love/Pages/MainPage.xaml.cs @@ -5,11 +5,11 @@ using System.Numerics; using System.Xml.Serialization; using TrueLove.Lib.Helpers; +using TrueLove.Lib.Models; using TrueLove.Lib.Models.Enum; using TrueLove.Lib.Notification.ContentDialog; using TrueLove.Lib.Notification.Toast; using Windows.Foundation.Metadata; -using Windows.Storage; using Windows.System; using Windows.UI; using Windows.UI.Core; @@ -42,7 +42,7 @@ private void Main_Loaded(object sender, RoutedEventArgs e) #region 兼容低版本号系统 if (Generic.DeviceFamilyMatch(DeviceFamilyList.Mobile)) // = WP { - if ((bool)localSettings.Values["SetPageBackgroundColor"]) BackgroundOfBar.Background = new SolidColorBrush(Colors.Black); + if (SettingsVariableConverter.setPageBackgroundColor) BackgroundOfBar.Background = new SolidColorBrush(Colors.Black); else BackgroundOfBar.Background = new SolidColorBrush((Color)Resources["SystemChromeMediumColor"]); CommandBar.Background = new SolidColorBrush { Color = Colors.Black, Opacity = 0.7 }; } @@ -105,7 +105,7 @@ private void NavView_Loaded(object sender, RoutedEventArgs e) /// private void The_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e) { // 判断滑动的距离 - if (e.Cumulative.Translation.X > 100 && bar.IsTapEnabled) NavView.IsPaneOpen = true; // 打开汉堡菜单 + if (e.Cumulative.Translation.X > 100 && BottonBar.IsTapEnabled) NavView.IsPaneOpen = true; // 打开汉堡菜单 if (e.Cumulative.Translation.X < -100) NavView.IsPaneOpen = false; // 关闭汉堡菜单 } @@ -272,8 +272,8 @@ private void Sv_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e) if (sv.VerticalOffset != scrlocation) { bool isWide; - if (!bar.IsTapEnabled) isWide = false; - else if ((bool)localSettings.Values["SetHideCommandBar"]) isWide = true; + if (!BottonBar.IsTapEnabled) isWide = false; + else if (SettingsVariableConverter.setHideBottonBar) isWide = true; else isWide = false; if (sv.VerticalOffset > scrlocation && isWide) { // 滚动条当前位置大于存储的变量值时代表往下滑,隐藏底部栏 @@ -319,9 +319,9 @@ private void Sv_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e) /// public void PageBackgroundChange() { - if (!(bool)localSettings.Values["SetPageBackgroundColor"]) Main.Background = new SolidColorBrush(Colors.Black); + if (!SettingsVariableConverter.setPageBackgroundColor) Main.Background = new SolidColorBrush(Colors.Black); else Main.Background = new SolidColorBrush((Color)Resources["SystemChromeMediumColor"]); - if (Generic.DeviceFamilyMatch(DeviceFamilyList.Mobile) && !(bool)localSettings.Values["SetPageBackgroundColor"]) + if (Generic.DeviceFamilyMatch(DeviceFamilyList.Mobile) && !SettingsVariableConverter.setPageBackgroundColor) BackgroundOfBar.Background = new SolidColorBrush(Colors.Black); else if (Generic.DeviceFamilyMatch(DeviceFamilyList.Mobile)) BackgroundOfBar.Background = new SolidColorBrush((Color)Resources["SystemChromeMediumColor"]); @@ -333,13 +333,12 @@ public void PageBackgroundChange() /// 需要重启应用 /// [XmlIgnore] - public string PageBackgroundColor => (bool)localSettings.Values["SetPageBackgroundColor"] ? "Black" : "#FF1F1F1F"; + public string PageBackgroundColor => SettingsVariableConverter.setPageBackgroundColor ? "Black" : "#FF1F1F1F"; // 滚动条位置变量 public double scrlocation = 0; // 导航栏当前显示状态(这个是为了减少不必要的开销,因为我做的是动画隐藏显示效果如果不用一个变量来记录当前导航栏状态的会重复执行隐藏或显示) bool IsShowBar = true; - public static ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; public double OpaqueIfEnabled(bool IsEnabled) => IsEnabled ? 1.0 : 0.6; public static MainPage Current; } diff --git a/True Love/Pages/SettingsPage.xaml b/True Love/Pages/SettingsPage.xaml index 82aa56b..90b5094 100644 --- a/True Love/Pages/SettingsPage.xaml +++ b/True Love/Pages/SettingsPage.xaml @@ -64,7 +64,7 @@ - + @@ -133,7 +133,7 @@ 2021 © ProJend Tim Bergling Foundation - We will comprehend Tim Bergling more and more and more... + - + diff --git a/True Love/True Love - UWP.csproj b/True Love/True Love - UWP.csproj index 50f6025..056e522 100644 --- a/True Love/True Love - UWP.csproj +++ b/True Love/True Love - UWP.csproj @@ -240,6 +240,14 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -256,6 +264,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -314,6 +326,10 @@ + + {32288edb-3f7f-479a-8303-7bb6705e0636} + BackgroundTask + {be71c6bf-09b2-48d7-9290-e97be9b8d622} True Love - Lib diff --git a/TrueLove.Lib/Models/CandidateInfo.cs b/TrueLove.Lib/Models/CandidateInfo.cs index a363443..f36f5a5 100644 --- a/TrueLove.Lib/Models/CandidateInfo.cs +++ b/TrueLove.Lib/Models/CandidateInfo.cs @@ -1,6 +1,6 @@ using TrueLove.Lib.Models.Enum; -namespace TrueLove.Lib.Notification.Models +namespace TrueLove.Lib.Models { public class CandidateInfo { diff --git a/TrueLove.Lib/Models/GenericVariableConverter.cs b/TrueLove.Lib/Models/GenericVariableConverter.cs new file mode 100644 index 0000000..cef857a --- /dev/null +++ b/TrueLove.Lib/Models/GenericVariableConverter.cs @@ -0,0 +1,9 @@ +namespace TrueLove.Lib.Models +{ + public class GenericVariableConverter + { + public static bool isNetworkToastPush; + + public static double oldHeight; + } +} diff --git a/TrueLove.Lib/Models/ProvisionalDatebase.cs b/TrueLove.Lib/Models/ProvisionalDatebase.cs index 552ae99..fa947f2 100644 --- a/TrueLove.Lib/Models/ProvisionalDatebase.cs +++ b/TrueLove.Lib/Models/ProvisionalDatebase.cs @@ -1,4 +1,4 @@ -namespace TrueLove.Lib.Notification.Models +namespace TrueLove.Lib.Models { class ProvisionalDatebase { diff --git a/TrueLove.Lib/Models/SettingsVariableConverter.cs b/TrueLove.Lib/Models/SettingsVariableConverter.cs new file mode 100644 index 0000000..52a88f4 --- /dev/null +++ b/TrueLove.Lib/Models/SettingsVariableConverter.cs @@ -0,0 +1,27 @@ +using Windows.Storage; + +namespace TrueLove.Lib.Models +{ + public class SettingsVariableConverter + { + public static bool setLiveTiles + { + get => (bool)localSettings.Values["SetLiveTiles"]; + set => localSettings.Values["SetLiveTiles"] = value; + } + + public static bool setHideBottonBar + { + get => (bool)localSettings.Values["SetHideBottonBar"]; + set => localSettings.Values["SetHideBottonBar"] = value; + } + + public static bool setPageBackgroundColor + { + get => (bool)localSettings.Values["SetPageBackgroundColor"]; + set => localSettings.Values["SetPageBackgroundColor"] = value; + } + + public static ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; + } +} diff --git a/TrueLove.Lib/Models/VariableConverter.cs b/TrueLove.Lib/Models/VariableConverter.cs deleted file mode 100644 index 1122a8f..0000000 --- a/TrueLove.Lib/Models/VariableConverter.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace TrueLove.Lib.Notification.Models -{ - public class VariableConverter - { - public static bool isNetworkToastPush; - } -} diff --git a/TrueLove.Lib/Notification/ContentDialog/DialogSetup.cs b/TrueLove.Lib/Notification/ContentDialog/DialogSetup.cs index 143333c..341dc18 100644 --- a/TrueLove.Lib/Notification/ContentDialog/DialogSetup.cs +++ b/TrueLove.Lib/Notification/ContentDialog/DialogSetup.cs @@ -39,11 +39,11 @@ public static async void SetupDialog(GetDialogInfo name) dialogCreate.CloseButtonText = "Okay"; dialogCreate.Content = new ReleaseNotes(); dialogCreate.Background = new SolidColorBrush(Colors.Black); - if (!Generic.DeviceFamilyMatch(DeviceFamilyList.Mobile)) - { - dialogCreate.CloseButtonStyle = (Style)Application.Current.Resources["ButtonRevealStyle"]; - dialogCreate.BorderBrush = (Brush)Application.Current.Resources["SystemControlBackgroundListMediumRevealBorderBrush"]; - } + //if (!Generic.DeviceFamilyMatch(DeviceFamilyList.Mobile)) + //{ + // dialogCreate.CloseButtonStyle = (Style)Application.Current.Resources["ButtonRevealStyle"]; + // dialogCreate.BorderBrush = (Brush)Application.Current.Resources["SystemControlBackgroundListMediumRevealBorderBrush"]; + //} break; diff --git a/TrueLove.Lib/Notification/ContentDialog/DialogTemplate/CommentCreate.xaml b/TrueLove.Lib/Notification/ContentDialog/DialogTemplate/CommentCreate.xaml index bcb5f6b..8d864e7 100644 --- a/TrueLove.Lib/Notification/ContentDialog/DialogTemplate/CommentCreate.xaml +++ b/TrueLove.Lib/Notification/ContentDialog/DialogTemplate/CommentCreate.xaml @@ -13,14 +13,16 @@ - + - + Your images must be .jpg, .gif, or .png and max 3MB diff --git a/TrueLove.Lib/Notification/ContentDialog/DialogTemplate/CommentCreate.xaml.cs b/TrueLove.Lib/Notification/ContentDialog/DialogTemplate/CommentCreate.xaml.cs index 43e21da..7e5ab5c 100644 --- a/TrueLove.Lib/Notification/ContentDialog/DialogTemplate/CommentCreate.xaml.cs +++ b/TrueLove.Lib/Notification/ContentDialog/DialogTemplate/CommentCreate.xaml.cs @@ -1,5 +1,5 @@ using System; -using TrueLove.Lib.Notification.Models; +using TrueLove.Lib.Models; using Windows.Storage.Pickers; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; diff --git a/TrueLove.Lib/Notification/Toast/ToastCreate.cs b/TrueLove.Lib/Notification/Toast/ToastCreate.cs deleted file mode 100644 index 86808dd..0000000 --- a/TrueLove.Lib/Notification/Toast/ToastCreate.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using Windows.UI.Notifications; - -namespace TrueLove.Notification.Toast -{ - public class ToastCreate - { - public static void AddToast() - { - var content = ToastTemplate.Network(); - - // Create the notification - var notif = new ToastNotification(content.GetXml()) - { - ExpirationTime = DateTime.Now.AddSeconds(10) - }; - - // And show it! - ToastNotificationManager.CreateToastNotifier().Show(notif); - } - } -} diff --git a/TrueLove.Lib/Notification/Toast/ToastSetup.cs b/TrueLove.Lib/Notification/Toast/ToastSetup.cs index e9560d2..21c69f1 100644 --- a/TrueLove.Lib/Notification/Toast/ToastSetup.cs +++ b/TrueLove.Lib/Notification/Toast/ToastSetup.cs @@ -1,5 +1,5 @@ using System; -using TrueLove.Lib.Notification.Models; +using TrueLove.Lib.Models; using Windows.UI.Notifications; namespace TrueLove.Lib.Notification.Toast @@ -8,7 +8,7 @@ public class ToastSetup { public static void SetupToast() { - if (!VariableConverter.isNetworkToastPush) + if (!GenericVariableConverter.isNetworkToastPush) { var content = ToastTemplate.Network(); diff --git a/TrueLove.Lib/True Love - Lib.csproj b/TrueLove.Lib/True Love - Lib.csproj index bef359e..538a89b 100644 --- a/TrueLove.Lib/True Love - Lib.csproj +++ b/TrueLove.Lib/True Love - Lib.csproj @@ -123,6 +123,7 @@ + CommentCreate.xaml @@ -134,7 +135,7 @@ - +