重新录制确认后等待手动开始录像
This commit is contained in:
parent
0596727b74
commit
94d968e658
@ -234,8 +234,9 @@ public sealed class CameraViewModel : BindableBase
|
||||
throw new IOException("SOP录像路径不在当前配方目录中");
|
||||
File.Delete(StandardVideoPath);
|
||||
LastRecording = "";
|
||||
RecordingInfo = "未录像";
|
||||
Status = "已清除旧视频,请点击“开始录像”进行重新录制";
|
||||
StateChanged();
|
||||
await StartRecordingAsync();
|
||||
}
|
||||
private void StopRecording()
|
||||
{
|
||||
|
||||
@ -54,7 +54,7 @@ public partial class RecipeEditor : UserControl
|
||||
UnbindRecording();
|
||||
_recording = _model?.SopRecording;
|
||||
if (_recording is null) return;
|
||||
_recording.ConfirmRestartAsync = () => ShowNotice("确认重新录制", "重新录制将删除当前配方已有的SOP流程视频,删除后无法恢复。是否删除旧视频并立即重新录制?", true);
|
||||
_recording.ConfirmRestartAsync = () => ShowNotice("确认重新录制", "重新录制将删除当前配方已有的SOP流程视频,删除后无法恢复。确认后请点击“开始录像”进行录制。是否删除旧视频?", true);
|
||||
_recording.RecordingLimitReached += RecordingLimit;
|
||||
}
|
||||
private async void RecordingLimit(string message) => await ShowNotice("录像时长提示", message, false);
|
||||
@ -77,7 +77,7 @@ public partial class RecipeEditor : UserControl
|
||||
{
|
||||
if (_closing || _dialog is not null || TopLevel.GetTopLevel(this) is not Window owner) return false;
|
||||
var actions = new StackPanel { Orientation = Avalonia.Layout.Orientation.Horizontal, HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Right, Spacing = 8 };
|
||||
var accept = new Button { Content = confirmation ? "删除旧视频并重新录制" : "确定", IsDefault = !confirmation };
|
||||
var accept = new Button { Content = confirmation ? "删除旧视频" : "确定", IsDefault = !confirmation };
|
||||
var dialog = new Window { Title = title, Width = 480, SizeToContent = SizeToContent.Height, CanResize = false, WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
||||
Content = new StackPanel { Margin = new Avalonia.Thickness(20), Spacing = 18, Children = { new TextBlock { Text = message, TextWrapping = Avalonia.Media.TextWrapping.Wrap }, actions } } };
|
||||
if (confirmation)
|
||||
|
||||
@ -205,7 +205,15 @@ internal static class Program
|
||||
dialog.Close(false); PumpIdle(model);
|
||||
Check(!model.IsRecording && File.ReadAllBytes(expectedPath).SequenceEqual(original), "Cancelling confirmation preserves the old video exactly");
|
||||
model.RestartCommand.Execute(); FindSopDialog(editor).Close(true); PumpIdle(model);
|
||||
Check(model.IsRecording && model.LastRecording == expectedPath, "Confirming starts a new recording at the standard path");
|
||||
Check(!model.IsRecording && !model.IsPaused && model.IsPreviewing && model.LastRecording == ""
|
||||
&& !File.Exists(expectedPath) && model.RecordingInfo == "未录像",
|
||||
"Confirming re-record clears the old video and waits in preview without recording");
|
||||
Check(model.StartRecordingCommand.CanExecute() && !model.RestartCommand.CanExecute(),
|
||||
"Re-record enables manual start and disables replacement until a video exists");
|
||||
clock.Advance(TimeSpan.FromSeconds(1)); camera.Emit(); Dispatcher.UIThread.RunJobs();
|
||||
Check(!File.Exists(expectedPath) && !model.IsRecording, "Preview frames do not start a replacement recording");
|
||||
model.StartRecordingCommand.Execute(); PumpIdle(model);
|
||||
Check(model.IsRecording && model.LastRecording == expectedPath, "Manual start creates the replacement at the standard path");
|
||||
Check(Directory.GetFiles(Path.GetDirectoryName(expectedPath)!, "*.avi").Length == 1, "Re-recording keeps only one standard video");
|
||||
clock.Advance(TimeSpan.FromMilliseconds(500)); camera.Emit();
|
||||
model.RestartCommand.Execute();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user