Implemented opening/saving themes
This commit is contained in:
@@ -30,18 +30,40 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AutoMapper">
|
||||
<HintPath>..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="AutoMapper.Net4">
|
||||
<HintPath>..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.Net4.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Castle.Core">
|
||||
<HintPath>..\packages\Castle.Core.3.3.0\lib\net45\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Castle.Windsor">
|
||||
<HintPath>..\packages\Castle.Windsor.3.3.0\lib\net45\Castle.Windsor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight">
|
||||
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight.Extras">
|
||||
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight.Platform">
|
||||
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Practices.ServiceLocation">
|
||||
<HintPath>..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.ObjectModel" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
@@ -49,16 +71,48 @@
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="Xceed.Wpf.AvalonDock">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.4\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.4\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.4\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.4\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.DataGrid">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.4\lib\net40\Xceed.Wpf.DataGrid.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.Toolkit">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.4\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Converters\ThemeComponentTypeToStringConverter.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ViewModels\ThemeEditorViewModel.cs" />
|
||||
<Compile Include="Views\ThemeEditorView.xaml.cs">
|
||||
<DependentUpon>ThemeEditorView.xaml</DependentUpon>
|
||||
<Compile Include="Providers\ThemeProvider.cs" />
|
||||
<Compile Include="Services\ThemePersistenceService.cs" />
|
||||
<Compile Include="ViewModels\IThemeViewModelFactory.cs" />
|
||||
<Compile Include="ViewModels\ThemeComponentViewModel.cs" />
|
||||
<Compile Include="ViewModels\ThemeViewModel.cs" />
|
||||
<Compile Include="Views\ThemeComponentControl.xaml.cs">
|
||||
<DependentUpon>ThemeComponentControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ThemeControl.xaml.cs">
|
||||
<DependentUpon>ThemeControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindsorInstallers\ProvidersInstaller.cs" />
|
||||
<Compile Include="WindsorInstallers\ServicesInstaller.cs" />
|
||||
<Compile Include="WindsorInstallers\ViewModelsInstaller.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Filtration.Common\Filtration.Common.csproj">
|
||||
<Project>{8cb44f28-2956-4c2a-9314-72727262edd4}</Project>
|
||||
<Name>Filtration.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Filtration.Interface\Filtration.Interface.csproj">
|
||||
<Project>{0f333344-7695-47b2-b0e6-172e4de74819}</Project>
|
||||
<Name>Filtration.Interface</Name>
|
||||
@@ -70,7 +124,11 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Page Include="Views\ThemeEditorView.xaml">
|
||||
<Page Include="Views\ThemeComponentControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ThemeControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
@@ -79,6 +137,7 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\AutoMapper.3.3.1\tools\AutoMapper.targets" Condition="Exists('..\packages\AutoMapper.3.3.1\tools\AutoMapper.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
64
Filtration.ThemeEditor/Providers/ThemeProvider.cs
Normal file
64
Filtration.ThemeEditor/Providers/ThemeProvider.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using AutoMapper;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
using Filtration.ThemeEditor.Services;
|
||||
using Filtration.ThemeEditor.ViewModels;
|
||||
|
||||
namespace Filtration.ThemeEditor.Providers
|
||||
{
|
||||
public interface IThemeProvider
|
||||
{
|
||||
IThemeViewModel NewThemeForScript(ItemFilterScript script);
|
||||
IThemeViewModel LoadThemeFromFile(string filePath);
|
||||
void SaveTheme(IThemeViewModel themeViewModel, string filePath);
|
||||
}
|
||||
|
||||
internal class ThemeProvider : IThemeProvider
|
||||
{
|
||||
private readonly IThemeViewModelFactory _themeViewModelFactory;
|
||||
private readonly IThemePersistenceService _themePersistenceService;
|
||||
|
||||
public ThemeProvider(IThemeViewModelFactory themeViewModelFactory, IThemePersistenceService themePersistenceService)
|
||||
{
|
||||
_themeViewModelFactory = themeViewModelFactory;
|
||||
_themePersistenceService = themePersistenceService;
|
||||
}
|
||||
|
||||
public IThemeViewModel NewThemeForScript(ItemFilterScript script)
|
||||
{
|
||||
Mapper.CreateMap<ThemeComponent, ThemeComponentViewModel>();
|
||||
//Mapper.CreateMap<ThemeComponentType, ThemeComponentType>();
|
||||
|
||||
var themeComponentViewModels = Mapper.Map<ObservableCollection<ThemeComponentViewModel>>(script.ThemeComponents);
|
||||
var themeViewModel = _themeViewModelFactory.Create();
|
||||
themeViewModel.Initialise(themeComponentViewModels, true);
|
||||
themeViewModel.FilePath = "Untitled.filtertheme";
|
||||
|
||||
return themeViewModel;
|
||||
}
|
||||
|
||||
public IThemeViewModel LoadThemeFromFile(string filePath)
|
||||
{
|
||||
Mapper.CreateMap<Theme, IThemeViewModel>().ConstructUsingServiceLocator();
|
||||
Mapper.CreateMap<ThemeComponent, ThemeComponentViewModel>();
|
||||
//Mapper.CreateMap<ThemeComponentType, ThemeComponentType>();
|
||||
|
||||
var model = _themePersistenceService.LoadTheme(filePath);
|
||||
var viewModel = Mapper.Map<IThemeViewModel>(model);
|
||||
viewModel.FilePath = filePath;
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
public void SaveTheme(IThemeViewModel themeViewModel, string filePath)
|
||||
{
|
||||
Mapper.CreateMap<IThemeViewModel, Theme>();
|
||||
Mapper.CreateMap<ThemeComponentViewModel, ThemeComponent>();
|
||||
//Mapper.CreateMap<ThemeComponentType, ThemeComponentType>();
|
||||
|
||||
var theme = Mapper.Map<Theme>(themeViewModel);
|
||||
_themePersistenceService.SaveTheme(theme, filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Filtration.ThemeEditor.ViewModels
|
||||
{
|
||||
public interface IThemeViewModelFactory
|
||||
{
|
||||
IThemeViewModel Create();
|
||||
void Release(IThemeViewModel themeViewModel);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Filtration.Interface;
|
||||
|
||||
namespace Filtration.ThemeEditor.ViewModels
|
||||
{
|
||||
public interface IThemeEditorViewModel : IDocument
|
||||
{
|
||||
}
|
||||
|
||||
public class ThemeEditorViewModel : IThemeEditorViewModel
|
||||
{
|
||||
public bool IsScript { get { return false; }}
|
||||
public string Title { get { return "Theme Editor"; } }
|
||||
}
|
||||
}
|
||||
126
Filtration.ThemeEditor/ViewModels/ThemeViewModel.cs
Normal file
126
Filtration.ThemeEditor/ViewModels/ThemeViewModel.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.Interface;
|
||||
using Filtration.ThemeEditor.Providers;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
|
||||
namespace Filtration.ThemeEditor.ViewModels
|
||||
{
|
||||
public interface IThemeViewModel : IEditableDocument
|
||||
{
|
||||
void Initialise(ObservableCollection<ThemeComponentViewModel> themeComponentViewModels, bool newTheme);
|
||||
string Title { get; }
|
||||
string FilePath { get; set; }
|
||||
string Filename { get; }
|
||||
string Name { get; set; }
|
||||
ObservableCollection<ThemeComponentViewModel> Components { get; set; }
|
||||
}
|
||||
|
||||
public class ThemeViewModel : PaneViewModel, IThemeViewModel
|
||||
{
|
||||
private readonly IThemeProvider _themeProvider;
|
||||
private bool _filenameIsFake;
|
||||
private string _filePath;
|
||||
|
||||
public ThemeViewModel(IThemeProvider themeProvider)
|
||||
{
|
||||
_themeProvider = themeProvider;
|
||||
|
||||
Components = new ObservableCollection<ThemeComponentViewModel>();
|
||||
|
||||
|
||||
var icon = new BitmapImage();
|
||||
icon.BeginInit();
|
||||
icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/theme_icon.png");
|
||||
icon.EndInit();
|
||||
IconSource = icon;
|
||||
}
|
||||
|
||||
public void Initialise(ObservableCollection<ThemeComponentViewModel> themeComponentViewModels, bool newTheme)
|
||||
{
|
||||
Components = themeComponentViewModels;
|
||||
_filenameIsFake = newTheme;
|
||||
}
|
||||
|
||||
public bool IsScript { get { return false; } }
|
||||
public bool IsTheme { get { return true; } }
|
||||
public bool IsDirty { get; private set; }
|
||||
|
||||
public string FilePath
|
||||
{
|
||||
get { return _filePath; }
|
||||
set
|
||||
{
|
||||
_filePath = value;
|
||||
Title = Filename;
|
||||
}
|
||||
}
|
||||
|
||||
public string Filename
|
||||
{
|
||||
get { return Path.GetFileName(FilePath); }
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public ObservableCollection<ThemeComponentViewModel> Components { get; set; }
|
||||
|
||||
public void Save()
|
||||
{
|
||||
if (_filenameIsFake)
|
||||
{
|
||||
SaveAs();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_themeProvider.SaveTheme(this, FilePath);
|
||||
//RemoveDirtyFlag();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(@"Error saving filter theme - " + e.Message, @"Save Error", MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveAs()
|
||||
{
|
||||
var saveDialog = new SaveFileDialog
|
||||
{
|
||||
DefaultExt = ".filter",
|
||||
Filter = @"Filter Theme Files (*.filtertheme)|*.filtertheme|All Files (*.*)|*.*"
|
||||
};
|
||||
|
||||
var result = saveDialog.ShowDialog();
|
||||
|
||||
if (result != DialogResult.OK) return;
|
||||
|
||||
var previousFilePath = FilePath;
|
||||
//try
|
||||
//{
|
||||
FilePath = saveDialog.FileName;
|
||||
_themeProvider.SaveTheme(this, FilePath);
|
||||
_filenameIsFake = false;
|
||||
//RemoveDirtyFlag();
|
||||
//}
|
||||
//catch (Exception e)
|
||||
//{
|
||||
// MessageBox.Show(@"Error saving theme file - " + e.Message, @"Save Error", MessageBoxButton.OK,
|
||||
// MessageBoxImage.Error);
|
||||
// FilePath = previousFilePath;
|
||||
//}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Filtration.ThemeEditor/Views/ThemeComponentControl.xaml
Normal file
25
Filtration.ThemeEditor/Views/ThemeComponentControl.xaml
Normal file
@@ -0,0 +1,25 @@
|
||||
<UserControl x:Class="Filtration.ThemeEditor.Views.ThemeComponentControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:viewModels="clr-namespace:Filtration.ThemeEditor.ViewModels"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:converters="clr-namespace:Filtration.ThemeEditor.Converters"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:ThemeComponentViewModel}"
|
||||
d:DesignHeight="40" d:DesignWidth="200">
|
||||
<UserControl.Resources>
|
||||
<converters:ThemeComponentTypeToStringConverter x:Key="ThemeComponentTypeToStringConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid Width="200">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="25" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding ComponentType, Converter={StaticResource ThemeComponentTypeToStringConverter}}" Foreground="Red" FontSize="10" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding ComponentName}" />
|
||||
<xctk:ColorPicker Grid.Row="2" Grid.Column="0" SelectedColor="{Binding Color}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,8 +1,8 @@
|
||||
namespace Filtration.ThemeEditor.Views
|
||||
{
|
||||
public partial class ThemeEditorView
|
||||
public partial class ThemeComponentControl
|
||||
{
|
||||
public ThemeEditorView()
|
||||
public ThemeComponentControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
27
Filtration.ThemeEditor/Views/ThemeControl.xaml
Normal file
27
Filtration.ThemeEditor/Views/ThemeControl.xaml
Normal file
@@ -0,0 +1,27 @@
|
||||
<UserControl x:Class="Filtration.ThemeEditor.Views.ThemeControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:viewModels="clr-namespace:Filtration.ThemeEditor.ViewModels"
|
||||
xmlns:views="clr-namespace:Filtration.ThemeEditor.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:ThemeViewModel}"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
|
||||
<ItemsControl ItemsSource="{Binding Components}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<views:ThemeComponentControl DataContext="{Binding}" Margin="10" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
Filtration.ThemeEditor/Views/ThemeControl.xaml.cs
Normal file
28
Filtration.ThemeEditor/Views/ThemeControl.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Filtration.ThemeEditor.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ThemeControl.xaml
|
||||
/// </summary>
|
||||
public partial class ThemeControl : UserControl
|
||||
{
|
||||
public ThemeControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<UserControl x:Class="Filtration.ThemeEditor.Views.ThemeEditorView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:viewModels="clr-namespace:Filtration.ThemeEditor.ViewModels"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:ThemeEditorViewModel}"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid>
|
||||
<TextBlock>theme editor goes here!</TextBlock>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,18 @@
|
||||
using Castle.MicroKernel.Registration;
|
||||
using Castle.MicroKernel.SubSystems.Configuration;
|
||||
using Castle.Windsor;
|
||||
using Filtration.ThemeEditor.Providers;
|
||||
|
||||
namespace Filtration.ThemeEditor.WindsorInstallers
|
||||
{
|
||||
public class ProvidersInstaller : IWindsorInstaller
|
||||
{
|
||||
public void Install(IWindsorContainer container, IConfigurationStore store)
|
||||
{
|
||||
container.Register(
|
||||
Component.For<IThemeProvider>()
|
||||
.ImplementedBy<ThemeProvider>()
|
||||
.LifeStyle.Singleton);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using Castle.MicroKernel.Registration;
|
||||
using Castle.MicroKernel.SubSystems.Configuration;
|
||||
using Castle.Windsor;
|
||||
using Filtration.ThemeEditor.Services;
|
||||
|
||||
namespace Filtration.ThemeEditor.WindsorInstallers
|
||||
{
|
||||
public class ServicesInstaller : IWindsorInstaller
|
||||
{
|
||||
public void Install(IWindsorContainer container, IConfigurationStore store)
|
||||
{
|
||||
container.Register(
|
||||
Component.For<IThemePersistenceService>()
|
||||
.ImplementedBy<ThemePersistenceService>()
|
||||
.LifeStyle.Singleton);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Castle.MicroKernel.Registration;
|
||||
using Castle.Facilities.TypedFactory;
|
||||
using Castle.MicroKernel.Registration;
|
||||
using Castle.MicroKernel.SubSystems.Configuration;
|
||||
using Castle.Windsor;
|
||||
using Filtration.ThemeEditor.ViewModels;
|
||||
@@ -10,9 +11,17 @@ namespace Filtration.ThemeEditor.WindsorInstallers
|
||||
public void Install(IWindsorContainer container, IConfigurationStore store)
|
||||
{
|
||||
container.Register(
|
||||
Component.For<IThemeEditorViewModel>()
|
||||
.ImplementedBy<ThemeEditorViewModel>()
|
||||
.LifeStyle.Singleton);
|
||||
Component.For<IThemeViewModel>()
|
||||
.ImplementedBy<ThemeViewModel>()
|
||||
.LifeStyle.Transient);
|
||||
|
||||
container.Register(
|
||||
Component.For<IThemeComponentViewModel>()
|
||||
.ImplementedBy<ThemeComponentViewModel>()
|
||||
.LifeStyle.Transient);
|
||||
|
||||
container.Register(
|
||||
Component.For<IThemeViewModelFactory>().AsFactory());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="AutoMapper" version="3.3.1" targetFramework="net451" />
|
||||
<package id="Castle.Core" version="3.3.0" targetFramework="net451" />
|
||||
<package id="Castle.Windsor" version="3.3.0" targetFramework="net451" />
|
||||
<package id="CommonServiceLocator" version="1.3" targetFramework="net451" />
|
||||
<package id="Extended.Wpf.Toolkit" version="2.4" targetFramework="net451" />
|
||||
<package id="MvvmLightLibs" version="5.1.1.0" targetFramework="net451" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user