From 0de1d98fc6774a582183faf528b770a6808422de Mon Sep 17 00:00:00 2001 From: Salvador Cipolla Date: Wed, 29 Jan 2025 19:05:07 -0300 Subject: [PATCH] Set minimal launcher dimensions and separate those values in custom mode --- Knossos.NET/Models/CustomLauncher.cs | 22 +++++++++++++++++-- .../ViewModels/Windows/MainWindowViewModel.cs | 8 +++++++ Knossos.NET/Views/Windows/MainWindow.axaml | 4 ++-- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Knossos.NET/Models/CustomLauncher.cs b/Knossos.NET/Models/CustomLauncher.cs index 4342d4d0..8e907989 100644 --- a/Knossos.NET/Models/CustomLauncher.cs +++ b/Knossos.NET/Models/CustomLauncher.cs @@ -98,18 +98,28 @@ public static class CustomLauncher /// /// Starting width size of the launcher window - /// This is also the min width /// null for auto /// public static int? WindowWidth { get; private set; } = 1024; /// /// Starting height size of the launcher window - /// This is also the min height /// null for auto /// public static int? WindowHeight { get; private set; } = 540; + /// + /// This is the min width for the launcher + /// null for auto + /// + public static int? MinWindowWidth { get; private set; } = 900; + + /// + /// This is the min height for the launcher + /// null for auto + /// + public static int? MinWindowHeight { get; private set; } = 500; + /// /// Configurable option to show the task buttom at the end of the menu buttom list /// instead of at the beginning. @@ -290,6 +300,12 @@ private static void ReadCustomFile() if (customData.WindowHeight != null) WindowHeight = customData.WindowHeight; + if (customData.MinWindowWidth != null) + MinWindowWidth = customData.MinWindowWidth; + + if (customData.MinWindowHeight != null) + MinWindowHeight = customData.MinWindowHeight; + if (customData.MenuTaskButtonAtTheEnd.HasValue) MenuTaskButtonAtTheEnd = customData.MenuTaskButtonAtTheEnd.Value; @@ -357,6 +373,8 @@ struct CustomFileData public string? NebulaTextToolTip { get; set; } public int? WindowWidth { get; set; } public int? WindowHeight { get; set; } + public int? MinWindowWidth { get; set; } + public int? MinWindowHeight { get; set; } public bool? MenuTaskButtonAtTheEnd { get; set; } public bool? MenuOpenFirstTime { get; set; } public bool? MenuDisplayEngineEntry { get; set; } diff --git a/Knossos.NET/ViewModels/Windows/MainWindowViewModel.cs b/Knossos.NET/ViewModels/Windows/MainWindowViewModel.cs index 402a3d2d..6be87ef2 100644 --- a/Knossos.NET/ViewModels/Windows/MainWindowViewModel.cs +++ b/Knossos.NET/ViewModels/Windows/MainWindowViewModel.cs @@ -38,6 +38,10 @@ public partial class MainWindowViewModel : ViewModelBase [ObservableProperty] internal int? windowHeight = null; [ObservableProperty] + internal int? minWindowWidth = null; + [ObservableProperty] + internal int? minWindowHeight = null; + [ObservableProperty] internal ModListViewModel? installedModsView; [ObservableProperty] internal NebulaModListViewModel? nebulaModsView; @@ -120,6 +124,8 @@ public MainWindowViewModel() } if (!CustomLauncher.IsCustomMode) { + MinWindowWidth = 900; + MinWindowHeight = 500; InstalledModsView = new ModListViewModel(); NebulaModsView = new NebulaModListViewModel(); FsoBuildsView = new FsoBuildsViewModel(); @@ -137,6 +143,8 @@ public MainWindowViewModel() AppTitle = CustomLauncher.WindowTitle + " v" + Knossos.AppVersion; WindowHeight = CustomLauncher.WindowHeight; WindowWidth = CustomLauncher.WindowWidth; + MinWindowWidth = CustomLauncher.MinWindowWidth; + MinWindowHeight = CustomLauncher.MinWindowHeight; CustomHomeVM = new CustomHomeViewModel(); if (CustomLauncher.MenuDisplayEngineEntry) FsoBuildsView = new FsoBuildsViewModel(); diff --git a/Knossos.NET/Views/Windows/MainWindow.axaml b/Knossos.NET/Views/Windows/MainWindow.axaml index 499e588f..79a98275 100644 --- a/Knossos.NET/Views/Windows/MainWindow.axaml +++ b/Knossos.NET/Views/Windows/MainWindow.axaml @@ -6,8 +6,8 @@ xmlns:v="using:Knossos.NET.Views" Width="{Binding WindowWidth}" Height="{Binding WindowHeight}" - MinWidth="{Binding WindowWidth}" - MinHeight="{Binding WindowHeight}" + MinWidth="{Binding MinWindowWidth}" + MinHeight="{Binding MinWindowHeight}" x:DataType="vm:MainWindowViewModel" mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="900" x:Class="Knossos.NET.Views.MainWindow"