This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
7
LaDOSE.Src/LaDOSE.DesktopApp.Avalonia/settings.json
Normal file
7
LaDOSE.Src/LaDOSE.DesktopApp.Avalonia/settings.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"REST": {
|
||||
"Url": "http://localhost:5000",
|
||||
"User": "user",
|
||||
"Password": "password"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user