Skip to content

feat(HikVision): remove control buttons#779

Merged
ArgoZhang merged 3 commits intomasterfrom
feat-hik
Dec 4, 2025
Merged

feat(HikVision): remove control buttons#779
ArgoZhang merged 3 commits intomasterfrom
feat-hik

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Dec 4, 2025

Link issues

fixes #778

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Simplify the HikVision component by removing built-in UI controls and exposing configuration and control APIs for embedding and managing the video preview externally.

New Features:

  • Add configurable parameters to the HikVision component for camera connection details and preview dimensions.
  • Expose async login and logout methods on the HikVision component for programmatic session control from .NET code.

Enhancements:

  • Update the HikVision markup and styling to rely on configurable width and height instead of hard-coded preview and control markup.
  • Adjust the HikVision JavaScript to initialize and dispose the video preview by the component root element and re-export core control functions for external use.
  • Remove obsolete sample Component1 files from the HikVision package.

Copilot AI review requested due to automatic review settings December 4, 2025 08:24
@bb-auto bb-auto Bot added the enhancement New feature or request label Dec 4, 2025
@bb-auto bb-auto Bot added this to the v9.2.0 milestone Dec 4, 2025
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Dec 4, 2025

Reviewer's Guide

Refactors the HikVision Blazor component to remove built‑in UI control buttons, expose camera configuration as parameters, add C# login/logout APIs, and simplify the JavaScript interop surface to operate directly on the component root element instead of a nested preview element.

Sequence diagram for the new HikVision camera control flow

sequenceDiagram
    actor User
    participant HostPage as HostPageComponent
    participant HikVision as HikVisionComponent
    participant JS as HikVisionJsModule
    participant Vision as VisionLibrary

    User->>HostPage: Click custom Login button
    HostPage->>HikVision: Login(ip, port, userName, password, loginType)
    HikVision->>JS: login(Id, ip, port, userName, password, loginType)
    JS->>Vision: login(id, ip, port, userName, password, loginType)
    Vision-->>JS: login_result
    JS-->>HikVision: void
    HikVision-->>HostPage: Task completed

    User->>HostPage: Click custom Logout button
    HostPage->>HikVision: Logout()
    HikVision->>JS: logout(Id)
    JS->>Vision: logout(id)
    Vision-->>JS: logout_result
    JS-->>HikVision: void
    HikVision-->>HostPage: Task completed
Loading

Sequence diagram for HikVision component lifecycle with simplified JS interop

sequenceDiagram
    participant HostPage as HostPageComponent
    participant HikVision as HikVisionComponent
    participant JS as HikVisionJsModule
    participant Vision as VisionLibrary

    HostPage->>HikVision: Render(Id, Width, Height)
    HikVision->>JS: init(Id)
    JS->>Vision: initVision(Id)
    Vision-->>JS: initialized
    JS-->>HikVision: void

    HostPage->>HikVision: Component disposed
    HikVision->>JS: dispose(Id)
    JS->>Vision: disposeVision(Id)
    Vision-->>JS: disposed
    JS-->>HikVision: void
Loading

Updated class diagram for HikVision Blazor component

classDiagram
    class BootstrapModuleComponentBase {
    }

    class HikVision {
        +string Ip
        +int Port
        +string UserName
        +string Password
        +LoginType LoginType
        +string Width
        +string Height
        -string ClassString
        -string StyleString
        +HikVision()
        +OnParametersSet() void
        +Login(string ip, string port, string userName, string password, LoginType loginType) Task
        +Logout() Task
    }

    class HikVisionJsModule {
        +init(string id) void
        +dispose(string id) void
        +login(string id, string ip, string port, string userName, string password, int loginType) void
        +logout(string id) void
        +startRealPlay(string id) void
        +stopRealPlay(string id) void
    }

    HikVision --|> BootstrapModuleComponentBase
    HikVision ..> HikVisionJsModule : uses_JS_interop
