Return full result from dump checks

This commit is contained in:
Matt Nadareski
2025-09-25 10:54:29 -04:00
parent f50a110acd
commit bc938fd58c
3 changed files with 9 additions and 7 deletions

View File

@@ -6,6 +6,7 @@
- Set media type visibility when options changed
- Change label with media type visibility
- Update media type visibility on system change
- Return full result from dump checks
### 3.4.0 (2025-09-25)

View File

@@ -393,13 +393,13 @@ namespace MPF.Frontend.ViewModels
/// Performs MPF.Check functionality
/// </summary>
/// <returns>An error message if failed, otherwise string.Empty/null</returns>
public async Task<string?> CheckDump(ProcessUserInfoDelegate processUserInfo)
public async Task<ResultEventArgs> CheckDump(ProcessUserInfoDelegate processUserInfo)
{
if (string.IsNullOrEmpty(InputPath))
return "Invalid Input path";
return ResultEventArgs.Failure("Invalid Input path");
if (!File.Exists(InputPath!.Trim('"')))
return "Input Path is not a valid file";
return ResultEventArgs.Failure("Input Path is not a valid file");
// Disable UI while Check is running
DisableUIElements();
@@ -431,7 +431,7 @@ namespace MPF.Frontend.ViewModels
if (cachedCanExecuteSelectionChanged)
EnableEventHandlers();
return result.Message;
return result;
}
/// <summary>

View File

@@ -158,8 +158,8 @@ namespace MPF.UI.Windows
/// </summary>
private async void OnCheckDumpClick(object sender, EventArgs e)
{
string? errorMessage = await CheckDumpViewModel.CheckDump(ShowMediaInformationWindow);
if (string.IsNullOrEmpty(errorMessage))
var result = await CheckDumpViewModel.CheckDump(ShowMediaInformationWindow);
if (result)
{
bool? checkAgain = DisplayUserMessage("Check Complete", "The dump has been processed successfully! Would you like to check another dump?", 2, false);
if (checkAgain == false)
@@ -169,7 +169,8 @@ namespace MPF.UI.Windows
}
else
{
DisplayUserMessage("Check Failed", errorMessage!, 1, false);
string? message = result.Message ?? "Please check all files exist and try again!";
DisplayUserMessage("Check Failed", message, 1, false);
}
}