Config for the desktop app
All checks were successful
Build App / Build (push) Successful in 1m28s

This commit is contained in:
2024-03-16 13:38:46 +01:00
parent ede8ff088c
commit 88fb4935b5
5 changed files with 36 additions and 16 deletions

View File

@@ -23,6 +23,8 @@
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.10"/>
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.10"/>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
</ItemGroup>
@@ -30,4 +32,11 @@
<ProjectReference Include="..\LaDOSE.DTO\LaDOSE.DTO.csproj" />
<ProjectReference Include="..\LaDOSE.REST\LaDOSE.REST.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -2,7 +2,9 @@
using Avalonia.ReactiveUI;
using System;
using System.ComponentModel;
using System.IO;
using LaDOSE.REST;
using Microsoft.Extensions.Configuration;
using Splat;
// using Xilium.CefGlue;
// using Xilium.CefGlue.Common;
@@ -26,10 +28,15 @@ sealed class Program
private static void RegisterDependencies(IMutableDependencyResolver currentMutable, IReadonlyDependencyResolver current)
{
var builder = new ConfigurationBuilder()
.AddJsonFile("settings.json", optional: true, reloadOnChange: true).Build();
var restUrl = builder["REST:Url"].ToString();
var restUser = builder["REST:User"].ToString();
var restPassword = builder["REST:Password"].ToString();
currentMutable.RegisterLazySingleton<RestService>(()=>
{
var restService = new RestService();
restService.Connect(new Uri("http://localhost:5000"),"dev","dev");
restService.Connect(new Uri(restUrl),restUser,restPassword);
return restService;
});
}

View File

@@ -0,0 +1,7 @@
{
"REST": {
"Url": "http://localhost:5000",
"User": "user",
"Password": "password"
}
}