Implemented IoC container
This commit is contained in:
@@ -1,9 +1,30 @@
|
||||
var application = Adw.Application.New("org.typomustakes.keychain", Gio.ApplicationFlags.FlagsNone);
|
||||
application.OnActivate += (sender, args) =>
|
||||
{
|
||||
var window = new App.UI.MainWindow().Window;
|
||||
window.Application = (Adw.Application)sender;
|
||||
window.Show();
|
||||
};
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
return application.RunWithSynchronizationContext(null);
|
||||
namespace App;
|
||||
|
||||
class Program
|
||||
{
|
||||
private static ServiceProvider? provider;
|
||||
|
||||
static int Main()
|
||||
{
|
||||
provider = SetupServices();
|
||||
|
||||
var application = Adw.Application.New("org.typomustakes.keychain", Gio.ApplicationFlags.FlagsNone);
|
||||
application.OnActivate += (sender, args) =>
|
||||
{
|
||||
var window = new App.UI.MainWindow().Window;
|
||||
window.Application = (Adw.Application)sender;
|
||||
window.Show();
|
||||
};
|
||||
|
||||
return application.RunWithSynchronizationContext(null);
|
||||
}
|
||||
|
||||
private static ServiceProvider SetupServices()
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
services.AddTransient<IPasswordStoreService, PasswordStoreService>();
|
||||
return services.BuildServiceProvider();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user