@using System.Text.Json;
@using System.Text.Json.Nodes;
@using Oqtane.Shared;
@if (string.IsNullOrEmpty(message))
{
}
else
{
@message
}
@code {
Type ComponentType = Type.GetType("Oqtane.UI.Routes, Oqtane.Client");
private IDictionary Parameters { get; set; }
private string message = "";
protected override void OnInitialized()
{
Parameters = new Dictionary();
Parameters.Add(new KeyValuePair("RenderMode", RenderModes.Interactive));
Parameters.Add(new KeyValuePair("Runtime", Runtimes.Hybrid));
Parameters.Add(new KeyValuePair("Platform", DeviceInfo.Current.Platform.ToString()));
if (MauiConstants.UseAppSettings)
{
string file = Path.Combine(FileSystem.Current.AppDataDirectory, "appsettings.json");
if (File.Exists(file))
{
using FileStream stream = File.OpenRead(file);
using StreamReader reader = new StreamReader(stream);
var content = reader.ReadToEnd();
var obj = JsonSerializer.Deserialize(content)!;
if (string.IsNullOrEmpty((string)obj["Url"]) && string.IsNullOrEmpty(MauiConstants.ApiUrl))
{
message = "You Must Set The Url In Either MauiConstants.cs Or " + file;
}
}
}
else
{
if (string.IsNullOrEmpty(MauiConstants.ApiUrl))
{
message = "You Must Set The Url In MauiConstants.cs";
}
}
}
}