Loading

File-Level Changes

Change Details Files
Expose HikVision camera configuration and control methods via the Blazor component API instead of hard‑coded demo UI.
  • Add Blazor [Parameter] properties for IP, port (default 80), username, password, login type, and preview width/height.
  • Add computed StyleString based on Width and Height with defaults set in OnParametersSet.
  • Implement public Login and Logout async methods that call corresponding JavaScript functions via InvokeVoidAsync using the component Id.
src/components/BootstrapBlazor.HikVision/Components/HikVision.razor.cs
Simplify JavaScript interop to initialize and dispose the HikVision preview directly on the component element and re-export lower-level control functions.
  • Change init to call initVision with the component id and remove all DOM query logic and click handlers for login/logout/start/stop buttons.
  • Re-export login/logout/startRealPlay/stopRealPlay functions from hikvision.js so they can be invoked from .NET or other JS instead of via DOM events.
  • Simplify dispose to call disposeVision with the component id only, removing event-detach logic and previewId indirection.
src/components/BootstrapBlazor.HikVision/Components/HikVision.razor.js
Remove the built-in control button UI and preview div from the HikVision Razor markup and rely on external layout and styling.
  • Delete internal preview div and login/logout/start/stop buttons markup from the component.
  • Apply computed StyleString directly on the root div so callers can control size via parameters and attributes.
src/components/BootstrapBlazor.HikVision/Components/HikVision.razor
Remove unused sample/demo components from the HikVision package.
  • Delete Component1.razor and its associated CSS file from the project.
src/components/BootstrapBlazor.HikVision/Component1.razor
src/components/BootstrapBlazor.HikVision/Component1.razor.css

Assessment against linked issues

Issue Objective Addressed Explanation
#778 Remove the HikVision component's control buttons from the UI and associated behavior.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ArgoZhang ArgoZhang merged commit 0a57f30 into master Dec 4, 2025
3 of 4 checks passed
@ArgoZhang ArgoZhang deleted the feat-hik branch December 4, 2025 08:24
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and found some issues that need to be addressed.

  • In StyleString you're calling CssBuilder.Default().AddClass(...) with inline style fragments (width/height); this should use AddStyle/AddStyleFromAttributes so the width/height are emitted as CSS styles rather than class names.
  • The new Ip/Port/UserName/Password/LoginType parameters are never used in the component logic; consider either wiring them into the Login flow (e.g., an overload that uses the stored values) or removing them to avoid confusing consumers.
  • The Login method takes port as a string while the component exposes Port as an int; aligning these types will make API usage more consistent and reduce the need for callers to perform conversions.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `StyleString` you're calling `CssBuilder.Default().AddClass(...)` with inline style fragments (width/height); this should use `AddStyle`/`AddStyleFromAttributes` so the width/height are emitted as CSS styles rather than class names.
- The new Ip/Port/UserName/Password/LoginType parameters are never used in the component logic; consider either wiring them into the `Login` flow (e.g., an overload that uses the stored values) or removing them to avoid confusing consumers.
- The `Login` method takes `port` as a `string` while the component exposes `Port` as an `int`; aligning these types will make API usage more consistent and reduce the need for callers to perform conversions.

## Individual Comments

### Comment 1
<location> `src/components/BootstrapBlazor.HikVision/Components/HikVision.razor.cs:18-27` </location>
<code_context>
+    /// <summary>
+    /// 获得/设置 网络摄像机 IP 地址
+    /// </summary>
+    [Parameter]
+    public string? Ip { get; set; }
+
+    /// <summary>
+    /// 获得/设置 网络摄像机 端口号 默认值 80
+    /// </summary>
+    [Parameter]
+    public int Port { get; set; } = 80;
+
+    /// <summary>
+    /// 获得/设置 网络摄像机 登录用户名
+    /// </summary>
+    [Parameter]
+    public string? UserName { get; set; }
+
+    /// <summary>
+    /// 获得/设置 网络摄像机 登录密码
+    /// </summary>
+    [Parameter]
+    public string? Password { get; set; }
+
+    /// <summary>
+    /// 获得/设置 网络摄像机 登录类型 默认值 <see cref="LoginType.Http"/>
+    /// </summary>
+    [Parameter]
+    public LoginType LoginType { get; set; }
+
+    /// <summary>
</code_context>

