From aefd4ebd76b550c5f5aa447541932f6ea7a05017 Mon Sep 17 00:00:00 2001 From: tfarcraw <123211521@163.com> Date: Thu, 19 Nov 2026 17:34:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E5=8C=BA=E5=9F=9F=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E9=9B=86=E6=88=90=E5=88=B0=E6=AD=A5=E9=AA=A4=E9=A1=B5=E5=B9=B6?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E6=92=AD=E6=94=BE=E6=9A=82=E5=81=9C=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Training/CameraViewModel.cs | 6 ++ .../VVMs/RecipeEditor/RecipeEditor.axaml | 80 +++++++------------ .../RecipeEditor/RecipeEditorViewModel.cs | 20 ++++- .../RecipeEditor/StepKeyFrameViewModel.cs | 7 +- tests/VideoFlowTest.Smoke/Program.cs | 33 +++++++- 5 files changed, 89 insertions(+), 57 deletions(-) diff --git a/src/SopHelper.Avalonia/Training/CameraViewModel.cs b/src/SopHelper.Avalonia/Training/CameraViewModel.cs index f4389b4..87e3b49 100644 --- a/src/SopHelper.Avalonia/Training/CameraViewModel.cs +++ b/src/SopHelper.Avalonia/Training/CameraViewModel.cs @@ -72,6 +72,7 @@ public sealed partial class CameraViewModel : BindableBase public DelegateCommand RestartCommand { get; } public DelegateCommand PlayVideoCommand { get; } public DelegateCommand PauseVideoCommand { get; } + public DelegateCommand ToggleVideoPlaybackCommand { get; } public DelegateCommand StopVideoCommand { get; } public DelegateCommand ImportVideoCommand { get; } public event Action? RecordingLimitReached; @@ -99,6 +100,11 @@ public sealed partial class CameraViewModel : BindableBase RestartCommand = Command(RestartRecordingAsync, () => _sopStandard && !IsBusy && !_closing && !IsTestingFlow && HasStandardVideo && IsPreviewing && Preview != null && HasRecentFrame); PlayVideoCommand = Command(PlayVideoAsync, () => _sopStandard && !IsBusy && !_closing && !IsTestingFlow && !IsRecording && HasStandardVideo && !Playback.IsPlaying); PauseVideoCommand = Command(() => { Playback.Pause(); Status = "视频播放已暂停"; return Task.CompletedTask; }, () => !IsBusy && !_closing && !IsTestingFlow && Playback.IsPlaying); + ToggleVideoPlaybackCommand = Command(async () => + { + if (Playback.IsPlaying) { Playback.Pause(); Status = "视频播放已暂停"; } + else await PlayVideoAsync(); + }, () => _sopStandard && !IsBusy && !_closing && !IsTestingFlow && !IsRecording && HasStandardVideo); ImportVideoCommand = Command(ImportVideoAsync, () => _sopStandard && !IsBusy && !_closing && !IsTestingFlow && !IsRecording); TestFlowCommand = Command(StartFlowTestAsync, () => _sopStandard && !IsBusy && !_closing && !IsTestingFlow && !IsRecording && HasStandardVideo && FlowTestConfigProvider is not null); StopVideoCommand = Command(async () => { await Playback.StopAsync(); EndFlowTest("测试已停止"); Status = "视频播放已停止"; }, () => !IsBusy && !_closing && Playback.IsLoaded); diff --git a/src/SopHelper.Avalonia/VVMs/RecipeEditor/RecipeEditor.axaml b/src/SopHelper.Avalonia/VVMs/RecipeEditor/RecipeEditor.axaml index 25a3791..303ef66 100644 --- a/src/SopHelper.Avalonia/VVMs/RecipeEditor/RecipeEditor.axaml +++ b/src/SopHelper.Avalonia/VVMs/RecipeEditor/RecipeEditor.axaml @@ -301,48 +301,27 @@ - - - - + + + + - - -