File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ using BlazorState ;
2+ using MediatR ;
3+ using System ;
4+ using System . Threading ;
5+ using System . Threading . Tasks ;
6+
7+ namespace Blazor . AdminLte
8+ {
9+ public partial class SideBarState : State < SideBarState >
10+ {
11+ public string ActiveMenu { get ; set ; }
12+
13+ public NavLinkState GetState ( string item )
14+ {
15+ if ( item == ActiveMenu )
16+ return NavLinkState . Active ;
17+ else
18+ return NavLinkState . Inactive ;
19+ }
20+
21+ public override void Initialize ( )
22+ {
23+
24+ }
25+
26+ public class SelectMenuItemAction : IAction
27+ {
28+ public string Id { get ; set ; }
29+ }
30+
31+ public class SelectMenuItemHandler : ActionHandler < SelectMenuItemAction >
32+ {
33+ public SelectMenuItemHandler ( IStore aStore ) : base ( aStore ) { }
34+
35+ SideBarState State => Store . GetState < SideBarState > ( ) ;
36+ public override Task < Unit > Handle ( SelectMenuItemAction aAction , CancellationToken aCancellationToken )
37+ {
38+ State . ActiveMenu = aAction . Id ;
39+ return Unit . Task ;
40+ }
41+ }
42+ }
43+ }
You can’t perform that action at this time.
0 commit comments