<issue_to_address>
**issue (bug_risk):** The `LoginType` property is documented as defaulting to `LoginType.Http` but no default value is assigned.

Right now the property just uses the enum’s default (zero) value. If `LoginType.Http` is ever changed to a non-zero value, the actual default will no longer match the documentation. To avoid this, initialize explicitly, e.g. `public LoginType LoginType { get; set; } = LoginType.Http;`.
</issue_to_address>

### Comment 2
<location> `src/components/BootstrapBlazor.HikVision/Components/HikVision.razor.cs:61-59` </location>
<code_context>
         .AddClassFromAttributes(AdditionalAttributes)
         .Build();
+
+    private string? StyleString => CssBuilder.Default()
+        .AddClass($"width: {Width};", !string.IsNullOrEmpty(Width))
+        .AddClass($"height: {Height};", !string.IsNullOrEmpty(Height))
+        .AddStyleFromAttributes(AdditionalAttributes)
+        .Build();
+
+    /// <summary>
</code_context>

<issue_to_address>
**issue (bug_risk):** `CssBuilder` is being used to build an inline style string, which is likely incorrect and may mix classes/styles.

Here `CssBuilder` is used with `AddClass` for `width:`/`height:` and `AddStyleFromAttributes`, then assigned to `style="@StyleString"`. This mixes a class-focused API with inline styles and can produce invalid output, especially when `AdditionalAttributes` includes both `class` and `style`. Consider using the style-specific builder (e.g. `StyleBuilder` with `AddStyle`/`AddStyleFromAttributes`) for `StyleString` instead.
</issue_to_address>

### Comment 3
<location> `src/components/BootstrapBlazor.HikVision/Components/HikVision.razor.cs:87` </location>
<code_context>
+    /// <param name="password"></param>
+    /// <param name="loginType"></param>
+    /// <returns></returns>
+    public async Task Login(string ip, string port, string userName, string password, LoginType loginType = LoginType.Http)
+    {
+        await InvokeVoidAsync("login", Id, ip, port, userName, password, (int)loginType);
</code_context>

<issue_to_address>
**suggestion:** The `port` parameter is a string while the component-level `Port` parameter is an `int`, leading to an inconsistent API surface.

Since `Port` is an `int` on the component, consider making this parameter `int port` as well (or adding an overload that omits `port` and uses the `Port` property), unless the JS interop layer strictly requires a string. This avoids confusion and extra conversions for callers.

Suggested implementation:

```csharp
    /// <summary>
    /// 登录方法
    /// </summary>
    /// <param name="ip">设备 IP 地址</param>
    /// <param name="port">设备端口号</param>
    /// <param name="userName">用户名</param>
    /// <param name="password">密码</param>
    /// <param name="loginType">登录类型</param>
    /// <returns></returns>
    public async Task Login(string ip, int port, string userName, string password, LoginType loginType = LoginType.Http)
    {
        await InvokeVoidAsync("login", Id, ip, port, userName, password, (int)loginType);
    }

    /// <summary>
    /// 使用组件级 Port 属性的登录方法
    /// </summary>
    /// <param name="ip">设备 IP 地址</param>
    /// <param name="userName">用户名</param>
    /// <param name="password">密码</param>
    /// <param name="loginType">登录类型</param>
    /// <returns></returns>
    public async Task Login(string ip, string userName, string password, LoginType loginType = LoginType.Http)
    {
        await Login(ip, Port, userName, password, loginType);
    }

    /// <summary>
    /// 登出方法
    /// </summary>
    /// <returns></returns>
    public async Task Logout()
    {
        await InvokeVoidAsync("logout", Id);
    }

```

1. Ensure the component declares an `int Port { get; set; }` (or similar) property; the new overload depends on it.
2. If the JS `login` function actually requires `port` as a string, adjust the call to `InvokeVoidAsync` to pass `port.ToString(CultureInfo.InvariantCulture)` and add `using System.Globalization;` at the top of the file.
</issue_to_address>

### Comment 4
<location> `src/components/BootstrapBlazor.HikVision/Components/HikVision.razor.js:13` </location>
<code_context>
-            EventHandler.off(controls, 'click');
-        }
-    }
+export { login, logout, startRealPlay, stopRealPlay }

