feat: disable SolidWorks user input during export
Sets CommandInProgress to block user interaction with SolidWorks while the DXF export is running, preventing accidental interference. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -341,6 +341,8 @@ namespace ExportDXF.Forms
|
||||
LogMessage($"Started at {DateTime.Now:t}");
|
||||
LogMessage($"Exporting to: {_fileExportService.OutputFolder}");
|
||||
|
||||
_solidWorksService.SetCommandInProgress(true);
|
||||
|
||||
await Task.Run(() => _exportService.Export(exportContext), token);
|
||||
|
||||
LogMessage("Done.");
|
||||
@@ -356,6 +358,7 @@ namespace ExportDXF.Forms
|
||||
}
|
||||
finally
|
||||
{
|
||||
_solidWorksService.SetCommandInProgress(false);
|
||||
UpdateUIForExportComplete();
|
||||
_cancellationTokenSource?.Dispose();
|
||||
_cancellationTokenSource = null;
|
||||
|
||||
@@ -88,6 +88,13 @@ namespace ExportDXF.Services
|
||||
/// <param name="enable">True to enable user control, false to disable.</param>
|
||||
void EnableUserControl(bool enable);
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether a command is in progress. When true, user input to
|
||||
/// SolidWorks is disabled and interactive dialogs are suppressed.
|
||||
/// </summary>
|
||||
/// <param name="inProgress">True to block user input, false to re-enable.</param>
|
||||
void SetCommandInProgress(bool inProgress);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the SolidWorks application instance.
|
||||
/// </summary>
|
||||
@@ -188,6 +195,15 @@ namespace ExportDXF.Services
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SetCommandInProgress(bool inProgress)
|
||||
{
|
||||
if (_sldWorks != null)
|
||||
{
|
||||
_sldWorks.CommandInProgress = inProgress;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the native SolidWorks application instance.
|
||||
/// Use this when you need direct access to the SolidWorks API.
|
||||
|
||||
Reference in New Issue
Block a user