1
- using System . Globalization ;
2
1
using Append . Blazor . Printing ;
3
2
using MauiPageFullScreen ;
4
3
using Microsoft . Extensions . Configuration ;
5
4
using Microsoft . Extensions . Logging ;
6
- using Ws . Desktop . Models ;
5
+ using ScalesDesktop . Source . Shared . Extensions ;
6
+ using Ws . Shared . Utils ;
7
7
8
8
namespace ScalesDesktop ;
9
9
@@ -13,13 +13,8 @@ public static MauiAppBuilder CreateMauiApp()
13
13
{
14
14
MauiAppBuilder builder = MauiApp . CreateBuilder ( ) ;
15
15
16
- #if DEBUG
17
- Environment . SetEnvironmentVariable ( "ASPNETCORE_ENVIRONMENT" , "DevelopVS" ) ;
18
- #else
19
- Environment . SetEnvironmentVariable ( "ASPNETCORE_ENVIRONMENT" , "ReleaseVS" ) ;
20
- #endif
21
-
22
- builder . Configuration . AddJsonFile ( $ "appsettings.{ Environment . GetEnvironmentVariable ( "ASPNETCORE_ENVIRONMENT" ) } .json", optional : false , reloadOnChange : true ) ;
16
+ builder . Configuration
17
+ . AddJsonFile ( $ "appsettings.{ ( ConfigurationUtil . IsDevelop ? "DevelopVS" : "ReleaseVS" ) } .json") ;
23
18
24
19
builder . Services . AddMauiBlazorWebView ( ) ;
25
20
builder . Services . AddFluentUIComponents ( c => c . ValidateClassNames = false ) ;
@@ -30,13 +25,11 @@ public static MauiAppBuilder CreateMauiApp()
30
25
#endif
31
26
32
27
builder . UseMauiApp < App > ( ) . UseFullScreen ( ) ;
33
-
34
- const string currentLanguage = "ru-RU" ;
35
- CultureInfo . DefaultThreadCurrentCulture = new ( currentLanguage ) ;
36
- CultureInfo . DefaultThreadCurrentUICulture = new ( currentLanguage ) ;
37
- builder . Services . AddLocalization ( ) ;
28
+ builder . SetupLocalizer ( ) ;
29
+ builder . ApplyRefitConfigurations ( ) ;
38
30
39
31
builder . Services . AddScoped < IPrintingService , PrintingService > ( ) ;
32
+
40
33
builder . Services . AddSingleton < PalletDocumentGenerator > ( ) ;
41
34
42
35
builder . Services . AddSingleton < ScalesService > ( ) ;
@@ -45,18 +38,6 @@ public static MauiAppBuilder CreateMauiApp()
45
38
builder . Services . AddSingleton < LabelContext > ( ) ;
46
39
builder . Services . AddSingleton < PalletContext > ( ) ;
47
40
48
- IConfigurationSection oidcConfiguration = builder . Configuration . GetSection ( "Api" ) ;
49
- builder . Services . AddRefitClient < IDesktopApi > ( )
50
- . ConfigureHttpClient ( c => c . BaseAddress = new ( $ "{ oidcConfiguration . GetValue < string > ( "BaseUrl" ) ?? "" } ") )
51
- . ConfigurePrimaryHttpMessageHandler ( ( ) => new HttpClientHandler
52
- {
53
- ServerCertificateCustomValidationCallback = HttpClientHandler . DangerousAcceptAnyServerCertificateValidator
54
- } ) ;
55
-
56
- builder . Services . AddScoped < PalletApi > ( ) ;
57
- builder . Services . AddScoped < ArmApi > ( ) ;
58
- builder . Services . AddScoped < PluApi > ( ) ;
59
-
60
41
return builder ;
61
42
}
62
43
}
0 commit comments