-
Notifications
You must be signed in to change notification settings - Fork 145
/
Copy pathMauiProgram.cs
61 lines (51 loc) · 1.99 KB
/
MauiProgram.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#region Copyright Syncfusion® Inc. 2001-2025.
// Copyright Syncfusion® Inc. 2001-2025. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Blazor_MAUI_Demos.Shared;
using Microsoft.AspNetCore.Components.WebView.Maui;
using Syncfusion.Blazor.Popups;
using Syncfusion.Blazor;
using System.Globalization;
using Microsoft.Extensions.Logging;
namespace Blazor_MAUI_Demos;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
builder.Services.AddMauiBlazorWebView();
builder.Services.AddMemoryCache();
#if DEBUG
builder.Services.AddBlazorWebViewDeveloperTools();
#endif
builder.Services.AddSyncfusionBlazor();
builder.Services.AddScoped<SampleService>();
builder.Services.AddSingleton<DeviceMode>();
builder.Services.AddScoped<SfDialogService>();
// Register the locale service to localize the SyncfusionBlazor components.
builder.Services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SyncfusionLocalizer));
// Set the resx file folder path to access
builder.Services.AddLocalization(options => options.ResourcesPath = "Resources");
// To enable maximum logging for every component that uses Microsoft.Extensions.Logging
builder.Services.AddLogging(logging =>
{
logging.SetMinimumLevel(LogLevel.Trace);
logging.AddDebug();
});
// Set the default culture
var culture = new CultureInfo("en-US");
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;
return builder.Build();
}
}