diff --git a/Filtration.ThemeEditor/Providers/ThemeProvider.cs b/Filtration.ThemeEditor/Providers/ThemeProvider.cs index b072c02..4724284 100644 --- a/Filtration.ThemeEditor/Providers/ThemeProvider.cs +++ b/Filtration.ThemeEditor/Providers/ThemeProvider.cs @@ -28,8 +28,6 @@ namespace Filtration.ThemeEditor.Providers public IThemeViewModel NewThemeForScript(ItemFilterScript script) { - Mapper.CreateMap(); - var themeComponentViewModels = Mapper.Map>(script.ThemeComponents); var themeViewModel = _themeViewModelFactory.Create(); themeViewModel.Initialise(themeComponentViewModels, true); @@ -40,9 +38,6 @@ namespace Filtration.ThemeEditor.Providers public IThemeViewModel LoadThemeFromFile(string filePath) { - Mapper.CreateMap().ConstructUsingServiceLocator(); - Mapper.CreateMap(); - var model = _themePersistenceService.LoadTheme(filePath); var viewModel = Mapper.Map(model); viewModel.FilePath = filePath; @@ -56,9 +51,6 @@ namespace Filtration.ThemeEditor.Providers public void SaveTheme(IThemeViewModel themeViewModel, string filePath) { - Mapper.CreateMap(); - Mapper.CreateMap(); - var theme = Mapper.Map(themeViewModel); _themePersistenceService.SaveTheme(theme, filePath); } diff --git a/Filtration/App.xaml.cs b/Filtration/App.xaml.cs index 7f334f0..b7c7082 100644 --- a/Filtration/App.xaml.cs +++ b/Filtration/App.xaml.cs @@ -7,7 +7,9 @@ using Castle.MicroKernel.ModelBuilder.Inspectors; using Castle.Windsor; using Castle.Windsor.Installer; using Filtration.ObjectModel; +using Filtration.ObjectModel.ThemeEditor; using Filtration.Properties; +using Filtration.ThemeEditor.ViewModels; using Filtration.ViewModels; using Filtration.Views; @@ -49,7 +51,11 @@ namespace Filtration opts => opts.MapFrom(from => from)) .ForMember(dest => dest.IsExpanded, opts => opts.UseValue(false)); - + + Mapper.CreateMap().ConstructUsingServiceLocator(); + Mapper.CreateMap().ReverseMap(); + Mapper.CreateMap(); + Mapper.AssertConfigurationIsValid(); var mainWindow = _container.Resolve();