File tree Expand file tree Collapse file tree
SpawnDev.MatrixLEDDisplay.Demo/Layout/AppTray Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,16 +5,15 @@ namespace SpawnDev.MatrixLEDDisplay.Demo.Layout.AppTray
55 public partial class AppTrayArea : IDisposable
66 {
77 [ Inject ]
8- AppTrayService TrayIconService { get ; set ; }
8+ AppTrayService TrayIconService { get ; set ; } = default ! ;
99
1010 protected override void OnInitialized ( )
1111 {
1212 TrayIconService . OnStateHasChanged += TrayIconService_OnStateHasChanged ;
13-
1413 }
1514 protected override void OnAfterRender ( bool firstRender )
1615 {
17-
16+ TrayIconService . AfterRender ( firstRender ) ;
1817 }
1918 public void Dispose ( )
2019 {
Original file line number Diff line number Diff line change 1- using System . Collections . ObjectModel ;
1+ using SpawnDev . BlazorJS ;
22
33namespace SpawnDev . MatrixLEDDisplay . Demo . Layout . AppTray
44{
5+ /// <summary>
6+ /// App tray icon service. Usedwith AppTrayArea.razor component
7+ /// </summary>
58 public class AppTrayService
69 {
710 List < AppTrayIcon > _TrayIcons { get ; } = new List < AppTrayIcon > ( ) ;
811 public IEnumerable < AppTrayIcon > TrayIcons => ReverseOrder ? _TrayIcons . AsReadOnly ( ) . Reverse ( ) : _TrayIcons . AsReadOnly ( ) ;
9- public event Action OnStateHasChanged ;
12+ public event Action OnStateHasChanged = default ! ;
1013 public bool ReverseOrder { get ; set ; } = true ;
11- public AppTrayService ( )
14+ public bool IsWindow { get ; }
15+ /// <summary>
16+ /// New instance
17+ /// </summary>
18+ public AppTrayService ( BlazorJSRuntime js )
1219 {
13-
20+ IsWindow = js . IsWindow ;
1421 }
1522 public void Add ( AppTrayIcon trayIcon )
1623 {
@@ -26,5 +33,12 @@ public void StateHasChanged()
2633 {
2734 OnStateHasChanged ? . Invoke ( ) ;
2835 }
36+ public bool FirstRenderFired { get ; private set ; } = false ;
37+ public delegate void AfterRenderDelegate ( bool firstRender ) ;
38+ public event AfterRenderDelegate OnAfterRender = default ! ;
39+ public void AfterRender ( bool firstRender )
40+ {
41+ OnAfterRender ? . Invoke ( firstRender ) ;
42+ }
2943 }
3044}
You can’t perform that action at this time.
0 commit comments