oqtane.framework/Oqtane.Client/Themes/Controls/Mode.razor
Mitchel Sellers f4aa88a529 Change Skin -> Theme
To better align with commonly used terminology in industry renamed all references from Skin -> Theme.
2019-05-12 23:38:58 -05:00

45 lines
941 B
Plaintext

@using Oqtane.Themes
@using Oqtane.Shared;
@using Microsoft.JSInterop
@inject IJSRuntime jsRuntime
@inherits ThemeObjectBase
<button type="button" class="btn btn-primary" onclick="@SetMode">
@displayMode
</button>
@functions {
string displayMode = "";
protected override async Task OnInitAsync()
{
var interop = new Interop(jsRuntime);
string value = await interop.GetCookie("blazor");
if (value == "client")
{
displayMode = "Server Mode";
}
else
{
displayMode = "Client Mode";
}
}
public async void SetMode()
{
var interop = new Interop(jsRuntime);
string mode = await interop.GetCookie("blazor");
if (mode == "client")
{
mode = "server";
}
else
{
mode = "client";
}
await interop.SetCookie("blazor", mode, 7);
}
}