Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<PackageReference Include="BootstrapBlazor.FluentSystemIcon" Version="10.0.0" />
<PackageReference Include="BootstrapBlazor.FontAwesome" Version="10.0.0" />
<PackageReference Include="BootstrapBlazor.Gantt" Version="10.0.0" />
<PackageReference Include="BootstrapBlazor.HikVision" Version="10.0.8" />
<PackageReference Include="BootstrapBlazor.HikVision" Version="10.0.9" />
<PackageReference Include="BootstrapBlazor.Holiday" Version="10.0.0" />
<PackageReference Include="BootstrapBlazor.Html2Image" Version="10.0.0" />
<PackageReference Include="BootstrapBlazor.Html2Pdf" Version="10.0.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
<li>由于核心功能均由海康威视 Web 插件提供所有浏览器控制台中会有部分提示或者报错信息均属于正常现象</li>
<li>由海康威视 Web 插件绘制的预览窗口并不是 html dom 元素,所以出现被截断遮挡其他窗口,多屏显示不正确时请刷新浏览器即可</li>
</ul>
<p class="code-label">抓图功能说明:</p>
<ul class="ul-demo">
<li>必须登录并且开始预览后才可以开启抓图功能</li>
<li>抓图后,文件默认存储在插件安装路径文件夹内(C:\Users\[UserName]\HCWebSDKPlugins\CaptureFiles)</li>
<li>组件提供两种抓图方法,<code>CapturePicture</code> 方法直接抓图到本地存储路径;<code>CapturePictureAndDownload</code> 方法抓图后直接弹窗下载文件</li>
</ul>
<p class="code-label">录像功能说明:</p>
<ul class="ul-demo">
<li>必须登录并且开始预览后才可以开启录像功能</li>
Expand Down Expand Up @@ -91,6 +97,9 @@
<Button OnClick="OnCapture" IsDisabled="_stopRealPlayStatus">
<span>抓图</span>
</Button>
<Button OnClick="OnCaptureAndDownload" IsDisabled="_stopRealPlayStatus">
<span>抓图下载</span>
</Button>
<Button OnClick="OnStartRecord" IsDisabled="_startRecordStatus">
<span>开始录像</span>
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,28 @@ private async Task OnCloseSound()

private async Task OnCapture()
{
await _hikVision.CapturePictureAndDownload();
var result = await _hikVision.CapturePicture();
if (result)
{
await ToastService.Success("消息通知", "抓图成功");
}
else
{
await ToastService.Error("消息通知", "抓图失败");
}
}

private async Task OnCaptureAndDownload()
{
var result = await _hikVision.CapturePictureAndDownload();
if (result)
{
await ToastService.Success("消息通知", "抓图成功");
}
else
{
await ToastService.Error("消息通知", "抓图失败");
}
}
Comment on lines 96 to 120
Copy link

Copilot AI Dec 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The success and error handling logic is duplicated between OnCapture and OnCaptureAndDownload methods. Consider extracting this common logic into a helper method that takes the result and action name as parameters, which would improve maintainability and reduce code duplication.

Copilot uses AI. Check for mistakes.

private async Task OnStartRecord()
Expand Down
Loading