From ddb892dbdb6779045ea7893e7d659cb77addff51 Mon Sep 17 00:00:00 2001 From: NoobNotFound Date: Tue, 29 Oct 2024 21:07:02 +0530 Subject: [PATCH] Rename Emerald namsepace to Emerald.Uno + Some updates --- .../Helpers/MarkupExtensions/FontIcon.cs | 4 +- Emerald.sln | 2 +- Emerald/App.xaml | 5 +- Emerald/App.xaml.cs | 2 +- .../{Emerald.csproj => Emerald.Uno.csproj} | 15 +- .../Helpers/Converters/BoolToVisibility.cs | 2 +- Emerald/Helpers/MarkupExtensions/FontIcon.cs | 2 +- .../Helpers/Settings/Enums/MicaTintColor.cs | 9 + Emerald/Helpers/Settings/JSON.cs | 365 ++++++++++++++++++ Emerald/Helpers/Settings/SettingsSystem.cs | 111 ++++++ Emerald/MainPage.xaml | 13 +- Emerald/MainPage.xaml.cs | 144 +++++-- Emerald/Models/SquareNavigationViewItem.cs | 5 +- Emerald/Package.appxmanifest | 10 +- Emerald/Platforms/Desktop/Program.cs | 2 +- .../Platforms/MacCatalyst/Main.maccatalyst.cs | 2 +- Emerald/Properties/launchSettings.json | 10 +- Emerald/Strings/en/Resources.resw | 2 +- Emerald/UserControls/Titlebar.xaml | 2 +- Emerald/Views/Settings/SettingsPage.xaml | 68 ++++ Emerald/Views/Settings/SettingsPage.xaml.cs | 45 +++ Emerald/app.manifest | 2 +- 22 files changed, 745 insertions(+), 77 deletions(-) rename Emerald/{Emerald.csproj => Emerald.Uno.csproj} (81%) create mode 100644 Emerald/Helpers/Settings/Enums/MicaTintColor.cs create mode 100644 Emerald/Helpers/Settings/JSON.cs create mode 100644 Emerald/Helpers/Settings/SettingsSystem.cs create mode 100644 Emerald/Views/Settings/SettingsPage.xaml create mode 100644 Emerald/Views/Settings/SettingsPage.xaml.cs diff --git a/Emerald.App/Emerald.App/Helpers/MarkupExtensions/FontIcon.cs b/Emerald.App/Emerald.App/Helpers/MarkupExtensions/FontIcon.cs index e32a4597..5b70d088 100644 --- a/Emerald.App/Emerald.App/Helpers/MarkupExtensions/FontIcon.cs +++ b/Emerald.App/Emerald.App/Helpers/MarkupExtensions/FontIcon.cs @@ -1,11 +1,11 @@ -using Microsoft.UI.Xaml.Markup; +using Microsoft.UI.Xaml.Markup; namespace Emerald.WinUI.Helpers { [MarkupExtensionReturnType(ReturnType = typeof(Microsoft.UI.Xaml.Controls.FontIcon))] public sealed class FontIcon : MarkupExtension { - public string Glyph { get; set; } + public string Glyph { get; set; } = "\xe8a5"; public int FontSize { get; set; } = 16; diff --git a/Emerald.sln b/Emerald.sln index bb5184e0..cb5195c2 100644 --- a/Emerald.sln +++ b/Emerald.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.11.35103.136 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Emerald", "Emerald\Emerald.csproj", "{9D3213F4-E514-4E7D-872A-725DB4872436}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Emerald.Uno", "Emerald\Emerald.Uno.csproj", "{9D3213F4-E514-4E7D-872A-725DB4872436}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3142BDF3-E95C-4F0F-8701-CF981F6EA3C0}" ProjectSection(SolutionItems) = preProject diff --git a/Emerald/App.xaml b/Emerald/App.xaml index b7b448c4..f861592b 100644 --- a/Emerald/App.xaml +++ b/Emerald/App.xaml @@ -1,7 +1,6 @@ - + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> diff --git a/Emerald/App.xaml.cs b/Emerald/App.xaml.cs index 4c4e74a9..ac07a3cd 100644 --- a/Emerald/App.xaml.cs +++ b/Emerald/App.xaml.cs @@ -1,6 +1,6 @@ using Uno.Resizetizer; -namespace Emerald; +namespace Emerald.Uno; public partial class App : Application { /// diff --git a/Emerald/Emerald.csproj b/Emerald/Emerald.Uno.csproj similarity index 81% rename from Emerald/Emerald.csproj rename to Emerald/Emerald.Uno.csproj index 77654f5f..9e685211 100644 --- a/Emerald/Emerald.csproj +++ b/Emerald/Emerald.Uno.csproj @@ -1,4 +1,4 @@ - + net8.0-maccatalyst; @@ -10,9 +10,9 @@ true - Emerald + Emerald.Uno - Riverside.Emerald + Riverside.Emerald.Uno 1.0 1 @@ -43,6 +43,7 @@ + @@ -51,10 +52,18 @@ + + + MSBuild:Compile + + + MSBuild:Compile + + diff --git a/Emerald/Helpers/Converters/BoolToVisibility.cs b/Emerald/Helpers/Converters/BoolToVisibility.cs index c60e4a27..2fafd1c8 100644 --- a/Emerald/Helpers/Converters/BoolToVisibility.cs +++ b/Emerald/Helpers/Converters/BoolToVisibility.cs @@ -1,7 +1,7 @@ using Microsoft.UI.Xaml.Data; -namespace Emerald.Helpers.Converters; +namespace Emerald.Uno.Helpers.Converters; public class BoolToVisibility : IValueConverter { public bool Reversed { get; set; } diff --git a/Emerald/Helpers/MarkupExtensions/FontIcon.cs b/Emerald/Helpers/MarkupExtensions/FontIcon.cs index e9d03396..a7e8c816 100644 --- a/Emerald/Helpers/MarkupExtensions/FontIcon.cs +++ b/Emerald/Helpers/MarkupExtensions/FontIcon.cs @@ -5,7 +5,7 @@ namespace Emerald.Uno.Helpers; [MarkupExtensionReturnType(ReturnType = typeof(Microsoft.UI.Xaml.Controls.FontIcon))] public sealed class FontIcon : MarkupExtension { - public string Glyph { get; set; } + public string Glyph { get; set; } = "\xe8a5"; public int FontSize { get; set; } = 16; diff --git a/Emerald/Helpers/Settings/Enums/MicaTintColor.cs b/Emerald/Helpers/Settings/Enums/MicaTintColor.cs new file mode 100644 index 00000000..4a97fbb6 --- /dev/null +++ b/Emerald/Helpers/Settings/Enums/MicaTintColor.cs @@ -0,0 +1,9 @@ +namespace Emerald.Uno.Helpers.Settings.Enums +{ + public enum MicaTintColor : int + { + NoColor = 0, + AccentColor = 1, + CustomColor = 2 + } +} diff --git a/Emerald/Helpers/Settings/JSON.cs b/Emerald/Helpers/Settings/JSON.cs new file mode 100644 index 00000000..3d1a024a --- /dev/null +++ b/Emerald/Helpers/Settings/JSON.cs @@ -0,0 +1,365 @@ +using CmlLib.Core; +using CommunityToolkit.Mvvm.ComponentModel; +using Microsoft.UI; +using Microsoft.UI.Xaml; +using System.Text.Json; +using System.Text.Json.Serialization; +using System; +using System.Collections.Generic; +using Windows.UI; +using Emerald.CoreX.Store.Modrinth; +namespace Emerald.Uno.Helpers.Settings.JSON; + +public class JSON : Models.Model +{ + public string Serialize() + => JsonSerializer.Serialize(this, new JsonSerializerOptions { WriteIndented = true }); +} + +public class SettingsBackup : JSON +{ + public string Backup { get; set; } + public string Name { get; set; } + public DateTime Time { get; set; } + // ik there is Time.ToString() lol + public string DateString => $"{Time.ToLongDateString()} {Time.ToShortTimeString()}"; +} + +public class Backups : JSON +{ + public SettingsBackup[] AllBackups { get; set; } = Array.Empty(); + public string APIVersion { get; private set; } = "1.0"; +} + +public class Settings : JSON +{ + public static Settings CreateNew() => new() + { + App = new() + { + Discord = new(), + Appearance = new() + { + MicaTintColor = (int)Enums.MicaTintColor.NoColor, + Theme = (int)ElementTheme.Default + } + }, + Minecraft = new() + { + Path = MinecraftPath.GetOSDefaultPath(), + // RAM = DirectResoucres.MaxRAM / 2, + MCVerionsConfiguration = new(), + JVM = new(), + Downloader = new() + { + AssetsCheck = true, + HashCheck = true + } + } + }; + + // public string APIVersion { get; set; } = DirectResoucres.SettingsAPIVersion; + public DateTime LastSaved { get; set; } = DateTime.Now; + public Minecraft Minecraft { get; set; } = new(); + + public App App { get; set; } = new(); +} + +public partial class Minecraft : JSON +{ + public Minecraft() + { + JVM.PropertyChanged += (_, _) + => InvokePropertyChanged(); + PropertyChanged += (_, e) => + { + if (e.PropertyName != null) + InvokePropertyChanged(); + }; + } + + [JsonIgnore] + public double RAMinGB => Math.Round((RAM / 1024.00), 2); + + + [ObservableProperty] + private string _Path; + + [ObservableProperty] + private int _RAM; + + [ObservableProperty] + private bool _IsAdmin; + + public Downloader Downloader { get; set; } = new(); + + public MCVerionsConfiguration MCVerionsConfiguration { get; set; } + + public JVM JVM { get; set; } = new(); + + public bool ReadLogs() + => JVM.GameLogs && !IsAdmin; +} + +public class Account : JSON +{ + public string Type { get; set; } + public string Username { get; set; } + public string AccessToken { get; set; } + public string ClientToken { get; set; } + public string UUID { get; set; } + public bool LastAccessed { get; set; } +} + +public partial class Downloader : JSON +{ + [ObservableProperty] + private bool _HashCheck; + + [ObservableProperty] + private bool _AssetsCheck; +} + +public partial class JVM : JSON +{ + public JVM() + { + this.PropertyChanged += (_, e) => + { + if (e.PropertyName != null) + this.InvokePropertyChanged(); + }; + } + + [ObservableProperty] + private string[] _Arguments; + + [ObservableProperty] + private double _ScreenWidth; + + [ObservableProperty] + private double _ScreenHeight; + + [ObservableProperty] + private bool _FullScreen; + + [ObservableProperty] + private bool _GameLogs; + + [JsonIgnore] + public string ScreenSizeStatus => + FullScreen ? "FullScreen".Localize() : ((ScreenWidth > 0 && ScreenHeight > 0) ? $"{ScreenWidth} × {ScreenHeight}" : "Default".Localize()); + + [JsonIgnore] + public bool SetSize => !(ScreenSizeStatus == "FullScreen".Localize() || ScreenSizeStatus == "Default".Localize()); +} + +public class App : JSON +{ + public Appearance Appearance { get; set; } = new(); + public bool AutoLogin { get; set; } + public Discord Discord { get; set; } = new(); + public NewsFilter NewsFilter { get; set; } = new(); + public Store Store { get; set; } = new(); + public Updates Updates { get; set; } = new(); + public bool AutoClose { get; set; } + public bool HideOnLaunch { get; set; } + public bool WindowsHello { get; set; } +} +public class Updates : JSON +{ + public bool CheckAtStartup { get; set; } = true; + public bool AutoDownload { get; set; } + public bool IncludePreReleases { get; set; } +} +public partial class StoreFilter : JSON +{ + [ObservableProperty] + private bool _Fabric; + + [ObservableProperty] + private bool _Forge; + + [ObservableProperty] + private bool _Adventure; + + [ObservableProperty] + private bool _Cursed; + + [ObservableProperty] + private bool _Decoration; + + [ObservableProperty] + private bool _Equipment; + + [ObservableProperty] + private bool _Food; + + [ObservableProperty] + private bool _Library; + + [ObservableProperty] + private bool _Magic; + + [ObservableProperty] + private bool _Misc; + + [ObservableProperty] + private bool _Optimization; + + [ObservableProperty] + private bool _Storage; + + [ObservableProperty] + private bool _Technology; + + [ObservableProperty] + private bool _Utility; + + [ObservableProperty] + private bool _Worldgen; + + [JsonIgnore] + public bool All + { + get =>true; + set + { + _Fabric = _Forge = _Adventure = _Cursed = _Decoration = _Equipment = _Food = _Library = _Magic = _Misc = _Optimization = _Storage = _Technology = _Utility = _Worldgen = false; + InvokePropertyChanged(null); + } + } +} +public class Store : JSON +{ + public StoreFilter Filter { get; set; } = new(); + public StoreSortOptions SortOptions { get; set; } = new(); +} + +public partial class StoreSortOptions : JSON +{ + [ObservableProperty] + private bool _Relevance = true; + + [ObservableProperty] + private bool _Downloads; + + [ObservableProperty] + private bool _Follows; + + [ObservableProperty] + private bool _Updated; + + [ObservableProperty] + private bool _Newest; + + public SearchSortOptions GetResult() + { + if (!(Relevance || Downloads || Follows || Updated || Newest)) + return SearchSortOptions.Relevance; + else + return Relevance ? SearchSortOptions.Relevance : (Downloads ? SearchSortOptions.Downloads : (Follows ? SearchSortOptions.Follows : (Updated ? SearchSortOptions.Updated : SearchSortOptions.Newest))); + } +} +public partial class NewsFilter : JSON +{ + [ObservableProperty] + private bool _Java = false; + + [ObservableProperty] + private bool _Bedrock = false; + + [ObservableProperty] + private bool _Dungeons = false; + + [ObservableProperty] + private bool _Legends = false; + + [JsonIgnore] + public bool All + { + get => GetResult().Length == 4; + set + { + Java = Bedrock = Dungeons = Legends = false; + InvokePropertyChanged(null); + } + } + public string[] GetResult() + { + var r = new List(); + + if (!Java && !Bedrock && !Dungeons && !Legends) + { + r.Add("Minecraft: Java Edition"); + r.Add("Minecraft for Windows"); + r.Add("Minecraft Dungeons"); + r.Add("Minecraft Legends"); + return r.ToArray(); + } + + if (Java) + r.Add("Minecraft: Java Edition"); + + if (Bedrock) + r.Add("Minecraft for Windows"); + + if (Dungeons) + r.Add("Minecraft Dungeons"); + + if (Legends) + r.Add("Minecraft Legends"); + + return r.ToArray(); + } +} +public class Discord : JSON +{ +} +public partial class MCVerionsConfiguration : JSON +{ + [ObservableProperty] + private bool _Release = true; + + [ObservableProperty] + private bool _Custom = false; + + [ObservableProperty] + private bool _OldBeta = false; + + [ObservableProperty] + private bool _OldAlpha = false; + + [ObservableProperty] + private bool _Snapshot = false; +} + +public partial class Appearance : JSON +{ + [ObservableProperty] + private int _NavIconType = 1; + + public bool ShowFontIcons => NavIconType == 0; + + [ObservableProperty] + private int _Theme; + + [ObservableProperty] + private int _MicaTintColor; + + [ObservableProperty] + private int _MicaType = 0; + + [ObservableProperty] + private (int A, int R, int G, int B)? _CustomMicaTintColor; + + + public Appearance() + { + this.PropertyChanged += (_, e) => + { + if (e.PropertyName != null) + this.InvokePropertyChanged(); + }; + } +} diff --git a/Emerald/Helpers/Settings/SettingsSystem.cs b/Emerald/Helpers/Settings/SettingsSystem.cs new file mode 100644 index 00000000..53d3c565 --- /dev/null +++ b/Emerald/Helpers/Settings/SettingsSystem.cs @@ -0,0 +1,111 @@ +using Emerald.Uno.Helpers.Settings.JSON; +using System.Text.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Windows.Storage; + +namespace Emerald.Uno.Helpers.Settings; + +public static class SettingsSystem +{ + public static JSON.Settings Settings { get; private set; } = JSON.Settings.CreateNew(); + public static Account[] Accounts { get; set; } + + public static event EventHandler? APINoMatch; +// public static T GetSerializedFromSettings(string key, T def) +// { +// string json; +// try +// { +// json = ApplicationData.Current.RoamingSettings.Values[key] as string; +// return JsonSerializer.Deserialize(json); +// } +// catch +// { +// json = JsonSerializer.Serialize(def); +// ApplicationData.Current.RoamingSettings.Values[key] = json; +// return def; +// } +// } +// public static void LoadData() +// { +// Settings = GetSerializedFromSettings("Settings", JSON.Settings.CreateNew()); +// Accounts = GetSerializedFromSettings("Accounts", Array.Empty()); + +// if (Settings.APIVersion != DirectResoucres.SettingsAPIVersion) +// { +// APINoMatch?.Invoke(null, ApplicationData.Current.RoamingSettings.Values["Settings"] as string); +// ApplicationData.Current.RoamingSettings.Values["Settings"] = JSON.Settings.CreateNew().Serialize(); +// Settings = JsonSerializer.Deserialize(ApplicationData.Current.RoamingSettings.Values["Settings"] as string); +// } +// } + +// public static async Task CreateBackup(string system) +// { +// string json = await FileIO.ReadTextAsync(await ApplicationData.Current.LocalFolder.CreateFileAsync("backups.json", CreationCollisionOption.OpenIfExists)); +// var l = json.IsNullEmptyOrWhiteSpace() ? new Backups() : JsonSerializer.Deserialize(json); + +// var bl = l.AllBackups == null ? new List() : l.AllBackups.ToList(); +// bl.Add(new SettingsBackup() { Time = DateTime.Now, Backup = system }); +// l.AllBackups = bl.ToArray(); +// json = l.Serialize(); + +// await FileIO.WriteTextAsync(await ApplicationData.Current.LocalFolder.CreateFileAsync("backups.json", CreationCollisionOption.OpenIfExists), json); +// } + +// public static async Task DeleteBackup(int Index) +// { +// string json = await FileIO.ReadTextAsync(await ApplicationData.Current.LocalFolder.CreateFileAsync("backups.json", CreationCollisionOption.OpenIfExists)); +// var l = json.IsNullEmptyOrWhiteSpace() ? new Backups() : JsonSerializer.Deserialize(json); + +// var bl = l.AllBackups == null ? new List() : l.AllBackups.ToList(); +// bl.RemoveAt(Index); +// l.AllBackups = bl.ToArray(); +// json = l.Serialize(); + +// await FileIO.WriteTextAsync(await ApplicationData.Current.LocalFolder.CreateFileAsync("backups.json", CreationCollisionOption.OpenIfExists), json); +// } + +// public static async Task DeleteBackup(DateTime time) +// { +// string json = await FileIO.ReadTextAsync(await ApplicationData.Current.LocalFolder.CreateFileAsync("backups.json", CreationCollisionOption.OpenIfExists)); +// var l = json.IsNullEmptyOrWhiteSpace() ? new Backups() : JsonSerializer.Deserialize(json); + +// var bl = l.AllBackups == null ? new List() : l.AllBackups.ToList(); +// bl.Remove(x => x.Time == time); +// l.AllBackups = bl.ToArray(); +// json = l.Serialize(); + +// await FileIO.WriteTextAsync(await ApplicationData.Current.LocalFolder.CreateFileAsync("backups.json", CreationCollisionOption.OpenIfExists), json); +// } +// public static async Task RenameBackup(DateTime time, string name) +// { +// string json = await FileIO.ReadTextAsync(await ApplicationData.Current.LocalFolder.CreateFileAsync("backups.json", CreationCollisionOption.OpenIfExists)); +// var l = json.IsNullEmptyOrWhiteSpace() ? new Backups() : JsonSerializer.Deserialize(json); + +// var bl = l.AllBackups == null ? new List() : l.AllBackups.ToList(); +// bl.FirstOrDefault(x => x.Time == time).Name = name; +// l.AllBackups = bl.ToArray(); +// json = l.Serialize(); + +// await FileIO.WriteTextAsync(await ApplicationData.Current.LocalFolder.CreateFileAsync("backups.json", CreationCollisionOption.OpenIfExists), json); +// } + +// public static async Task> GetBackups() +// { +// string json = await FileIO.ReadTextAsync(await ApplicationData.Current.LocalFolder.CreateFileAsync("backups.json", CreationCollisionOption.OpenIfExists)); +// var l = json.IsNullEmptyOrWhiteSpace() ? new Backups() : JsonSerializer.Deserialize(json); + +// return l.AllBackups == null ? new List() : l.AllBackups.ToList(); +// } + +// public static void SaveData() +// { +// Settings.LastSaved = DateTime.Now; +// ApplicationData.Current.RoamingSettings.Values["Settings"] = Settings.Serialize(); +// ApplicationData.Current.RoamingSettings.Values["Accounts"] = JsonSerializer.Serialize(Accounts); +// } +//} +} diff --git a/Emerald/MainPage.xaml b/Emerald/MainPage.xaml index 120f86b5..09b5233f 100644 --- a/Emerald/MainPage.xaml +++ b/Emerald/MainPage.xaml @@ -1,11 +1,11 @@ - @@ -18,6 +18,7 @@ VerticalAlignment="Top" /> - + 4 24 - 2 + 4 0 @@ -109,7 +110,7 @@ (NavView.Header as NavViewHeader).HeaderMargin = GetNavViewHeaderMargin(); + Navigate(NavView.SelectedItem as SquareNavigationViewItem); + } + + private Thickness GetNavViewHeaderMargin() + { + if (NavView.DisplayMode == NavigationViewDisplayMode.Minimal) + { + NavView.IsPaneToggleButtonVisible = true; + return new Thickness(35, -40, 0, 0); + } + else + { + NavView.IsPaneToggleButtonVisible = false; + return new Thickness(-30, -20, 0, 10); + } + } + private void navView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args) + { + Navigate(NavView.SelectedItem as SquareNavigationViewItem); + } -NavView.FooterMenuItems.Add(new SquareNavigationViewItem("Tasks".Localize()){ - FontIconGlyph = "\xE9D5", - SolidFontIconGlyph = "\xE9D5", - IsSelected = false, - ShowFontIcons = true -}); -NavView.FooterMenuItems.Add(new SquareNavigationViewItem("Logs".Localize()){ - FontIconGlyph = "\xE756", - SolidFontIconGlyph = "\xE756", - IsSelected = false, - ShowFontIcons = true -}); -NavView.FooterMenuItems.Add(new SquareNavigationViewItem("Settings".Localize()){ - FontIconGlyph = "\xE713", - SolidFontIconGlyph = "\xE713", - IsSelected = false, - ShowFontIcons = true -}); + private void Navigate(SquareNavigationViewItem itm) + { + switch (itm.Tag) + { + default: + NavigateOnce(typeof(SettingsPage)); + break; + } + (NavView.Header as NavViewHeader).HeaderText = itm.Tag == "Tasks" ? (NavView.Header as NavViewHeader).HeaderText : itm.Name; + (NavView.Header as NavViewHeader).HeaderMargin = GetNavViewHeaderMargin(); + + } -NavView.SelectedItem = NavView.MenuItems[0]; + private void NavigateOnce(Type type) + { + + if (frame.Content == null || frame.Content.GetType() != type) + { + frame.Navigate(type, null, new EntranceNavigationTransitionInfo()); + } } } diff --git a/Emerald/Models/SquareNavigationViewItem.cs b/Emerald/Models/SquareNavigationViewItem.cs index 2bcbf031..ff520d0f 100644 --- a/Emerald/Models/SquareNavigationViewItem.cs +++ b/Emerald/Models/SquareNavigationViewItem.cs @@ -29,7 +29,7 @@ public SquareNavigationViewItem(string name, bool isSelected = false, ImageSourc } }; } - + public string Tag { get; set; } [ObservableProperty] private string _Name; @@ -57,6 +57,7 @@ public SquareNavigationViewItem(string name, bool isSelected = false, ImageSourc public Visibility FontIconVisibility => ShowFontIcons && !IsSelected ? Visibility.Visible : Visibility.Collapsed; public Visibility SolidFontIconVisibility => ShowFontIcons && IsSelected ? Visibility.Visible : Visibility.Collapsed; - + public Visibility SelectionVisibility => IsSelected ? Visibility.Collapsed : Visibility.Visible; + public bool ShowThumbnail => !ShowFontIcons; } diff --git a/Emerald/Package.appxmanifest b/Emerald/Package.appxmanifest index 29558f1d..76392e52 100644 --- a/Emerald/Package.appxmanifest +++ b/Emerald/Package.appxmanifest @@ -7,13 +7,13 @@ IgnorableNamespaces="uap rescap"> - Emerald - Emerald + Emerald.Uno + Emerald.Uno @@ -30,8 +30,8 @@ Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$"> + DisplayName="Emerald.Uno" + Description="Emerald.Uno"> diff --git a/Emerald/Platforms/Desktop/Program.cs b/Emerald/Platforms/Desktop/Program.cs index 505e2c1b..c406e4af 100644 --- a/Emerald/Platforms/Desktop/Program.cs +++ b/Emerald/Platforms/Desktop/Program.cs @@ -1,6 +1,6 @@ using Uno.UI.Runtime.Skia; -namespace Emerald; +namespace Emerald.Uno; public class Program { [STAThread] diff --git a/Emerald/Platforms/MacCatalyst/Main.maccatalyst.cs b/Emerald/Platforms/MacCatalyst/Main.maccatalyst.cs index d26d16e3..08b2a160 100644 --- a/Emerald/Platforms/MacCatalyst/Main.maccatalyst.cs +++ b/Emerald/Platforms/MacCatalyst/Main.maccatalyst.cs @@ -1,6 +1,6 @@ using UIKit; -namespace Emerald.MacCatalyst; +namespace Emerald.Uno.MacCatalyst; public class EntryPoint { // This is the main entry point of the application. diff --git a/Emerald/Properties/launchSettings.json b/Emerald/Properties/launchSettings.json index a8c8aed9..bf880023 100644 --- a/Emerald/Properties/launchSettings.json +++ b/Emerald/Properties/launchSettings.json @@ -9,21 +9,21 @@ }, "profiles": { // Note: In order to select this profile, you'll need to comment the `Packaged` profile below until this is fixed: https://aka.platform.uno/wasdk-maui-debug-profile-issue - "Emerald (WinAppSDK Unpackaged)": { + "Emerald.Uno (WinAppSDK Unpackaged)": { "commandName": "Project", "compatibleTargetFramework": "windows" }, - "Emerald (WinAppSDK Packaged)": { + "Emerald.Uno (WinAppSDK Packaged)": { "commandName": "MsixPackage", "compatibleTargetFramework": "windows" }, - "Emerald (Desktop)": { + "Emerald.Uno (Desktop)": { "commandName": "Project", "compatibleTargetFramework": "desktop" }, - "Emerald (Desktop WSL2)": { + "Emerald.Uno (Desktop WSL2)": { "commandName": "WSL2", - "commandLineArgs": "{ProjectDir}/bin/Debug/net8.0-desktop/Emerald.dll", + "commandLineArgs": "{ProjectDir}/bin/Debug/net8.0-desktop/Emerald.Uno.dll", "distributionName": "", "compatibleTargetFramework": "desktop" } diff --git a/Emerald/Strings/en/Resources.resw b/Emerald/Strings/en/Resources.resw index a311865f..2723b3c3 100644 --- a/Emerald/Strings/en/Resources.resw +++ b/Emerald/Strings/en/Resources.resw @@ -118,6 +118,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Emerald-en + Emerald.Uno-en diff --git a/Emerald/UserControls/Titlebar.xaml b/Emerald/UserControls/Titlebar.xaml index 2ecadaa5..6851a77b 100644 --- a/Emerald/UserControls/Titlebar.xaml +++ b/Emerald/UserControls/Titlebar.xaml @@ -27,7 +27,7 @@ Margin="8,0,0,0" VerticalAlignment="Center" Style="{ThemeResource CaptionTextBlockStyle}" - Text="Emerald" /> + Text="Emerald.Uno" /> + + + + + + + 0 + 0 + 40 + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Emerald/Views/Settings/SettingsPage.xaml.cs b/Emerald/Views/Settings/SettingsPage.xaml.cs new file mode 100644 index 00000000..74339021 --- /dev/null +++ b/Emerald/Views/Settings/SettingsPage.xaml.cs @@ -0,0 +1,45 @@ +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media.Animation; +using System; + +namespace Emerald.Uno.Views.Settings +{ + public sealed partial class SettingsPage : Page + { + public SettingsPage() + { + InitializeComponent(); + + //Loaded += (_, _) => Navigate(navView.SelectedItem as NavigationViewItem); + } + + private void navView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args) + { + Navigate(navView.SelectedItem as NavigationViewItem); + } + + private void Navigate(NavigationViewItem itm) + { + switch (itm.Tag) + { + case "Appearance": + NavigateOnce(typeof(SettingsPage)); + break; + case "About": + NavigateOnce(typeof(SettingsPage)); + break; + default: + NavigateOnce(typeof(SettingsPage)); + break; + } + } + + private void NavigateOnce(Type type) + { + if (contentframe.Content == null || contentframe.Content.GetType() != type) + { + contentframe.Navigate(type, null, new DrillInNavigationTransitionInfo()); + } + } + } +} diff --git a/Emerald/app.manifest b/Emerald/app.manifest index 7c69768c..a61e665f 100644 --- a/Emerald/app.manifest +++ b/Emerald/app.manifest @@ -1,6 +1,6 @@ - +