-    const previewId = `${id}_preview`;
</code_context>

<issue_to_address>
**issue (bug_risk):** Exporting `login/logout/startRealPlay/stopRealPlay` without local bindings will cause a module parse/runtime error.

In ES modules, named exports like `export { login }` require `login` (and the others) to exist as local bindings (declared or imported) in this file. If these functions only exist as globals from another script, this export will fail. Either import them into this module or drop the named export and keep using the globals directly.
</issue_to_address>

### Comment 5
<location> `src/components/BootstrapBlazor.HikVision/Components/HikVision.razor:4` </location>
<code_context>
-            <span>停止预览</span>
-        </button>
-    </div>
+<div @attributes="AdditionalAttributes" class="@ClassString" id="@Id" style="@StyleString">
 </div> 
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Binding `StyleString` directly to `style` may double-handle attributes if `StyleString` already incorporates `AdditionalAttributes`.

Because the builder already calls `AddStyleFromAttributes(AdditionalAttributes)`, any `style` entries are incorporated into `StyleString` and then also emitted again via `@attributes="AdditionalAttributes"`. Once the style-building is adjusted, ensure `style` is either filtered out of `AdditionalAttributes` when rendering, or avoid binding both `style` and `@attributes` in a way that duplicates inline styles.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +18 to +27
[Parameter]
public string? Ip { get; set; }

/// <summary>
/// 获得/设置 网络摄像机 端口号 默认值 80
/// </summary>
[Parameter]
public int Port { get; set; } = 80;

/// <summary>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): The LoginType property is documented as defaulting to LoginType.Http but no default value is assigned.

Right now the property just uses the enum’s default (zero) value. If LoginType.Http is ever changed to a non-zero value, the actual default will no longer match the documentation. To avoid this, initialize explicitly, e.g. public LoginType LoginType { get; set; } = LoginType.Http;.

/// <param name="password"></param>
/// <param name="loginType"></param>
/// <returns></returns>
public async Task Login(string ip, string port, string userName, string password, LoginType loginType = LoginType.Http)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: The port parameter is a string while the component-level Port parameter is an int, leading to an inconsistent API surface.

Since Port is an int on the component, consider making this parameter int port as well (or adding an overload that omits port and uses the Port property), unless the JS interop layer strictly requires a string. This avoids confusion and extra conversions for callers.

