-
-
Notifications
You must be signed in to change notification settings - Fork 372
feat(HikVision): add CapturePicture method #7414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideAdds a separate CapturePicture method usage in the HikVision sample, introduces a new Capture-and-Download button, and updates the demo documentation to explain the two capture modes and their behaviors with toast feedback. Sequence diagram for HikVision capture and capture-download flowssequenceDiagram
actor User
participant Browser
participant HikVisionsComponent
participant HikVisionService
participant ToastService
rect rgb(230,230,250)
User->>Browser: Click Capture button
Browser->>HikVisionsComponent: OnCapture()
HikVisionsComponent->>HikVisionService: CapturePicture()
HikVisionService-->>HikVisionsComponent: result bool
alt capture success
HikVisionsComponent->>ToastService: Success(消息通知, 抓图成功)
else capture failed
HikVisionsComponent->>ToastService: Error(消息通知, 抓图失败)
end
end
rect rgb(220,245,255)
User->>Browser: Click CaptureDownload button
Browser->>HikVisionsComponent: OnCaptureAndDownload()
HikVisionsComponent->>HikVisionService: CapturePictureAndDownload()
HikVisionService-->>HikVisionsComponent: result bool
alt capture download success
HikVisionsComponent->>ToastService: Success(消息通知, 抓图成功)
else capture download failed
HikVisionsComponent->>ToastService: Error(消息通知, 抓图失败)
end
end
Class diagram for updated HikVisions component and HikVision serviceclassDiagram
class HikVisions
HikVisions : bool _stopRealPlayStatus
HikVisions : Task OnCapture()
HikVisions : Task OnCaptureAndDownload()
HikVisions : Task OnStartRecord()
HikVisions : Task OnStopRecord()
class HikVisionService
HikVisionService : Task~bool~ CapturePicture()
HikVisionService : Task~bool~ CapturePictureAndDownload()
class ToastService
ToastService : Task Success(string title, string message)
ToastService : Task Error(string title, string message)
HikVisions --> HikVisionService : uses
HikVisions --> ToastService : uses
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've left some high level feedback:
- The success/error toast handling in
OnCaptureandOnCaptureAndDownloadis duplicated; consider extracting a small helper or reusing a common method that accepts the capture delegate to reduce repetition and keep behavior consistent.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The success/error toast handling in `OnCapture` and `OnCaptureAndDownload` is duplicated; consider extracting a small helper or reusing a common method that accepts the capture delegate to reduce repetition and keep behavior consistent.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7414 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 748 748
Lines 32793 32793
Branches 4551 4551
=========================================
Hits 32793 32793
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new CapturePicture method to the HikVision component, providing users with two distinct options for capturing images: saving directly to local storage or downloading immediately.
Key Changes:
- Separated capture functionality into two methods:
CapturePicture(local storage) andCapturePictureAndDownload(with download prompt) - Added comprehensive documentation explaining both capture methods and their behavior
- Updated the HikVision package dependency to version 10.0.9
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/BootstrapBlazor.Server/Components/Samples/HikVisions.razor.cs | Refactored OnCapture to use the new CapturePicture method and added OnCaptureAndDownload method with success/error notifications |
| src/BootstrapBlazor.Server/Components/Samples/HikVisions.razor | Added documentation explaining the two capture methods and a new "抓图下载" button for the download functionality |
| src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj | Updated BootstrapBlazor.HikVision package reference from version 10.0.8 to 10.0.9 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 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("消息通知", "抓图失败"); | ||
| } | ||
| } |
Copilot
AI
Dec 25, 2025
There was a problem hiding this comment.
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.
Link issues
fixes #7413
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add support in the HikVision sample component for capturing pictures either to the default local storage path or via direct download, with corresponding UI controls and user notifications.
New Features:
Enhancements: