@ -8,6 +8,8 @@
|
|||||||
@using Microsoft.AspNetCore.Components.Routing
|
@using Microsoft.AspNetCore.Components.Routing
|
||||||
@inject SiteState SiteState
|
@inject SiteState SiteState
|
||||||
@inject IUriHelper UriHelper
|
@inject IUriHelper UriHelper
|
||||||
|
@inject INavigationInterception NavigationInterception
|
||||||
|
@inject IComponentContext ComponentContext
|
||||||
@inject IJSRuntime jsRuntime
|
@inject IJSRuntime jsRuntime
|
||||||
@inject IAliasService AliasService
|
@inject IAliasService AliasService
|
||||||
@inject ITenantService TenantService
|
@inject ITenantService TenantService
|
||||||
@ -17,21 +19,24 @@
|
|||||||
@inject IModuleService ModuleService
|
@inject IModuleService ModuleService
|
||||||
@inject IModuleDefinitionService ModuleDefinitionService
|
@inject IModuleDefinitionService ModuleDefinitionService
|
||||||
@inject IThemeService ThemeService
|
@inject IThemeService ThemeService
|
||||||
|
@implements IHandleAfterRender
|
||||||
|
|
||||||
@DynamicComponent
|
@DynamicComponent
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
||||||
[CascadingParameter] PageState PageState { get; set; }
|
[CascadingParameter] PageState PageState { get; set; }
|
||||||
|
|
||||||
[Parameter] Action<PageState> OnStateChange { get; set; }
|
[Parameter] Action<PageState> OnStateChange { get; set; }
|
||||||
|
|
||||||
RenderFragment DynamicComponent { get; set; }
|
PageState pagestate;
|
||||||
private string _absoluteUri;
|
RenderFragment DynamicComponent { get; set; }
|
||||||
PageState pagestate;
|
|
||||||
|
|
||||||
protected override void OnInit()
|
string _absoluteUri;
|
||||||
{
|
bool _navigationInterceptionEnabled;
|
||||||
|
|
||||||
|
protected override void OnInit()
|
||||||
|
{
|
||||||
_absoluteUri = UriHelper.GetAbsoluteUri();
|
_absoluteUri = UriHelper.GetAbsoluteUri();
|
||||||
UriHelper.OnLocationChanged += OnLocationChanged;
|
UriHelper.OnLocationChanged += OnLocationChanged;
|
||||||
|
|
||||||
@ -43,23 +48,23 @@
|
|||||||
builder.CloseComponent();
|
builder.CloseComponent();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
UriHelper.OnLocationChanged -= OnLocationChanged;
|
UriHelper.OnLocationChanged -= OnLocationChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
if (PageState == null)
|
if (PageState == null)
|
||||||
{
|
{
|
||||||
await Refresh();
|
await Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Refresh()
|
private async Task Refresh()
|
||||||
{
|
{
|
||||||
List<ModuleDefinition> moduledefinitions;
|
List<ModuleDefinition> moduledefinitions;
|
||||||
List<Models.Theme> themes;
|
List<Models.Theme> themes;
|
||||||
List<Alias> aliases;
|
List<Alias> aliases;
|
||||||
@ -235,21 +240,26 @@
|
|||||||
{
|
{
|
||||||
// site does not exist
|
// site does not exist
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void OnLocationChanged(object sender, LocationChangedEventArgs args)
|
private async void OnLocationChanged(object sender, LocationChangedEventArgs args)
|
||||||
{
|
{
|
||||||
_absoluteUri = args.Location;
|
_absoluteUri = args.Location;
|
||||||
await LocationChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task LocationChanged()
|
|
||||||
{
|
|
||||||
await Refresh();
|
await Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<string, string> ParseQueryString(string path)
|
Task IHandleAfterRender.OnAfterRenderAsync()
|
||||||
|
{
|
||||||
|
if (!_navigationInterceptionEnabled && ComponentContext.IsConnected)
|
||||||
{
|
{
|
||||||
|
_navigationInterceptionEnabled = true;
|
||||||
|
return NavigationInterception.EnableNavigationInterceptionAsync();
|
||||||
|
}
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Dictionary<string, string> ParseQueryString(string path)
|
||||||
|
{
|
||||||
Dictionary<string, string> querystring = new Dictionary<string, string>();
|
Dictionary<string, string> querystring = new Dictionary<string, string>();
|
||||||
if (path.IndexOf("?") != -1)
|
if (path.IndexOf("?") != -1)
|
||||||
{
|
{
|
||||||
@ -270,10 +280,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return querystring;
|
return querystring;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Module> ProcessModules(List<Module> modules, List<ModuleDefinition> moduledefinitions, string control, string panes)
|
private List<Module> ProcessModules(List<Module> modules, List<ModuleDefinition> moduledefinitions, string control, string panes)
|
||||||
{
|
{
|
||||||
ModuleDefinition moduledefinition;
|
ModuleDefinition moduledefinition;
|
||||||
|
|
||||||
if (control == "")
|
if (control == "")
|
||||||
@ -325,10 +335,10 @@
|
|||||||
module.PaneModuleCount = paneindex[module.Pane] + 1;
|
module.PaneModuleCount = paneindex[module.Pane] + 1;
|
||||||
}
|
}
|
||||||
return modules;
|
return modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Alias GetAlias(string absoluteUri, List<Alias> aliases)
|
private Alias GetAlias(string absoluteUri, List<Alias> aliases)
|
||||||
{
|
{
|
||||||
|
|
||||||
string aliasname;
|
string aliasname;
|
||||||
Alias alias = null;
|
Alias alias = null;
|
||||||
@ -353,6 +363,6 @@
|
|||||||
}
|
}
|
||||||
alias.Scheme = uri.Scheme;
|
alias.Scheme = uri.Scheme;
|
||||||
return alias;
|
return alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user