Suggested implementation:

    /// <summary>
    /// 登录方法
    /// </summary>
    /// <param name="ip">设备 IP 地址</param>
    /// <param name="port">设备端口号</param>
    /// <param name="userName">用户名</param>
    /// <param name="password">密码</param>
    /// <param name="loginType">登录类型</param>
    /// <returns></returns>
    public async Task Login(string ip, int port, string userName, string password, LoginType loginType = LoginType.Http)
    {
        await InvokeVoidAsync("login", Id, ip, port, userName, password, (int)loginType);
    }

    /// <summary>
    /// 使用组件级 Port 属性的登录方法
    /// </summary>
    /// <param name="ip">设备 IP 地址</param>
    /// <param name="userName">用户名</param>
    /// <param name="password">密码</param>
    /// <param name="loginType">登录类型</param>
    /// <returns></returns>
    public async Task Login(string ip, string userName, string password, LoginType loginType = LoginType.Http)
    {
        await Login(ip, Port, userName, password, loginType);
    }

    /// <summary>
    /// 登出方法
    /// </summary>
    /// <returns></returns>
    public async Task Logout()
    {
        await InvokeVoidAsync("logout", Id);
    }
  1. Ensure the component declares an int Port { get; set; } (or similar) property; the new overload depends on it.
  2. If the JS login function actually requires port as a string, adjust the call to InvokeVoidAsync to pass port.ToString(CultureInfo.InvariantCulture) and add using System.Globalization; at the top of the file.

EventHandler.off(controls, 'click');
}
}
export { login, logout, startRealPlay, stopRealPlay }
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): Exporting login/logout/startRealPlay/stopRealPlay without local bindings will cause a module parse/runtime error.

In ES modules, named exports like export { login } require login (and the others) to exist as local bindings (declared or imported) in this file. If these functions only exist as globals from another script, this export will fail. Either import them into this module or drop the named export and keep using the globals directly.

Copy link
Copy Markdown

Copilot AI left a 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 refactors the HikVision component by removing hardcoded control buttons from the UI and converting them to programmatic API methods, enabling developers to implement custom control interfaces. The component now exposes parameterized configuration options (IP, port, credentials) and public methods (Login, Logout) for controlling the camera, while the internal preview container structure has been simplified.

  • Removed hardcoded login/logout/start/stop control buttons from the component UI
  • Added component parameters for camera configuration (IP, port, username, password, login type, width, height)
  • Exposed public Login and Logout methods for programmatic control
  • Simplified the preview container by removing nested div structure
  • Cleaned up unused example component files

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
HikVision.razor.js Removed event handlers for control buttons, simplified init/dispose to use component ID directly, exported camera control functions
HikVision.razor.cs Added camera configuration parameters, public Login/Logout methods, and style/size configuration with default values
HikVision.razor Removed control buttons markup, simplified to single div with dynamic styling
Component1.razor Deleted unused example component file
Component1.razor.css Deleted unused example component styles
Comments suppressed due to low confidence (1)

src/components/BootstrapBlazor.HikVision/Components/HikVision.razor.js:2

  • Unused import EventHandler.
import EventHandler from '../../BootstrapBlazor/modules/event-handler.js';

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +62 to +63
.AddClass($"width: {Width};", !string.IsNullOrEmpty(Width))
.AddClass($"height: {Height};", !string.IsNullOrEmpty(Height))
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The AddClass method should not be used to add CSS style properties. Based on the pattern used in other components in this codebase (e.g., AntDesignIcon, ElementIcon), AddClass is only appropriate for CSS custom properties (like --variable-name). For regular CSS properties like width and height, you should build the style string directly without using AddClass. Consider:

private string? StyleString => CssBuilder.Default()
    .AddClass($"width: {Width}; height: {Height};", !string.IsNullOrEmpty(Width) || !string.IsNullOrEmpty(Height))
    .AddStyleFromAttributes(AdditionalAttributes)
    .Build();

Or more simply, construct the style string without CssBuilder for these properties.

Suggested change
.AddClass($"width: {Width};", !string.IsNullOrEmpty(Width))
.AddClass($"height: {Height};", !string.IsNullOrEmpty(Height))
.AddStyle(!string.IsNullOrEmpty(Width) ? $"width: {Width};" : null)
.AddStyle(!string.IsNullOrEmpty(Height) ? $"height: {Height};" : null)

Copilot uses AI. Check for mistakes.
/// <param name="password"></param>
/// <param name="loginType"></param>
/// <returns></returns>
public async Task Login(string ip, string port, string userName, string password, LoginType loginType = LoginType.Http)
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The port parameter type should be int instead of string to match:

  1. The component's Port property which is int (line 25)
  2. The interface IHikVision.Login which expects int port
  3. The service implementation DefaultHicVision.Login which expects int port

