|
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
| 3 | +using System.IO; |
3 | 4 | using System.Linq; |
4 | 5 | using Avalonia.Threading; |
5 | 6 | using AvaloniaControls.Controls; |
@@ -27,7 +28,10 @@ public class MsuWindowService(ILogger<MsuWindowService> logger, |
27 | 28 | IRomCopyService romCopyService) : ControlService |
28 | 29 | { |
29 | 30 | public MsuWindowViewModel Model { get; set; } = new(); |
30 | | - |
| 31 | + |
| 32 | + public string RestoreFilePath => |
| 33 | + Path.Combine(appSettings.MsuAppSettings.SaveDataDirectory.ExpandSpecialFolders(), "main-window.json"); |
| 34 | + |
31 | 35 | public event EventHandler? MsuMonitorStarted; |
32 | 36 |
|
33 | 37 | public event EventHandler? MsuMonitorStopped; |
@@ -62,9 +66,20 @@ public MsuWindowViewModel InitializeModel() |
62 | 66 | Model.CanDisplayRandomMsuButton = settings.MsuWindowDisplayRandomButton == true; |
63 | 67 | Model.CanDisplayShuffledMsuButton = settings.MsuWindowDisplayShuffleButton == true; |
64 | 68 | Model.CanDisplayContinuousShuffleButton = settings.MsuWindowDisplayContinuousButton == true; |
| 69 | + Model.CanDisplaySelectMsuButton = settings.MsuWindowDisplaySelectButton == true; |
65 | 70 | Model.CanDisplayCancelButton = settings.MsuWindowDisplaySelectButton == true; |
66 | | - Model.HasMsuFolder = userOptions.MsuUserOptions.HasMsuFolder(); |
67 | 71 | Model.IsHardwareModeButtonVisible = !appSettings.MsuAppSettings.DisableHardwareMode; |
| 72 | + Model.MsuWindowDisplayOptionsButton = appSettings.MsuAppSettings.MsuWindowDisplayOptionsButton != false; |
| 73 | + Model.HasMsuFolder = Model.MsuWindowDisplayOptionsButton && userOptions.MsuUserOptions.HasMsuFolder(); |
| 74 | + Model.AreMsusLoading = msuLookupService.Status is MsuLoadStatus.Default or MsuLoadStatus.Loading; |
| 75 | + |
| 76 | + if (!string.IsNullOrEmpty(settings.ForcedMsuType)) |
| 77 | + { |
| 78 | + Model.SelectedMsuType = settings.ForcedMsuType; |
| 79 | + Model.DisplayMsuTypeComboBox = false; |
| 80 | + Model.FilterColumnIndex = 0; |
| 81 | + } |
| 82 | + |
68 | 83 | return Model; |
69 | 84 | } |
70 | 85 |
|
@@ -273,6 +288,16 @@ public bool GenerateMsu(out string error, out bool openContinuousWindow, out Msu |
273 | 288 |
|
274 | 289 | public bool ShouldOpenMonitorWindow => userOptions.MsuUserOptions.OpenMonitorWindow; |
275 | 290 |
|
| 291 | + public void SetMsuBasePath(string? msuBasePath) |
| 292 | + { |
| 293 | + if (string.IsNullOrEmpty(msuBasePath) || !Directory.Exists(msuBasePath)) |
| 294 | + { |
| 295 | + return; |
| 296 | + } |
| 297 | + |
| 298 | + userOptions.MsuUserOptions.DefaultMsuPath = msuBasePath; |
| 299 | + } |
| 300 | + |
276 | 301 | public MsuType? GetMsuType(string msuTypeName) |
277 | 302 | { |
278 | 303 | return msuTypeService.GetMsuType(msuTypeName); |
|
0 commit comments