diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs index 7092087e27a..435c9576a69 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the Apache 2.0 License // See the LICENSE file in the project root for more information. // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone @@ -8,24 +8,28 @@ namespace BootstrapBlazor.Components; /// -/// ContextMenu 组件 +/// ContextMenu 组件 +/// A component that represents a context menu. /// public partial class ContextMenu { /// - /// 获得/设置 是否显示阴影 默认 true + /// 获得/设置 是否显示阴影 默认 + /// Flags whether to show a shadow around the context menu. Default is . /// [Parameter] public bool ShowShadow { get; set; } = true; /// - /// 获得/设置 弹出前回调方法 默认 null + /// 获得/设置 弹出前回调方法 默认 null + /// Defines the callback that is executed before showing the context menu. Default is . /// [Parameter] public Func? OnBeforeShowCallback { get; set; } /// - /// 获得/设置 子组件 + /// 获得/设置 子组件 + /// The that represents the child content. /// [Parameter] public RenderFragment? ChildContent { get; set; } @@ -57,9 +61,7 @@ public partial class ContextMenu private object? _contextItem; - /// /// - /// protected override void OnInitialized() { base.OnInitialized(); @@ -67,11 +69,7 @@ protected override void OnInitialized() ContextMenuZone.RegisterContextMenu(this); } - /// /// - /// - /// - /// protected override async Task OnAfterRenderAsync(bool firstRender) { await base.OnAfterRenderAsync(firstRender); @@ -84,11 +82,21 @@ protected override async Task OnAfterRenderAsync(bool firstRender) } /// - /// 弹出 ContextMenu + /// 弹出 ContextMenu + /// Shows the . /// - /// - /// - /// + /// + /// 鼠标事件参数 + /// The that invoked this event. + /// + /// + /// 上下文项 + /// Context that is associated with the clicked . + /// + /// + /// 异步任务 + /// An asynchronous instance of a . + /// internal async Task Show(MouseEventArgs args, object? contextItem) { _contextItem = contextItem; @@ -109,14 +117,22 @@ private async Task OnClickItem(ContextMenuItem item) } /// - /// 增加 ContextMenuItem 方法 + /// 增加 ContextMenuItem 方法 + /// Adds an to the menu. /// - /// + /// + /// 要添加的项 + /// The to add + /// internal void AddItem(IContextMenuItem item) => _contextMenuItems.Add(item); /// - /// 移除 ContextMenuItem 方法 + /// 移除 ContextMenuItem 方法 + /// Removes an from the menu. /// - /// + /// + /// 要移除的项 + /// The to remove + /// internal void RemoveItem(IContextMenuItem item) => _contextMenuItems.Remove(item); } diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs index 821116c6d15..a42e3701984 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the Apache 2.0 License // See the LICENSE file in the project root for more information. // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone @@ -8,7 +8,8 @@ namespace BootstrapBlazor.Components; /// -/// ContextMenuDivider 组件 +/// ContextMenuDivider 组件 +/// A component that defines a menu item as a divider in a context menu. /// public class ContextMenuDivider : Divider, IContextMenuItem, IDisposable { @@ -16,9 +17,7 @@ public class ContextMenuDivider : Divider, IContextMenuItem, IDisposable [NotNull] private ContextMenu? ContextMenu { get; set; } - /// /// - /// protected override void OnInitialized() { base.OnInitialized(); @@ -26,18 +25,19 @@ protected override void OnInitialized() ContextMenu.AddItem(this); } - /// /// - /// - /// protected override void BuildRenderTree(RenderTreeBuilder builder) { } private bool disposedValue; /// - /// 释放资源方法 + /// 释放资源方法 + /// Method to release resources. /// - /// + /// + /// 是否释放托管资源 + /// Flags whether to release managed resources + /// protected virtual void Dispose(bool disposing) { if (!disposedValue) @@ -50,9 +50,7 @@ protected virtual void Dispose(bool disposing) } } - /// /// - /// public void Dispose() { Dispose(disposing: true); diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs index f811f06fe3e..30e22411ccc 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the Apache 2.0 License // See the LICENSE file in the project root for more information. // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone @@ -6,36 +6,47 @@ namespace BootstrapBlazor.Components; /// -/// ContextMenuItem 类 +/// ContextMenuItem 类 +/// A type that represents a menu item in a . /// public class ContextMenuItem : ComponentBase, IContextMenuItem, IDisposable { /// - /// 获得/设置 显示文本 + /// 获得/设置 显示文本 + /// The text to display. /// [Parameter] public string? Text { get; set; } /// - /// 获得/设置 图标 + /// 获得/设置 图标 + /// The CSS class name that represents an icon (if any) /// + /// + /// + /// Icon="fa-solid fa-bookmark" + /// + /// [Parameter] public string? Icon { get; set; } /// - /// 获得/设置 是否被禁用 默认 false 优先级低于 + /// 获得/设置 是否被禁用 默认 false 优先级低于 + /// Flags whether the item is disabled. Default is . It has a lower priority than . /// [Parameter] public bool Disabled { get; set; } /// - /// 获得/设置 是否被禁用回调方法 默认 null 优先级高于 + /// 获得/设置 是否被禁用回调方法 默认 null 优先级高于 + /// Defines the callback to determine if the item is disabled. Default is . It has a higher priority than . /// [Parameter] public Func? OnDisabledCallback { get; set; } /// - /// 获得/设置 点击回调方法 默认 null + /// 获得/设置 点击回调方法 默认 null + /// Defines the click callback. Default is . /// [Parameter] public Func? OnClick { get; set; } @@ -44,9 +55,7 @@ public class ContextMenuItem : ComponentBase, IContextMenuItem, IDisposable [NotNull] private ContextMenu? ContextMenu { get; set; } - /// /// - /// protected override void OnInitialized() { base.OnInitialized(); @@ -57,9 +66,10 @@ protected override void OnInitialized() private bool disposedValue; /// - /// 释放资源方法 + /// 释放资源方法 + /// Method to release resources. /// - /// + /// 是否释放托管资源Whether to release managed resources protected virtual void Dispose(bool disposing) { if (!disposedValue) @@ -72,9 +82,7 @@ protected virtual void Dispose(bool disposing) } } - /// /// - /// public void Dispose() { Dispose(disposing: true); diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuTrigger.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuTrigger.cs index 256731b3533..f378f5b6487 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuTrigger.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuTrigger.cs @@ -9,24 +9,25 @@ namespace BootstrapBlazor.Components; /// -/// ContextMenuTrigger 组件 +/// ContextMenuTrigger 组件 +/// A component that defines a trigger that shows a . /// public class ContextMenuTrigger : BootstrapComponentBase { - /// - /// 获得/设置 子组件 - /// + /// [Parameter] public RenderFragment? ChildContent { get; set; } /// - /// 获得/设置 包裹组件 TagName 默认为 div + /// 获得/设置 包裹组件 TagName 默认为 div + /// The HTML tag name to use for the trigger. Default is <div>. /// [Parameter] public string WrapperTag { get; set; } = "div"; /// - /// 获得/设置 上下文数据 + /// 获得/设置 上下文数据 + /// Gets or sets the context data. /// [Parameter] public object? ContextItem { get; set; } @@ -36,8 +37,8 @@ public class ContextMenuTrigger : BootstrapComponentBase private ContextMenuZone? ContextMenuZone { get; set; } /// - /// The timeout duration for touch events to trigger the context menu (in milliseconds). - /// Default is milliseconds. Must be greater than 0. + /// 触摸事件触发菜单的超时时间(毫秒)。默认值为 毫秒。必须大于 0。 + /// The timeout duration for touch events to trigger the context menu (in milliseconds). Default is milliseconds. Must be greater than 0. /// [Parameter] public int? OnTouchDelay { get; set; } @@ -49,9 +50,7 @@ public class ContextMenuTrigger : BootstrapComponentBase .AddClassFromAttributes(AdditionalAttributes) .Build(); - /// /// - /// protected override void OnParametersSet() { base.OnParametersSet(); @@ -59,10 +58,7 @@ protected override void OnParametersSet() OnTouchDelay ??= Options.CurrentValue.ContextMenuOptions.OnTouchDelay; } - /// /// - /// - /// protected override void BuildRenderTree(RenderTreeBuilder builder) { builder.OpenElement(0, WrapperTag); @@ -77,18 +73,21 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) } /// - /// 点击 ContextMenu 菜单项时触发 + /// 点击 ContextMenu 菜单项时触发 + /// Triggered when a context menu item is clicked. /// [DynamicDependency(DynamicallyAccessedMemberTypes.PublicMethods, typeof(MouseEventArgs))] public Task OnContextMenu(MouseEventArgs args) => ContextMenuZone.OnContextMenu(args, ContextItem); /// - /// 是否触摸 + /// 是否触摸 + /// Indicates whether a touch event is started. /// public bool IsTouchStarted { get; private set; } /// - /// 触摸定时器工作指示 + /// 触摸定时器工作指示 + /// Indicates whether the touch timer is working. /// private bool IsBusy { get; set; } diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuZone.razor.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuZone.razor.cs index b8deed10a9b..e61c5be0eb5 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuZone.razor.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuZone.razor.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the Apache 2.0 License // See the LICENSE file in the project root for more information. // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone @@ -8,13 +8,12 @@ namespace BootstrapBlazor.Components; /// -/// ContextMenuZone 组件 +/// ContextMenuZone 组件 +/// The ContextMenuZone defines the area in the DOM where the context menu can be displayed. /// public partial class ContextMenuZone { - /// - /// 获得/设置 子组件 - /// + /// [Parameter] public RenderFragment? ChildContent { get; set; } @@ -25,11 +24,12 @@ public partial class ContextMenuZone .Build(); /// - /// Trigger 调用 + /// Trigger 调用 + /// Trigger call /// - /// - /// - /// + /// 鼠标事件参数Mouse event arguments + /// 上下文项Context item + /// 异步任务An asynchronous task internal async Task OnContextMenu(MouseEventArgs args, object? contextItem) { // 弹出关联菜单 @@ -40,8 +40,12 @@ internal async Task OnContextMenu(MouseEventArgs args, object? contextItem) } /// - /// ContextMenu 组件调用 + /// ContextMenu 组件调用 + /// Registers a with this zone. /// - /// + /// + /// 要注册的 ContextMenu 组件 + /// The to register + /// internal void RegisterContextMenu(ContextMenu contextMenu) => _contextMenu = contextMenu; } diff --git a/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs b/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs index 3031c4429ed..756b415f446 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs @@ -1,13 +1,17 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the Apache 2.0 License // See the LICENSE file in the project root for more information. // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone +using static System.Net.WebRequestMethods; + namespace BootstrapBlazor.Components; /// -/// IContextMenuItem 接口 +/// IContextMenuItem 接口 +/// The interface for a menu item in a context menu. /// +/// This is a marker interface. public interface IContextMenuItem {