This inconsistency will cause type conversion issues when calling this method.

Suggested change
public async Task Login(string ip, string port, string userName, string password, LoginType loginType = LoginType.Http)
public async Task Login(string ip, int port, string userName, string password, LoginType loginType = LoginType.Http)

Copilot uses AI. Check for mistakes.
public async Task Logout()
{
await InvokeVoidAsync("logout", Id);
}
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The JavaScript module exports startRealPlay and stopRealPlay functions (line 13 of HikVision.razor.js), but this component doesn't provide corresponding public C# methods to invoke them. Consider adding:

/// <summary>
/// 开始实时预览画面方法
/// </summary>
/// <returns></returns>
public async Task StartRealPlay()
{
    await InvokeVoidAsync("startRealPlay", Id);
}

/// <summary>
/// 停止实时预览画面方法
/// </summary>
/// <returns></returns>
public async Task StopRealPlay()
{
    await InvokeVoidAsync("stopRealPlay", Id);
}

This would provide a complete API for consumers of the component.

Suggested change
}
}
/// <summary>
/// 开始实时预览画面方法
/// </summary>
/// <returns></returns>
public async Task StartRealPlay()
{
await InvokeVoidAsync("startRealPlay", Id);
}
/// <summary>
/// 停止实时预览画面方法
/// </summary>
/// <returns></returns>
public async Task StopRealPlay()
{
await InvokeVoidAsync("stopRealPlay", Id);
}

Copilot uses AI. Check for mistakes.
Comment on lines +81 to +85
/// <param name="ip"></param>
/// <param name="port"></param>
/// <param name="userName"></param>
/// <param name="password"></param>
/// <param name="loginType"></param>
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The parameter documentation is empty. Consider providing meaningful descriptions for each parameter, for example:

/// <param name="ip">网络摄像机 IP 地址</param>
/// <param name="port">网络摄像机端口号</param>
/// <param name="userName">登录用户名</param>
/// <param name="password">登录密码</param>
/// <param name="loginType">登录类型</param>
Suggested change
/// <param name="ip"></param>
/// <param name="port"></param>
/// <param name="userName"></param>
/// <param name="password"></param>
/// <param name="loginType"></param>
/// <param name="ip">网络摄像机 IP 地址</param>
/// <param name="port">网络摄像机端口号</param>
/// <param name="userName">登录用户名</param>
/// <param name="password">登录密码</param>
/// <param name="loginType">登录类型</param>

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +43
/// <summary>
/// 获得/设置 网络摄像机 IP 地址
/// </summary>
[Parameter]
public string? Ip { get; set; }

/// <summary>
/// 获得/设置 网络摄像机 端口号 默认值 80
/// </summary>
[Parameter]
public int Port { get; set; } = 80;

/// <summary>
/// 获得/设置 网络摄像机 登录用户名
/// </summary>
[Parameter]
public string? UserName { get; set; }

/// <summary>
/// 获得/设置 网络摄像机 登录密码
/// </summary>
[Parameter]
public string? Password { get; set; }

/// <summary>
/// 获得/设置 网络摄像机 登录类型 默认值 <see cref="LoginType.Http"/>
/// </summary>
[Parameter]
public LoginType LoginType { get; set; }
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The component parameters Ip, Port, UserName, Password, and LoginType (lines 15-43) are defined but never used within the component. These parameters appear to be intended for configuration but there's no logic to automatically login with these credentials. Consider either:

  1. Removing these unused parameters if they're not needed
  2. Adding an auto-login feature in OnAfterRenderAsync if auto-login is the intended behavior
  3. Documenting that consumers should use the Login method explicitly with these parameters

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(HikVision): remove control buttons

2 participants