AI-Studio/app/MindWork AI Studio/Components/Layout/MainLayout.razor.cs

30 lines
911 B
C#
Raw Normal View History

2024-04-19 19:25:44 +00:00
using AIStudio.Settings;
using Microsoft.AspNetCore.Components;
2024-04-05 14:16:33 +00:00
namespace AIStudio.Components.Layout;
public partial class MainLayout : LayoutComponentBase
2024-04-05 14:16:33 +00:00
{
[Inject]
private IJSRuntime JsRuntime { get; set; } = null!;
2024-04-05 14:16:33 +00:00
#region Overrides of ComponentBase
protected override async Task OnInitializedAsync()
{
2024-05-04 08:55:00 +00:00
//
// We use the Tauri API (Rust) to get the data and config directories
// for this app.
//
var dataDir = await this.JsRuntime.InvokeAsync<string>("window.__TAURI__.path.appLocalDataDir");
var configDir = await this.JsRuntime.InvokeAsync<string>("window.__TAURI__.path.appConfigDir");
2024-05-04 08:55:00 +00:00
// Store the directories in the settings manager:
SettingsManager.ConfigDirectory = configDir;
SettingsManager.DataDirectory = dataDir;
2024-04-05 14:16:33 +00:00
await base.OnInitializedAsync();
}
#endregion
}