improved method for determining Runtime in SiteRouter
This commit is contained in:
		| @ -15,7 +15,7 @@ | ||||
|             { | ||||
|                 <CascadingAuthenticationState> | ||||
|                     <CascadingValue Value="@PageState"> | ||||
|                         <SiteRouter OnStateChange="@ChangeState" /> | ||||
|                         <SiteRouter Runtime="@Runtime" OnStateChange="@ChangeState" /> | ||||
|                     </CascadingValue> | ||||
|                 </CascadingAuthenticationState> | ||||
|             } | ||||
|  | ||||
| @ -1,5 +1,4 @@ | ||||
| @using System.Diagnostics.CodeAnalysis | ||||
| @using System.Runtime.InteropServices | ||||
| @namespace Oqtane.UI | ||||
| @inject AuthenticationStateProvider AuthenticationStateProvider | ||||
| @inject SiteState SiteState | ||||
| @ -16,11 +15,13 @@ | ||||
| @DynamicComponent | ||||
|  | ||||
| @code { | ||||
|  | ||||
|     private string _absoluteUri; | ||||
|     private bool _navigationInterceptionEnabled; | ||||
|     private PageState _pagestate; | ||||
|  | ||||
|     [Parameter] | ||||
|     public string Runtime { get; set; } | ||||
|  | ||||
|     [CascadingParameter] | ||||
|     PageState PageState { get; set; } | ||||
|  | ||||
| @ -71,7 +72,7 @@ | ||||
|         var editmode = false; | ||||
|         var refresh = UI.Refresh.None; | ||||
|         var lastsyncdate = DateTime.UtcNow.AddHours(-1); | ||||
|         var runtime = GetRuntime(); | ||||
|         var runtime = (Shared.Runtime)Enum.Parse(typeof(Shared.Runtime), Runtime); | ||||
|  | ||||
|         Uri uri = new Uri(_absoluteUri); | ||||
|  | ||||
| @ -426,7 +427,7 @@ | ||||
|             if ((module.PageId == page.PageId || module.ModuleId == moduleid)) | ||||
|             { | ||||
|                 var typename = Constants.ErrorModule; | ||||
|                 if (module.ModuleDefinition != null && (module.ModuleDefinition.Runtimes == "" || module.ModuleDefinition.Runtimes.Contains(GetRuntime().ToString()))) | ||||
|                 if (module.ModuleDefinition != null && (module.ModuleDefinition.Runtimes == "" || module.ModuleDefinition.Runtimes.Contains(Runtime))) | ||||
|                 { | ||||
|                     typename = module.ModuleDefinition.ControlTypeTemplate; | ||||
|  | ||||
| @ -544,10 +545,4 @@ | ||||
|         } | ||||
|         return pageresources; | ||||
|     } | ||||
|  | ||||
|     private Oqtane.Shared.Runtime GetRuntime() | ||||
| => RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")) | ||||
|         ? Oqtane.Shared.Runtime.WebAssembly | ||||
|         : Oqtane.Shared.Runtime.Server; | ||||
|  | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shaun Walker
					Shaun Walker