只有当流程图执行异常时,才显示强调色

This commit is contained in:
zhengxuan.zhang
2026-04-23 17:33:12 +08:00
parent 24e0489cde
commit c9c0d93d8a
2 changed files with 22 additions and 23 deletions
@@ -205,7 +205,7 @@ namespace XplorePlane.ViewModels
if (string.IsNullOrWhiteSpace(operatorKey)) if (string.IsNullOrWhiteSpace(operatorKey))
{ {
StatusMessage = "算子键不能为空"; SetInfoStatus("算子键不能为空");
_logger.Warn("AddOperator 失败:operatorKey 为空"); _logger.Warn("AddOperator 失败:operatorKey 为空");
return; return;
} }
@@ -216,14 +216,14 @@ namespace XplorePlane.ViewModels
if (!available.Contains(operatorKey)) if (!available.Contains(operatorKey))
{ {
StatusMessage = $"算子 '{operatorKey}' 未注册"; SetInfoStatus($"算子 '{operatorKey}' 未注册");
_logger.Warn("AddOperator 失败:算子 {Key} 未注册", operatorKey); _logger.Warn("AddOperator 失败:算子 {Key} 未注册", operatorKey);
return; return;
} }
if (PipelineNodes.Count >= MaxPipelineLength) if (PipelineNodes.Count >= MaxPipelineLength)
{ {
StatusMessage = $"流水线节点数已达上限({MaxPipelineLength}"; SetInfoStatus($"流水线节点数已达上限({MaxPipelineLength}");
_logger.Warn("AddOperator 失败:节点数已达上限 {Max}", MaxPipelineLength); _logger.Warn("AddOperator 失败:节点数已达上限 {Max}", MaxPipelineLength);
return; return;
} }
@@ -239,7 +239,7 @@ namespace XplorePlane.ViewModels
SelectedNode = node; SelectedNode = node;
_logger.Info("节点已添加到 PipelineNodes{Key} ({DisplayName}),当前节点数={Count}", _logger.Info("节点已添加到 PipelineNodes{Key} ({DisplayName}),当前节点数={Count}",
operatorKey, displayName, PipelineNodes.Count); operatorKey, displayName, PipelineNodes.Count);
StatusMessage = $"已添加算子:{displayName}"; SetInfoStatus($"已添加算子:{displayName}");
TriggerDebouncedExecution(); TriggerDebouncedExecution();
} }
@@ -252,7 +252,7 @@ namespace XplorePlane.ViewModels
RenumberNodes(); RenumberNodes();
SelectNeighborAfterRemoval(removedIndex); SelectNeighborAfterRemoval(removedIndex);
StatusMessage = $"已移除算子:{node.DisplayName}"; SetInfoStatus($"已移除算子:{node.DisplayName}");
TriggerDebouncedExecution(); TriggerDebouncedExecution();
} }
@@ -291,7 +291,7 @@ namespace XplorePlane.ViewModels
PipelineNodes.Insert(newIndex, node); PipelineNodes.Insert(newIndex, node);
RenumberNodes(); RenumberNodes();
SelectedNode = node; SelectedNode = node;
StatusMessage = $"已调整算子顺序:{node.DisplayName}"; SetInfoStatus($"已调整算子顺序:{node.DisplayName}");
TriggerDebouncedExecution(); TriggerDebouncedExecution();
} }
@@ -301,9 +301,9 @@ namespace XplorePlane.ViewModels
node.IsEnabled = !node.IsEnabled; node.IsEnabled = !node.IsEnabled;
SelectedNode = node; SelectedNode = node;
StatusMessage = node.IsEnabled SetInfoStatus(node.IsEnabled
? $"已启用算子:{node.DisplayName}" ? $"已启用算子:{node.DisplayName}"
: $"已停用算子:{node.DisplayName}"; : $"已停用算子:{node.DisplayName}");
TriggerDebouncedExecution(); TriggerDebouncedExecution();
} }
@@ -446,7 +446,7 @@ namespace XplorePlane.ViewModels
} }
catch (Exception ex) catch (Exception ex)
{ {
StatusMessage = $"加载图像失败:{ex.Message}"; SetErrorStatus($"加载图像失败:{ex.Message}");
_logger.Error(ex, "加载图像失败:{Path}", dialog.FileName); _logger.Error(ex, "加载图像失败:{Path}", dialog.FileName);
} }
} }
@@ -465,7 +465,7 @@ namespace XplorePlane.ViewModels
SourceImage = bitmap; SourceImage = bitmap;
PreviewImage = bitmap; PreviewImage = bitmap;
StatusMessage = $"已加载图像:{Path.GetFileName(filePath)}"; SetInfoStatus($"已加载图像:{Path.GetFileName(filePath)}");
PublishManualImageLoaded(bitmap, filePath); PublishManualImageLoaded(bitmap, filePath);
} }
@@ -476,7 +476,7 @@ namespace XplorePlane.ViewModels
SourceImage = bitmap; SourceImage = bitmap;
PreviewImage = bitmap; PreviewImage = bitmap;
StatusMessage = $"已加载图像:{Path.GetFileName(filePath)}"; SetInfoStatus($"已加载图像:{Path.GetFileName(filePath)}");
PublishManualImageLoaded(bitmap, filePath); PublishManualImageLoaded(bitmap, filePath);
if (runPipeline) if (runPipeline)
@@ -504,7 +504,7 @@ namespace XplorePlane.ViewModels
SourceImage = payload.Image; SourceImage = payload.Image;
PreviewImage = payload.Image; PreviewImage = payload.Image;
StatusMessage = $"已加载图像:{payload.FileName}"; SetInfoStatus($"已加载图像:{payload.FileName}");
} }
private void CancelExecution() private void CancelExecution()
@@ -535,14 +535,14 @@ namespace XplorePlane.ViewModels
PreviewImage = null; PreviewImage = null;
_currentFilePath = null; _currentFilePath = null;
PipelineFileDisplayName = DefaultPipelineFileDisplayName; PipelineFileDisplayName = DefaultPipelineFileDisplayName;
StatusMessage = "已新建流水线"; SetInfoStatus("已新建流水线");
} }
private async Task SavePipelineAsync() private async Task SavePipelineAsync()
{ {
if (string.IsNullOrWhiteSpace(PipelineName) || PipelineName.Length > 100) if (string.IsNullOrWhiteSpace(PipelineName) || PipelineName.Length > 100)
{ {
StatusMessage = "流水线名称不能为空且长度不超过 100 个字符"; SetInfoStatus("流水线名称不能为空且长度不超过 100 个字符");
return; return;
} }
@@ -559,7 +559,7 @@ namespace XplorePlane.ViewModels
{ {
if (string.IsNullOrWhiteSpace(PipelineName) || PipelineName.Length > 100) if (string.IsNullOrWhiteSpace(PipelineName) || PipelineName.Length > 100)
{ {
StatusMessage = "流水线名称不能为空且长度不超过 100 个字符"; SetInfoStatus("流水线名称不能为空且长度不超过 100 个字符");
return; return;
} }
@@ -586,11 +586,11 @@ namespace XplorePlane.ViewModels
var model = BuildPipelineModel(); var model = BuildPipelineModel();
await _persistenceService.SaveAsync(model, filePath); await _persistenceService.SaveAsync(model, filePath);
PipelineFileDisplayName = FormatPipelinePath(filePath); PipelineFileDisplayName = FormatPipelinePath(filePath);
StatusMessage = $"流水线已保存:{Path.GetFileName(filePath)}"; SetInfoStatus($"流水线已保存:{Path.GetFileName(filePath)}");
} }
catch (IOException ex) catch (IOException ex)
{ {
StatusMessage = $"保存失败:{ex.Message}"; SetErrorStatus($"保存失败:{ex.Message}");
} }
} }
@@ -604,11 +604,11 @@ namespace XplorePlane.ViewModels
File.Delete(_currentFilePath); File.Delete(_currentFilePath);
NewPipeline(); NewPipeline();
StatusMessage = "流水线已删除"; SetInfoStatus("流水线已删除");
} }
catch (IOException ex) catch (IOException ex)
{ {
StatusMessage = $"删除失败:{ex.Message}"; SetErrorStatus($"删除失败:{ex.Message}");
} }
await Task.CompletedTask; await Task.CompletedTask;
} }
@@ -659,12 +659,12 @@ namespace XplorePlane.ViewModels
} }
_logger.Info("流水线已加载:{Name},节点数={Count}", model.Name, PipelineNodes.Count); _logger.Info("流水线已加载:{Name},节点数={Count}", model.Name, PipelineNodes.Count);
StatusMessage = $"已加载流水线:{model.Name}{PipelineNodes.Count} 个节点)"; SetInfoStatus($"已加载流水线:{model.Name}{PipelineNodes.Count} 个节点)");
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Warn("加载流水线失败:{Error}", ex.Message); _logger.Warn("加载流水线失败:{Error}", ex.Message);
StatusMessage = $"加载失败:{ex.Message}"; SetErrorStatus($"加载失败:{ex.Message}");
} }
} }
@@ -289,8 +289,7 @@
<Setter Property="Visibility" Value="Collapsed" /> <Setter Property="Visibility" Value="Collapsed" />
</DataTrigger> </DataTrigger>
<DataTrigger Binding="{Binding IsValueValid}" Value="False"> <DataTrigger Binding="{Binding IsValueValid}" Value="False">
<Setter Property="BorderBrush" Value="Red" /> <Setter Property="BorderBrush" Value="#D9534F" />
<Setter Property="Background" Value="#FFF0F0" />
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>