diff --git a/dev/App.xaml.cs b/dev/App.xaml.cs index 9669bc7..d038895 100644 --- a/dev/App.xaml.cs +++ b/dev/App.xaml.cs @@ -10,7 +10,7 @@ public partial class App : Application public static Window currentWindow = Window.Current; public IServiceProvider Services { get; } public new static App Current => (App)Application.Current; - public string AppVersion { get; set; } = VersionHelper.GetVersion(); + public string AppVersion { get; set; } = ApplicationHelper.GetAppVersion(); public string AppName { get; set; } = "TvTime"; public static T GetService() where T : class @@ -88,8 +88,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs args) currentWindow.Activate(); - AppCenter.Start(Constants.AppCenterKey, - typeof(Analytics), typeof(Crashes)); + AppCenter.Start(Constants.AppCenterKey, typeof(Analytics), typeof(Crashes)); if (Settings.UseDeveloperMode) { diff --git a/dev/Tools/Common/Constants.cs b/dev/Tools/Common/Constants.cs index b306e5a..ef34d3b 100644 --- a/dev/Tools/Common/Constants.cs +++ b/dev/Tools/Common/Constants.cs @@ -1,9 +1,10 @@ namespace TvTime.Common; -public class Constants +public static class Constants { - public static readonly string AppName = ApplicationHelper.GetProjectNameAndVersion(); - public static readonly string RootDirectoryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), AppName); - + public static readonly string AppName = ApplicationHelper.GetAppNameAndVersion().NameAndVersion; + public static readonly string RootDirectoryPath = Path.Combine(ApplicationHelper.GetLocalFolderPath(), AppName); + public static readonly string LogDirectoryPath = Path.Combine(RootDirectoryPath, "Log"); + public static readonly string LogFilePath = Path.Combine(LogDirectoryPath, "Log.txt"); public static readonly string AppConfigPath = Path.Combine(RootDirectoryPath, "AppConfig.json"); public const string FileNameRegex = @"(?:hd(?:tv|cam|r)|-|/720p/|/480p/|/1080p/|- -|- -|/|EmpireBestTv|AceMovies|AvaMovie|@Parsi_Ser|mp4|mkv|@Gemovies|GM|AvaMovie|FB|M3|\.)"; diff --git a/dev/Tools/Common/LoggerSetup.cs b/dev/Tools/Common/LoggerSetup.cs index c09b0bb..4d525ac 100644 --- a/dev/Tools/Common/LoggerSetup.cs +++ b/dev/Tools/Common/LoggerSetup.cs @@ -7,17 +7,14 @@ public static class LoggerSetup public static void ConfigureLogger() { - var desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); - var logFileDirPath = Path.Combine(desktopPath, Constants.AppName); - var logFilePath = Path.Combine(logFileDirPath, "Log.txt"); - if (!Directory.Exists(logFileDirPath)) + if (!Directory.Exists(Constants.LogDirectoryPath)) { - Directory.CreateDirectory(logFileDirPath); + Directory.CreateDirectory(Constants.LogDirectoryPath); } Logger = new LoggerConfiguration() .Enrich.WithProperty("Version", App.Current.AppVersion) - .WriteTo.File(logFilePath, rollingInterval: RollingInterval.Day) + .WriteTo.File(Constants.LogFilePath, rollingInterval: RollingInterval.Day) .WriteTo.Debug() .CreateLogger(); } diff --git a/dev/TvTime.csproj b/dev/TvTime.csproj index 510dac1..fb4b633 100644 --- a/dev/TvTime.csproj +++ b/dev/TvTime.csproj @@ -10,7 +10,7 @@ win10-$(Platform).pubxml true true - 4.4.0 + 4.5.0 true Latest False @@ -24,22 +24,22 @@ - + - - - + + + - - + + - - + + diff --git a/dev/ViewModels/Media/MediaViewModel.cs b/dev/ViewModels/Media/MediaViewModel.cs index 2dc74f6..2ab3632 100644 --- a/dev/ViewModels/Media/MediaViewModel.cs +++ b/dev/ViewModels/Media/MediaViewModel.cs @@ -1,8 +1,6 @@ using CommunityToolkit.Labs.WinUI; using CommunityToolkit.WinUI.UI; - using HtmlAgilityPack; - using Microsoft.EntityFrameworkCore; using Microsoft.UI.Dispatching; using Microsoft.UI.Xaml.Media.Animation; diff --git a/dev/Views/HomeLandingPage.xaml b/dev/Views/HomeLandingPage.xaml index 2bea659..4e7683b 100644 --- a/dev/Views/HomeLandingPage.xaml +++ b/dev/Views/HomeLandingPage.xaml @@ -26,6 +26,7 @@ HeaderText="{x:Bind AppInfo}"> + @@ -33,4 +34,3 @@ - diff --git a/dev/Views/HomeLandingPage.xaml.cs b/dev/Views/HomeLandingPage.xaml.cs index 92fb4ea..8c71265 100644 --- a/dev/Views/HomeLandingPage.xaml.cs +++ b/dev/Views/HomeLandingPage.xaml.cs @@ -4,11 +4,14 @@ public sealed partial class HomeLandingPage : Page { public string AppInfo { get; set; } public HomeLandingViewModel ViewModel { get; } + public static HomeLandingPage Instance { get; set; } public HomeLandingPage() { ViewModel = App.GetService(); this.InitializeComponent(); + Instance = this; AppInfo = $"{App.Current.AppName} v{App.Current.AppVersion}"; + UpdateHomeLandingPageCornerRadius(); } protected override void OnNavigatedTo(NavigationEventArgs e) @@ -17,5 +20,23 @@ protected override void OnNavigatedTo(NavigationEventArgs e) allLandingPage.GetData(ViewModel.JsonNavigationViewService.DataSource); allLandingPage.OrderBy(i => i.Title); } + + public void UpdateHomeLandingPageCornerRadius() + { + switch (Settings.NavigationViewPaneDisplayMode) + { + case NavigationViewPaneDisplayMode.Auto: + case NavigationViewPaneDisplayMode.Left: + allLandingPage.HeaderGridCornerRadius = new CornerRadius(8, 0, 0, 0); + break; + case NavigationViewPaneDisplayMode.Top: + case NavigationViewPaneDisplayMode.LeftCompact: + allLandingPage.HeaderGridCornerRadius = new CornerRadius(0); + break; + + case NavigationViewPaneDisplayMode.LeftMinimal: + break; + } + } } diff --git a/dev/Views/MainPage.xaml b/dev/Views/MainPage.xaml index e08ae32..1d198ac 100644 --- a/dev/Views/MainPage.xaml +++ b/dev/Views/MainPage.xaml @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:TvTime" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:settings="using:TvTime.Common" xmlns:wuc="using:WinUICommunity" mc:Ignorable="d"> @@ -59,8 +60,10 @@ + IsPaneToggleButtonVisible="False" + PaneDisplayMode="{x:Bind settings:AppHelper.Settings.NavigationViewPaneDisplayMode, Mode=OneWay}"> diff --git a/dev/Views/MainPage.xaml.cs b/dev/Views/MainPage.xaml.cs index d168dcc..0be2e51 100644 --- a/dev/Views/MainPage.xaml.cs +++ b/dev/Views/MainPage.xaml.cs @@ -97,6 +97,18 @@ public void RefreshNavigationViewPaneDisplayMode() NavView.PaneDisplayMode = Settings.NavigationViewPaneDisplayMode; } + private void NavView_DisplayModeChanged(NavigationView sender, NavigationViewDisplayModeChangedEventArgs args) + { + if (NavView.PaneDisplayMode == NavigationViewPaneDisplayMode.Top) + { + appTitleBar.IsPaneButtonVisible = false; + } + else + { + appTitleBar.IsPaneButtonVisible = true; + } + } + private void NavViewPaneDisplayModeButton_Click(object sender, RoutedEventArgs e) { switch (NavView.PaneDisplayMode) @@ -119,6 +131,11 @@ private void NavViewPaneDisplayModeButton_Click(object sender, RoutedEventArgs e } Settings.NavigationViewPaneDisplayMode = NavView.PaneDisplayMode; + + if (HomeLandingPage.Instance != null) + { + HomeLandingPage.Instance.UpdateHomeLandingPageCornerRadius(); + } } } diff --git a/dev/Views/Settings/GeneralSettingPage.xaml b/dev/Views/Settings/GeneralSettingPage.xaml index 5fd8424..58a7956 100644 --- a/dev/Views/Settings/GeneralSettingPage.xaml +++ b/dev/Views/Settings/GeneralSettingPage.xaml @@ -81,11 +81,17 @@ - + - + + + +