From 5d8b29664c13e6e5c6292d79973980182ece1441 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Tue, 13 Jan 2026 08:22:09 +0800 Subject: Add data loading from wrapper to view model --- CommandLineWrapper/JVCSWorkspace.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'CommandLineWrapper/JVCSWorkspace.cs') diff --git a/CommandLineWrapper/JVCSWorkspace.cs b/CommandLineWrapper/JVCSWorkspace.cs index d88209c..8afd212 100644 --- a/CommandLineWrapper/JVCSWorkspace.cs +++ b/CommandLineWrapper/JVCSWorkspace.cs @@ -1,10 +1,12 @@ -using CommandLineWrapper; +namespace CommandLineWrapper; public class JVCSWorkspace { public string WorkspaceDirectory => _workspaceDirectory ?? Directory.GetCurrentDirectory(); + public bool SuccessInitialized => _successInitialized; private string? _workspaceDirectory; + private bool _successInitialized; public async Task InitializeAsync(string directory) { @@ -17,15 +19,18 @@ public class JVCSWorkspace var currentWorkspace = result.StandardOutput; // Check if the obtained workspace directory is valid (not empty and exists) - if (string.IsNullOrWhiteSpace(currentWorkspace) && + if (!string.IsNullOrWhiteSpace(currentWorkspace) && Directory.Exists(currentWorkspace)) { _workspaceDirectory = currentWorkspace; + _successInitialized = true; } else { // If the workspace is invalid, initialize a new workspace - await JVCSCommandInvoker.Invoke(Constants.CommandParameterGenerator.Initialize()); + result = await JVCSCommandInvoker.Invoke(Constants.CommandParameterGenerator.Initialize(), directory); + if (result.ExitCode == 0) + _successInitialized = true; } } } -- cgit