-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new host builder pattern, now csproj updates
- Loading branch information
1 parent
ce2696d
commit e8fb9dd
Showing
8 changed files
with
84 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using Microsoft.Maui; | ||
using System; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Maui.Hosting; | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Controls.Compatibility; | ||
using Microsoft.Maui.Controls.Hosting; | ||
using WeatherTwentyOne.Services; | ||
using Microsoft.Maui.LifecycleEvents; | ||
|
||
namespace WeatherTwentyOne | ||
{ | ||
public static class MauiProgram | ||
{ | ||
public static MauiApp CreateMauiApp() | ||
{ | ||
var builder = MauiApp.CreateBuilder(); | ||
builder | ||
.UseMauiApp<App>() | ||
.ConfigureFonts(fonts => { | ||
fonts.AddFont("fa-solid-900.ttf", "FontAwesome"); | ||
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); | ||
fonts.AddFont("OpenSans-SemiBold.ttf", "OpenSansSemiBold"); | ||
}); | ||
builder.ConfigureLifecycleEvents(lifecycle => { | ||
#if WINDOWS | ||
lifecycle | ||
.AddWindows(windows => windows.OnLaunched((app, args) => { | ||
MauiWinUIApplication.Current.MainWindow.SetIcon("Platforms/Windows/trayicon.ico"); | ||
})); | ||
#endif | ||
}); | ||
|
||
var services = builder.Services; | ||
#if WINDOWS | ||
services.AddSingleton<ITrayService, WinUI.TrayService>(); | ||
services.AddSingleton<INotificationService, WinUI.NotificationService>(); | ||
#elif MACCATALYST | ||
services.AddSingleton<ITrayService, MacCatalyst.TrayService>(); | ||
services.AddSingleton<INotificationService, MacCatalyst.NotificationService>(); | ||
#endif | ||
|
||
|
||
|
||
|
||
return builder.Build(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
using Foundation; | ||
using Microsoft.Maui; | ||
using Microsoft.Maui.Hosting; | ||
|
||
namespace WeatherTwentyOne | ||
{ | ||
[Register("AppDelegate")] | ||
public class AppDelegate : MauiUIApplicationDelegate<Startup> | ||
public class AppDelegate : MauiUIApplicationDelegate | ||
{ | ||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
using Foundation; | ||
using Microsoft.Maui; | ||
using Microsoft.Maui.Hosting; | ||
|
||
namespace WeatherTwentyOne | ||
{ | ||
[Register("AppDelegate")] | ||
public class AppDelegate : MauiUIApplicationDelegate<Startup> | ||
public class AppDelegate : MauiUIApplicationDelegate | ||
{ | ||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters