コード例 #1
0
ファイル: Route.cs プロジェクト: hez2010/BlazorRouter
        protected override void OnInitialized()
        {
            base.OnInitialized();
            if (SwitchInstance == null)
            {
                throw new InvalidOperationException("A Route markup must be nested in a Switch markup.");
            }

            SwitchInstance.RegisterRoute(id, ChildContent, Template);
        }
コード例 #2
0
 protected override Task OnParametersSetAsync()
 {
     if (!hasRegisterd)
     {
         hasRegisterd = true;
         base.OnParametersSetAsync();
         if (SwitchInstance == null)
         {
             throw new InvalidOperationException("A Route markup must be included in a Switch markup.");
         }
         return(SwitchInstance.RegisterRoute(ChildContent, Template, MatchChildren));
     }
     return(Task.CompletedTask);
 }