oqtane.framework/Oqtane.Client/UI/ContainerBuilder.razor
Pavel Vesely cf6643aef3 Client fixes
Client is partially done.
227 warnings left out of 1500
I like Rider
2020-03-15 15:19:35 +01:00

45 lines
1.3 KiB
Plaintext

@namespace Oqtane.UI
<CascadingValue Value="@_moduleState">
@DynamicComponent
</CascadingValue>
@code {
[CascadingParameter]
protected PageState PageState { get; set; }
[Parameter]
public Module Module { get; set; }
RenderFragment DynamicComponent { get; set; }
Module _moduleState;
protected override void OnParametersSet()
{
_moduleState = Module; // passed in from Pane component
string container = _moduleState.ContainerType;
if (PageState.ModuleId != -1 && PageState.Action != "" && _moduleState.UseAdminContainer)
{
container = Constants.DefaultAdminContainer;
}
DynamicComponent = builder =>
{
Type containerType = Type.GetType(container);
if (containerType != null)
{
builder.OpenComponent(0, containerType);
builder.CloseComponent();
}
else
{
// container does not exist with type specified
builder.OpenComponent(0, Type.GetType(Constants.ModuleMessageComponent));
builder.AddAttribute(1, "Message", "Error Loading Module Container " + container);
builder.CloseComponent();
}
};
}
}