Migrate to Stylet and refactor view/view-model framework

This commit is contained in:
Alexey Golub 2018-11-29 19:18:44 +02:00
parent 083bdef419
commit 0d3510222e
49 changed files with 672 additions and 921 deletions

View file

@ -1,26 +1,24 @@
using CommonServiceLocator;
using DiscordChatExporter.Core.Services;
using GalaSoft.MvvmLight.Ioc;
using DiscordChatExporter.Core.Services;
using StyletIoC;
namespace DiscordChatExporter.Cli
{
public class Container
public static class Container
{
public Container()
{
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
SimpleIoc.Default.Reset();
public static IContainer Instance { get; }
// Services
SimpleIoc.Default.Register<IDataService, DataService>();
SimpleIoc.Default.Register<IExportService, ExportService>();
SimpleIoc.Default.Register<ISettingsService, SettingsService>();
SimpleIoc.Default.Register<IUpdateService, UpdateService>();
}
public T Resolve<T>(string key = null)
static Container()
{
return ServiceLocator.Current.GetInstance<T>(key);
var builder = new StyletIoCBuilder();
// Autobind services in the .Core assembly
builder.Autobind(typeof(DataService).Assembly);
// Bind settings as singleton
builder.Bind<SettingsService>().ToSelf().InSingletonScope();
// Set instance
Instance = builder.BuildContainer();
}
}
}