File tree Expand file tree Collapse file tree 3 files changed +81
-1
lines changed
src/BootstrapBlazor.Server/Components/Samples/Tutorials/OnlineSheet Expand file tree Collapse file tree 3 files changed +81
-1
lines changed Original file line number Diff line number Diff line change 1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the Apache 2.0 License
3+ // See the LICENSE file in the project root for more information.
4+ // Maintainer: Argo Zhang([email protected] ) Website: https://www.blazor.zone 5+
6+ namespace BootstrapBlazor . Server . Components . Samples . Tutorials ;
7+
8+ /// <summary>
9+ /// Contributor
10+ /// </summary>
11+ public sealed class Contributor
12+ {
13+ /// <summary>
14+ /// Gets or sets Name
15+ /// </summary>
16+ public string ? Name { get ; set ; }
17+
18+ /// <summary>
19+ /// Gets or sets Avatar
20+ /// </summary>
21+ public string ? Avatar { get ; set ; }
22+
23+ /// <summary>
24+ /// Gets or sets Description
25+ /// </summary>
26+ public string ? Description { get ; set ; }
27+
28+ /// <summary>
29+ /// Gets or sets Sheet data
30+ /// </summary>
31+ public UniverSheetData ? Data { get ; set ; }
32+ }
Original file line number Diff line number Diff line change 1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the Apache 2.0 License
3+ // See the LICENSE file in the project root for more information.
4+ // Maintainer: Argo Zhang([email protected] ) Website: https://www.blazor.zone 5+
6+ namespace BootstrapBlazor . Server . Components . Samples . Tutorials ;
7+
8+ static class MockOnlineContributor
9+ {
10+ public static void Trigger ( IDispatchService < Contributor > dispatchService )
11+ {
12+ dispatchService . Dispatch ( new DispatchEntry < Contributor > ( )
13+ {
14+ Name = "OnlineSheet-Demo" ,
15+ Entry = new Contributor ( )
16+ {
17+ Name = "Argo Zhang" ,
18+ Avatar = "/images/Argo-C.png" ,
19+ Description = "正在更新单元格 A8" ,
20+ Data = new UniverSheetData ( )
21+ {
22+ CommandName = "UpdateRange" ,
23+ Data = new
24+ {
25+ Range = "A8" ,
26+ Value = $ "{ DateTime . Now : yyyy-MM-dd HH:mm:ss} Argo 更新此单元格"
27+ }
28+ }
29+ }
30+ } ) ;
31+ }
32+ }
Original file line number Diff line number Diff line change @@ -49,6 +49,22 @@ protected override void OnInitialized()
4949 }
5050 }
5151
52+ /// <summary>
53+ /// <inheritdoc/>
54+ /// </summary>
55+ /// <param name="firstRender"></param>
56+ /// <returns></returns>
57+ protected override async Task OnAfterRenderAsync ( bool firstRender )
58+ {
59+ await base . OnAfterRenderAsync ( firstRender ) ;
60+
61+ if ( firstRender )
62+ {
63+ await Task . Delay ( 5000 ) ;
64+ MockOnlineContributor . Trigger ( DispatchService ) ;
65+ }
66+ }
67+
5268 private async Task OnReadyAsync ( )
5369 {
5470 _inited = true ;
@@ -63,7 +79,7 @@ private async Task Dispatch(DispatchEntry<Contributor> entry)
6379 return ;
6480 }
6581
66- if ( entry . Entry != null )
82+ if ( entry is { Name : "OnlineSheet-Demo" , Entry : not null } )
6783 {
6884 await ToastService . Show ( new ToastOption ( )
6985 {
You can’t perform that action at this time.
0 commit comments