Implemented opening/saving themes
This commit is contained in:
parent
aa5cedcbba
commit
71ad5f2d05
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Filtration.Common.Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("Filtration.Common.Tests")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("23ba4e1b-1cb6-47fc-9a8b-6ce61fc3eb32")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,40 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Filtration.Common")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("Filtration.Common")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("36a40512-35b4-489c-8e20-f431b9e92dc1")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
[assembly: InternalsVisibleTo("Filtration.Tests")]
|
||||
[assembly: InternalsVisibleTo("Filtration.Common.Tests")]
|
||||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Filtration.Services
|
||||
namespace Filtration.Common.Services
|
||||
{
|
||||
internal interface IFileSystemService
|
||||
public interface IFileSystemService
|
||||
{
|
||||
string ReadFileAsString(string filePath);
|
||||
void WriteFileFromString(string filePath, string inputString);
|
|
@ -1,10 +1,10 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using Filtration.Annotations;
|
||||
using Filtration.ObjectModel.Annotations;
|
||||
using GalaSoft.MvvmLight;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
namespace Filtration.Common.ViewModels
|
||||
{
|
||||
internal class FiltrationViewModelBase : ViewModelBase
|
||||
public class FiltrationViewModelBase : ViewModelBase
|
||||
{
|
||||
/// This gives us the ReSharper option to transform an autoproperty into a property with change notification
|
||||
/// Also leverages .net 4.5 callermembername attribute
|
|
@ -1,8 +1,8 @@
|
|||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.ViewModels.ToolPanes
|
||||
namespace Filtration.Common.ViewModels
|
||||
{
|
||||
class PaneViewModel : FiltrationViewModelBase
|
||||
public class PaneViewModel : FiltrationViewModelBase
|
||||
{
|
||||
private string _title;
|
||||
public string Title
|
|
@ -1,7 +1,11 @@
|
|||
namespace Filtration.Interface
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.Interface
|
||||
{
|
||||
public interface IDocument
|
||||
{
|
||||
bool IsScript { get; }
|
||||
bool IsTheme { get; }
|
||||
void Close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{537BE676-2FF6-4995-B05B-9CFACE852EC9}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Filtration.ObjectModel.Tests</RootNamespace>
|
||||
<AssemblyName>Filtration.ObjectModel.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Moq">
|
||||
<HintPath>..\packages\Moq.4.2.1506.2016\lib\net40\Moq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TestItemFilterBlock.cs" />
|
||||
<Compile Include="TestItemFilterBlockGroup.cs" />
|
||||
<Compile Include="TestItemFilterScript.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
|
||||
<Name>Filtration.ObjectModel</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -1,5 +1,5 @@
|
|||
using System.Windows.Media;
|
||||
using Filtration.ThemeEditor.Models;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.ObjectModel.Enums
|
||||
{
|
||||
public enum ThemeComponentType
|
||||
{
|
||||
[Description("Text")]
|
||||
TextColor,
|
||||
[Description("Background")]
|
||||
BackgroundColor,
|
||||
[Description("Border")]
|
||||
BorderColor
|
||||
}
|
||||
}
|
|
@ -69,6 +69,7 @@
|
|||
<Compile Include="Enums\FilterType.cs" />
|
||||
<Compile Include="Enums\ItemRarity.cs" />
|
||||
<Compile Include="Enums\SocketColor.cs" />
|
||||
<Compile Include="Enums\ThemeComponentType.cs" />
|
||||
<Compile Include="Extensions\EnumHelper.cs" />
|
||||
<Compile Include="IAudioVisualBlockItem.cs" />
|
||||
<Compile Include="IItemFilterBlockItem.cs" />
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.ThemeEditor.Models;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
|
||||
namespace Filtration.ObjectModel
|
||||
{
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ThemeEditor.Models
|
||||
namespace Filtration.ObjectModel.ThemeEditor
|
||||
{
|
||||
[Serializable]
|
||||
public class Theme
|
||||
{
|
||||
private readonly List<ThemeComponent> _components;
|
||||
|
@ -14,20 +16,21 @@ namespace Filtration.ThemeEditor.Models
|
|||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
|
||||
public IEnumerable<ThemeComponent> Components
|
||||
public List<ThemeComponent> Components
|
||||
{
|
||||
get { return _components; }
|
||||
}
|
||||
|
||||
public bool ComponentExists(Type targetType, string componentName)
|
||||
public bool ComponentExists(ThemeComponentType componentType, string componentName)
|
||||
{
|
||||
return _components.Exists(c => c.ComponentName == componentName && c.TargetType == targetType);
|
||||
return _components.Exists(c => c.ComponentName == componentName && c.ComponentType == componentType);
|
||||
}
|
||||
|
||||
public void AddComponent(Type targetType, string componentName, Color componentColor)
|
||||
public void AddComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
||||
{
|
||||
_components.Add(new ThemeComponent(targetType, componentName, componentColor));
|
||||
_components.Add(new ThemeComponent(componentType, componentName, componentColor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,31 @@
|
|||
using System;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ThemeEditor.Models
|
||||
namespace Filtration.ObjectModel.ThemeEditor
|
||||
{
|
||||
[Serializable]
|
||||
public class ThemeComponent
|
||||
{
|
||||
public ThemeComponent(Type targetType, string componentName, Color componentColor)
|
||||
public ThemeComponent()
|
||||
{
|
||||
if (targetType == null || componentName == null || componentColor == null)
|
||||
|
||||
}
|
||||
|
||||
public ThemeComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
||||
{
|
||||
if (componentName == null || componentColor == null)
|
||||
{
|
||||
throw new ArgumentException("Null parameters not allowed in ThemeComponent constructor");
|
||||
}
|
||||
|
||||
TargetType = targetType;
|
||||
ComponentType = componentType;
|
||||
Color = componentColor;
|
||||
ComponentName = componentName;
|
||||
}
|
||||
|
||||
public string ComponentName { get; set; }
|
||||
public Type TargetType { get; private set; }
|
||||
public ThemeComponentType ComponentType{ get; set; }
|
||||
public Color Color { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,10 @@
|
|||
<Folder Include="ViewModels\" />
|
||||
</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>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.IO;
|
||||
using Filtration.Common.Services;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.Services;
|
||||
using Filtration.Translators;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Filtration.Services;
|
||||
using Filtration.Common.Services;
|
||||
using Filtration.Services;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ using Filtration.ObjectModel;
|
|||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ThemeEditor.Models;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
using Filtration.Translators;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
@ -499,11 +499,11 @@ namespace Filtration.Tests.Translators
|
|||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" SetTextColor 255 20 100 # Rare Item Text";
|
||||
var testComponent = new ThemeComponent(typeof(TextColorBlockItem), "testComponent", new Color());
|
||||
var testComponent = new ThemeComponent(ThemeComponentType.TextColor, "testComponent", new Color());
|
||||
|
||||
_testUtility.MockThemeComponentListBuilder.Setup(
|
||||
t =>
|
||||
t.AddComponent(typeof (TextColorBlockItem), "Rare Item Text",
|
||||
t.AddComponent(ThemeComponentType.TextColor, "Rare Item Text",
|
||||
new Color {A = 255, R = 255, G = 20, B = 100})).Returns(testComponent).Verifiable();
|
||||
|
||||
// Act
|
||||
|
@ -1116,7 +1116,7 @@ namespace Filtration.Tests.Translators
|
|||
|
||||
var blockItem = new TextColorBlockItem(new Color {A = 255, R = 54, G = 102, B = 255})
|
||||
{
|
||||
ThemeComponent = new ThemeComponent(typeof (TextColorBlockItem), "Test Theme Component", new Color())
|
||||
ThemeComponent = new ThemeComponent(ThemeComponentType.TextColor, "Test Theme Component", new Color())
|
||||
};
|
||||
|
||||
_testUtility.TestBlock.BlockItems.Add(blockItem);
|
||||
|
|
|
@ -6,8 +6,8 @@ using System.Windows;
|
|||
using Filtration.ObjectModel;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
using Filtration.Properties;
|
||||
using Filtration.ThemeEditor.Models;
|
||||
using Filtration.Translators;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System.Windows.Media;
|
||||
using System.Net.Mime;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.Translators;
|
||||
using NUnit.Framework;
|
||||
|
||||
|
@ -13,7 +15,7 @@ namespace Filtration.Tests.Translators
|
|||
{
|
||||
// Arrange
|
||||
|
||||
var testInputTargetType = typeof (TextColorBlockItem);
|
||||
var testInputTargetType = ThemeComponentType.TextColor;
|
||||
var testInputComponentName = "testComponent";
|
||||
var testInputColor = new Color();
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.ThemeEditor.Tests.Providers
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestThemeProvider
|
||||
{
|
||||
[Test]
|
||||
public void CreateThemeFromScript_()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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">
|
||||
|
|
|
@ -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"; } }
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
|
@ -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>
|
|
@ -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>
|
|
@ -17,6 +17,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Filtration.ThemeEditor.Test
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Filtration.Interface", "Filtration.Interface\Filtration.Interface.csproj", "{0F333344-7695-47B2-B0E6-172E4DE74819}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Filtration.Common", "Filtration.Common\Filtration.Common.csproj", "{8CB44F28-2956-4C2A-9314-72727262EDD4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Filtration.Common.Tests", "Filtration.Common.Tests\Filtration.Common.Tests.csproj", "{1E42A658-45C4-4DD9-83C5-2A10728DBDFA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -51,6 +55,14 @@ Global
|
|||
{0F333344-7695-47B2-B0E6-172E4DE74819}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0F333344-7695-47B2-B0E6-172E4DE74819}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0F333344-7695-47B2-B0E6-172E4DE74819}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8CB44F28-2956-4C2A-9314-72727262EDD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8CB44F28-2956-4C2A-9314-72727262EDD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8CB44F28-2956-4C2A-9314-72727262EDD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8CB44F28-2956-4C2A-9314-72727262EDD4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1E42A658-45C4-4DD9-83C5-2A10728DBDFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1E42A658-45C4-4DD9-83C5-2A10728DBDFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1E42A658-45C4-4DD9-83C5-2A10728DBDFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1E42A658-45C4-4DD9-83C5-2A10728DBDFA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System.Linq;
|
||||
using System.Windows;
|
||||
using AutoMapper;
|
||||
using Castle.Facilities.TypedFactory;
|
||||
using Castle.MicroKernel.ModelBuilder.Inspectors;
|
||||
using Castle.Windsor;
|
||||
using Castle.Windsor.Installer;
|
||||
|
@ -23,8 +25,13 @@ namespace Filtration
|
|||
|
||||
_container.Kernel.ComponentModelBuilder.RemoveContributor(propInjector);
|
||||
|
||||
_container.AddFacility<TypedFactoryFacility>();
|
||||
_container.Install(FromAssembly.InThisApplication());
|
||||
|
||||
Mapper.Configuration.ConstructServicesUsing(_container.Resolve);
|
||||
|
||||
Mapper.AssertConfigurationIsValid();
|
||||
|
||||
var mainWindow = _container.Resolve<IMainWindow>();
|
||||
mainWindow.Show();
|
||||
}
|
||||
|
|
|
@ -133,7 +133,6 @@
|
|||
<Compile Include="Extensions\HyperlinkExtensions.cs" />
|
||||
<Compile Include="Properties\Annotations.cs" />
|
||||
<Compile Include="Repositories\ItemFilterScriptRepository.cs" />
|
||||
<Compile Include="Services\FileSystemService.cs" />
|
||||
<Compile Include="Services\ItemFilterPersistenceService.cs" />
|
||||
<Compile Include="Services\StaticDataService.cs" />
|
||||
<Compile Include="Settings.cs" />
|
||||
|
@ -155,14 +154,12 @@
|
|||
<Compile Include="ViewModels\AvalonDockWorkspaceViewModel.cs" />
|
||||
<Compile Include="ViewModels\SettingsWindowViewModel.cs" />
|
||||
<Compile Include="ViewModels\ToolPanes\BlockGroupBrowserViewModel.cs" />
|
||||
<Compile Include="ViewModels\FiltrationViewModelBase.cs" />
|
||||
<Compile Include="ViewModels\IItemFilterScriptViewModelFactory.cs" />
|
||||
<Compile Include="ViewModels\IItemFilterBlockViewModelFactory.cs" />
|
||||
<Compile Include="ViewModels\ItemFilterBlockGroupViewModel.cs" />
|
||||
<Compile Include="ViewModels\ItemFilterBlockViewModel.cs" />
|
||||
<Compile Include="ViewModels\ItemFilterScriptViewModel.cs" />
|
||||
<Compile Include="ViewModels\ToolPanes\BlockOutputPreviewViewModel.cs" />
|
||||
<Compile Include="ViewModels\ToolPanes\PaneViewModel.cs" />
|
||||
<Compile Include="ViewModels\ReplaceColorsViewModel.cs" />
|
||||
<Compile Include="ViewModels\ToolPanes\SectionBrowserViewModel.cs" />
|
||||
<Compile Include="ViewModels\StartPageViewModel.cs" />
|
||||
|
@ -372,6 +369,8 @@
|
|||
<Resource Include="Resources\Icons\block_output_preview_icon.png" />
|
||||
<Resource Include="Resources\Icons\collapse_icon.png" />
|
||||
<Resource Include="Resources\Icons\expand_icon.png" />
|
||||
<Resource Include="Resources\Icons\theme_icon.png" />
|
||||
<Resource Include="Resources\Icons\script_icon.png" />
|
||||
<Content Include="Resources\ItemBaseTypes.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
@ -420,6 +419,10 @@
|
|||
</Content>
|
||||
</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>
|
||||
|
|
|
@ -18,7 +18,6 @@ namespace Filtration.Repositories
|
|||
{
|
||||
private readonly IItemFilterPersistenceService _itemFilterPersistenceService;
|
||||
private readonly IItemFilterScriptViewModelFactory _itemFilterScriptViewModelFactory;
|
||||
//private List<ItemFilterScript> _itemFilterScripts;
|
||||
|
||||
public ItemFilterScriptRepository(IItemFilterPersistenceService itemFilterPersistenceService,
|
||||
IItemFilterScriptViewModelFactory itemFilterScriptViewModelFactory)
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 242 B |
Binary file not shown.
After Width: | Height: | Size: 235 B |
|
@ -1,4 +1,5 @@
|
|||
using System.IO;
|
||||
using Filtration.Common.Services;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.Properties;
|
||||
using Filtration.Translators;
|
||||
|
@ -72,7 +73,5 @@ namespace Filtration.Services
|
|||
_fileSystemService.WriteFileFromString(script.FilePath,
|
||||
_itemFilterScriptTranslator.TranslateItemFilterScriptToString(script));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Filtration.Common.Services;
|
||||
using Filtration.Utilities;
|
||||
|
||||
namespace Filtration.Services
|
||||
|
|
|
@ -270,7 +270,25 @@ namespace Filtration.Translators
|
|||
var componentName = result[0].Groups[2].Value.Trim();
|
||||
if (!string.IsNullOrEmpty(componentName))
|
||||
{
|
||||
blockItem.ThemeComponent = _themeComponentListBuilder.AddComponent(typeof(T), componentName, blockItem.Color);
|
||||
ThemeComponentType componentType;
|
||||
if (typeof (T) == typeof (TextColorBlockItem))
|
||||
{
|
||||
componentType = ThemeComponentType.TextColor;
|
||||
}
|
||||
else if (typeof (T) == typeof (BackgroundColorBlockItem))
|
||||
{
|
||||
componentType = ThemeComponentType.BackgroundColor;
|
||||
}
|
||||
else if (typeof (T) == typeof (BorderColorBlockItem))
|
||||
{
|
||||
componentType = ThemeComponentType.BorderColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Parsing error - unknown theme component type");
|
||||
}
|
||||
|
||||
blockItem.ThemeComponent = _themeComponentListBuilder.AddComponent(componentType, componentName, blockItem.Color);
|
||||
}
|
||||
|
||||
block.BlockItems.Add(blockItem);
|
||||
|
|
|
@ -2,14 +2,15 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ThemeEditor.Models;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
|
||||
namespace Filtration.Translators
|
||||
{
|
||||
internal interface IThemeComponentListBuilder
|
||||
{
|
||||
void Initialise();
|
||||
ThemeComponent AddComponent(Type targetType, string componentName, Color componentColor);
|
||||
ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, Color componentColor);
|
||||
List<ThemeComponent> GetComponents();
|
||||
}
|
||||
|
||||
|
@ -27,14 +28,14 @@ namespace Filtration.Translators
|
|||
_themeComponents = new List<ThemeComponent>();
|
||||
}
|
||||
|
||||
public ThemeComponent AddComponent(Type targetType, string componentName, Color componentColor)
|
||||
public ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
||||
{
|
||||
if (ComponentExists(targetType, componentName))
|
||||
if (ComponentExists(componentType, componentName))
|
||||
{
|
||||
return _themeComponents.FirstOrDefault(t => t.ComponentName == componentName && t.TargetType == targetType);
|
||||
return _themeComponents.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
|
||||
}
|
||||
|
||||
var component = new ThemeComponent(targetType, componentName, componentColor);
|
||||
var component = new ThemeComponent(componentType, componentName, componentColor);
|
||||
_themeComponents.Add(component);
|
||||
|
||||
return component;
|
||||
|
@ -45,9 +46,9 @@ namespace Filtration.Translators
|
|||
return _themeComponents;
|
||||
}
|
||||
|
||||
private bool ComponentExists(Type targetType, string componentName)
|
||||
private bool ComponentExists(ThemeComponentType componentType, string componentName)
|
||||
{
|
||||
return _themeComponents.Exists(c => c.ComponentName == componentName && c.TargetType == targetType);
|
||||
return _themeComponents.Exists(c => c.ComponentName == componentName && c.ComponentType == componentType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Filtration.Utilities
|
|||
ObservableCollection<ItemFilterBlockGroup> blockGroups, bool showAdvanced)
|
||||
{
|
||||
|
||||
Mapper.Reset();
|
||||
//Mapper.Reset();
|
||||
if (showAdvanced)
|
||||
{
|
||||
Mapper.CreateMap<ItemFilterBlockGroup, ItemFilterBlockGroupViewModel>()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.Interface;
|
||||
using Filtration.ViewModels.ToolPanes;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.ObjectModel;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Collections.ObjectModel;
|
|||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
|
|
|
@ -7,7 +7,10 @@ using System.Linq;
|
|||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Castle.Core.Internal;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.Interface;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.Services;
|
||||
|
@ -20,23 +23,21 @@ using MessageBox = System.Windows.MessageBox;
|
|||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal interface IItemFilterScriptViewModel : IDocument
|
||||
internal interface IItemFilterScriptViewModel : IEditableDocument
|
||||
{
|
||||
ItemFilterScript Script { get; }
|
||||
IItemFilterBlockViewModel SelectedBlockViewModel { get; set; }
|
||||
IItemFilterBlockViewModel SectionBrowserSelectedBlockViewModel { get; set; }
|
||||
IEnumerable<IItemFilterBlockViewModel> ItemFilterSectionViewModels { get; }
|
||||
Predicate<IItemFilterBlockViewModel> BlockFilterPredicate { get; set; }
|
||||
bool IsDirty { get; }
|
||||
|
||||
bool ShowAdvanced { get; }
|
||||
string Description { get; set; }
|
||||
string DisplayName { get; }
|
||||
|
||||
void Initialise(ItemFilterScript itemFilterScript, bool newScript);
|
||||
void RemoveDirtyFlag();
|
||||
void SaveScript();
|
||||
void SaveScriptAs();
|
||||
void Close();
|
||||
|
||||
void AddSection(IItemFilterBlockViewModel targetBlockViewModel);
|
||||
void AddBlock(IItemFilterBlockViewModel targetBlockViewModel);
|
||||
void CopyBlock(IItemFilterBlockViewModel targetBlockViewModel);
|
||||
|
@ -81,6 +82,12 @@ namespace Filtration.ViewModels
|
|||
AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => SelectedBlockViewModel != null);
|
||||
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => SelectedBlockViewModel != null);
|
||||
PasteBlockCommand = new RelayCommand(OnPasteBlockCommand, () => SelectedBlockViewModel != null);
|
||||
|
||||
var icon = new BitmapImage();
|
||||
icon.BeginInit();
|
||||
icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/script_icon.png");
|
||||
icon.EndInit();
|
||||
IconSource = icon;
|
||||
}
|
||||
|
||||
public RelayCommand<bool> ToggleShowAdvancedCommand { get; private set; }
|
||||
|
@ -151,10 +158,8 @@ namespace Filtration.ViewModels
|
|||
get { return ItemFilterBlockViewModels.Where(b => b.Block.GetType() == typeof (ItemFilterSection)); }
|
||||
}
|
||||
|
||||
public bool IsScript
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
public bool IsScript { get { return true; } }
|
||||
public bool IsTheme { get { return false; } }
|
||||
|
||||
public string Description
|
||||
{
|
||||
|
@ -264,12 +269,6 @@ namespace Filtration.ViewModels
|
|||
ItemFilterBlockViewModels.Add(vm);
|
||||
}
|
||||
|
||||
//BlockGroupViewModels =_blockGroupMapper.MapBlockGroupsToViewModels(Script.ItemFilterBlockGroups, false);
|
||||
|
||||
// Necessary to perform the AfterMap here instead of in the AutoMapper config due to the mapping being
|
||||
// performed on a collection, but the postmap needs to be performed from the root BlockGroup.
|
||||
//AutoMapperHelpers.ItemFilterBlockGroupViewModelPostMap(BlockGroupViewModels.First());
|
||||
|
||||
_filenameIsFake = newScript;
|
||||
|
||||
if (newScript)
|
||||
|
@ -281,13 +280,13 @@ namespace Filtration.ViewModels
|
|||
ContentId = "testcontentid";
|
||||
}
|
||||
|
||||
public void SaveScript()
|
||||
public void Save()
|
||||
{
|
||||
if (!ValidateScript()) return;
|
||||
|
||||
if (_filenameIsFake)
|
||||
{
|
||||
SaveScriptAs();
|
||||
SaveAs();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -303,7 +302,7 @@ namespace Filtration.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public void SaveScriptAs()
|
||||
public void SaveAs()
|
||||
{
|
||||
if (!ValidateScript()) return;
|
||||
|
||||
|
@ -395,7 +394,7 @@ namespace Filtration.ViewModels
|
|||
{
|
||||
case MessageBoxResult.Yes:
|
||||
{
|
||||
SaveScript();
|
||||
Save();
|
||||
CloseScript();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.Interface;
|
||||
using Filtration.Repositories;
|
||||
using Filtration.ThemeEditor.Providers;
|
||||
using Filtration.ThemeEditor.ViewModels;
|
||||
using Filtration.Translators;
|
||||
using Filtration.Views;
|
||||
|
@ -27,7 +29,7 @@ namespace Filtration.ViewModels
|
|||
private readonly IReplaceColorsViewModel _replaceColorsViewModel;
|
||||
private readonly IAvalonDockWorkspaceViewModel _avalonDockWorkspaceViewModel;
|
||||
private readonly ISettingsWindowViewModel _settingsWindowViewModel;
|
||||
private readonly IThemeEditorViewModel _themeEditorViewModel;
|
||||
private readonly IThemeProvider _themeProvider;
|
||||
|
||||
private IDocument _activeDocument;
|
||||
|
||||
|
@ -36,27 +38,31 @@ namespace Filtration.ViewModels
|
|||
IReplaceColorsViewModel replaceColorsViewModel,
|
||||
IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel,
|
||||
ISettingsWindowViewModel settingsWindowViewModel,
|
||||
IThemeEditorViewModel themeEditorViewModel)
|
||||
IThemeProvider themeProvider)
|
||||
{
|
||||
_itemFilterScriptRepository = itemFilterScriptRepository;
|
||||
_itemFilterScriptTranslator = itemFilterScriptTranslator;
|
||||
_replaceColorsViewModel = replaceColorsViewModel;
|
||||
_avalonDockWorkspaceViewModel = avalonDockWorkspaceViewModel;
|
||||
_settingsWindowViewModel = settingsWindowViewModel;
|
||||
_themeEditorViewModel = themeEditorViewModel;
|
||||
_themeProvider = themeProvider;
|
||||
|
||||
NewScriptCommand = new RelayCommand(OnNewScriptCommand);
|
||||
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, ActiveDocumentIsScript);
|
||||
OpenScriptCommand = new RelayCommand(OnOpenScriptCommand);
|
||||
OpenThemeCommand = new RelayCommand(OnOpenThemeCommand);
|
||||
|
||||
SaveCommand = new RelayCommand(OnSaveDocumentCommand, ActiveDocumentIsEditable);
|
||||
SaveAsCommand = new RelayCommand(OnSaveAsCommand, ActiveDocumentIsEditable);
|
||||
CloseCommand = new RelayCommand(OnCloseDocumentCommand, () => AvalonDockWorkspaceViewModel.ActiveDocument != null);
|
||||
|
||||
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => ActiveDocumentIsScript() && (_avalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel != null));
|
||||
PasteCommand = new RelayCommand(OnPasteCommand, () => ActiveDocumentIsScript() && (_avalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel != null));
|
||||
|
||||
OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand);
|
||||
OpenSettingsWindowCommand = new RelayCommand(OnOpenSettingsWindowCommand);
|
||||
OpenThemeEditorCommand = new RelayCommand(OnOpenThemeEditorCommand);
|
||||
OpenScriptCommand = new RelayCommand(OnOpenScriptCommand);
|
||||
SaveScriptCommand = new RelayCommand(OnSaveScriptCommand, ActiveDocumentIsScript);
|
||||
SaveScriptAsCommand = new RelayCommand(OnSaveScriptAsCommand, ActiveDocumentIsScript);
|
||||
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, ActiveDocumentIsScript);
|
||||
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => ActiveDocumentIsScript() && (_avalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel != null));
|
||||
PasteCommand = new RelayCommand(OnPasteCommand, () => ActiveDocumentIsScript() && (_avalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel != null));
|
||||
NewScriptCommand = new RelayCommand(OnNewScriptCommand);
|
||||
CloseScriptCommand = new RelayCommand(OnCloseScriptCommand, ActiveDocumentIsScript);
|
||||
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, ActiveDocumentIsScript);
|
||||
CreateThemeCommand = new RelayCommand(OnCreateThemeCommand, ActiveDocumentIsScript);
|
||||
|
||||
//LoadScriptFromFile("C:\\ThioleLootFilter.txt");
|
||||
|
||||
|
@ -72,13 +78,13 @@ namespace Filtration.ViewModels
|
|||
case "ActiveDocumentChanged":
|
||||
{
|
||||
_activeDocument = _avalonDockWorkspaceViewModel.ActiveDocument;
|
||||
SaveScriptCommand.RaiseCanExecuteChanged();
|
||||
SaveScriptAsCommand.RaiseCanExecuteChanged();
|
||||
SaveCommand.RaiseCanExecuteChanged();
|
||||
SaveAsCommand.RaiseCanExecuteChanged();
|
||||
CopyScriptCommand.RaiseCanExecuteChanged();
|
||||
CopyBlockCommand.RaiseCanExecuteChanged();
|
||||
PasteCommand.RaiseCanExecuteChanged();
|
||||
NewScriptCommand.RaiseCanExecuteChanged();
|
||||
CloseScriptCommand.RaiseCanExecuteChanged();
|
||||
CloseCommand.RaiseCanExecuteChanged();
|
||||
ReplaceColorsCommand.RaiseCanExecuteChanged();
|
||||
break;
|
||||
}
|
||||
|
@ -97,17 +103,18 @@ namespace Filtration.ViewModels
|
|||
}
|
||||
|
||||
public RelayCommand OpenScriptCommand { get; private set; }
|
||||
public RelayCommand SaveScriptCommand { get; private set; }
|
||||
public RelayCommand SaveScriptAsCommand { get; private set; }
|
||||
public RelayCommand OpenThemeCommand { get; private set; }
|
||||
public RelayCommand SaveCommand { get; private set; }
|
||||
public RelayCommand SaveAsCommand { get; private set; }
|
||||
public RelayCommand CopyBlockCommand { get; private set; }
|
||||
public RelayCommand PasteCommand { get; private set; }
|
||||
public RelayCommand CopyScriptCommand { get; private set; }
|
||||
public RelayCommand NewScriptCommand { get; private set; }
|
||||
public RelayCommand CloseScriptCommand { get; private set; }
|
||||
public RelayCommand CloseCommand { get; private set; }
|
||||
public RelayCommand OpenAboutWindowCommand { get; private set; }
|
||||
public RelayCommand OpenSettingsWindowCommand { get; private set; }
|
||||
public RelayCommand OpenThemeEditorCommand { get; private set; }
|
||||
public RelayCommand ReplaceColorsCommand { get; private set; }
|
||||
public RelayCommand CreateThemeCommand { get; private set; }
|
||||
|
||||
public IAvalonDockWorkspaceViewModel AvalonDockWorkspaceViewModel
|
||||
{
|
||||
|
@ -126,18 +133,29 @@ namespace Filtration.ViewModels
|
|||
|
||||
private bool ActiveDocumentIsScript()
|
||||
{
|
||||
return _activeDocument != null && _activeDocument.IsScript;
|
||||
return _activeDocument is IItemFilterScriptViewModel;
|
||||
}
|
||||
|
||||
private void OnOpenThemeEditorCommand()
|
||||
private bool ActiveDocumentIsEditable()
|
||||
{
|
||||
if (AvalonDockWorkspaceViewModel.OpenDocuments.Contains(_themeEditorViewModel))
|
||||
return _activeDocument is IEditableDocument;
|
||||
}
|
||||
|
||||
private void OnCreateThemeCommand()
|
||||
{
|
||||
AvalonDockWorkspaceViewModel.SwitchActiveDocument(_themeEditorViewModel);
|
||||
var themeViewModel = _themeProvider.NewThemeForScript(AvalonDockWorkspaceViewModel.ActiveScriptViewModel.Script);
|
||||
OpenTheme(themeViewModel);
|
||||
}
|
||||
|
||||
private void OpenTheme(IThemeViewModel themeViewModel)
|
||||
{
|
||||
if (AvalonDockWorkspaceViewModel.OpenDocuments.Contains(themeViewModel))
|
||||
{
|
||||
AvalonDockWorkspaceViewModel.SwitchActiveDocument(themeViewModel);
|
||||
}
|
||||
else
|
||||
{
|
||||
AvalonDockWorkspaceViewModel.AddDocument(_themeEditorViewModel);
|
||||
AvalonDockWorkspaceViewModel.AddDocument(themeViewModel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,6 +199,33 @@ namespace Filtration.ViewModels
|
|||
_avalonDockWorkspaceViewModel.AddDocument(loadedViewModel);
|
||||
}
|
||||
|
||||
private void OnOpenThemeCommand()
|
||||
{
|
||||
var openFileDialog = new OpenFileDialog
|
||||
{
|
||||
Filter = "Filter Theme Files (*.filtertheme)|*.filtertheme|All Files (*.*)|*.*",
|
||||
InitialDirectory = _itemFilterScriptRepository.GetItemFilterScriptDirectory()
|
||||
};
|
||||
|
||||
if (openFileDialog.ShowDialog() != true) return;
|
||||
|
||||
IThemeViewModel loadedViewModel;
|
||||
|
||||
try
|
||||
{
|
||||
loadedViewModel = _themeProvider.LoadThemeFromFile(openFileDialog.FileName);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
MessageBox.Show(@"Error loading filter theme - " + e.Message, @"Theme Load Error",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
_avalonDockWorkspaceViewModel.AddDocument(loadedViewModel);
|
||||
}
|
||||
|
||||
private void SetItemFilterScriptDirectory()
|
||||
{
|
||||
var dlg = new FolderBrowserDialog
|
||||
|
@ -196,14 +241,14 @@ namespace Filtration.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
private void OnSaveScriptCommand()
|
||||
private void OnSaveDocumentCommand()
|
||||
{
|
||||
_avalonDockWorkspaceViewModel.ActiveScriptViewModel.SaveScript();
|
||||
((IEditableDocument)_avalonDockWorkspaceViewModel.ActiveDocument).Save();
|
||||
}
|
||||
|
||||
private void OnSaveScriptAsCommand()
|
||||
private void OnSaveAsCommand()
|
||||
{
|
||||
_avalonDockWorkspaceViewModel.ActiveScriptViewModel.SaveScriptAs();
|
||||
((IEditableDocument)_avalonDockWorkspaceViewModel.ActiveDocument).SaveAs();
|
||||
}
|
||||
|
||||
private void OnReplaceColorsCommand()
|
||||
|
@ -234,9 +279,9 @@ namespace Filtration.ViewModels
|
|||
_avalonDockWorkspaceViewModel.AddDocument(newViewModel);
|
||||
}
|
||||
|
||||
private void OnCloseScriptCommand()
|
||||
private void OnCloseDocumentCommand()
|
||||
{
|
||||
_avalonDockWorkspaceViewModel.ActiveScriptViewModel.Close();
|
||||
_avalonDockWorkspaceViewModel.ActiveDocument.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.Views;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.Properties;
|
||||
using Filtration.Services;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Filtration.Interface;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.Interface;
|
||||
using Filtration.ViewModels.ToolPanes;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
|
@ -23,6 +24,12 @@ namespace Filtration.ViewModels
|
|||
public RelayCommand NewScriptCommand { get; private set; }
|
||||
|
||||
public bool IsScript { get { return false; } }
|
||||
public bool IsTheme { get { return false; } }
|
||||
|
||||
public void Close()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
private static void OnOpenScriptCommand()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using Filtration.Common.ViewModels;
|
||||
|
||||
namespace Filtration.ViewModels.ToolPanes
|
||||
{
|
||||
|
|
|
@ -54,11 +54,11 @@
|
|||
<views:StartPageView DataContext="{Binding}" />
|
||||
</DataTemplate>
|
||||
</viewsAvalonDock:PanesTemplateSelector.StartPageTemplate>
|
||||
<viewsAvalonDock:PanesTemplateSelector.ThemeEditorTemplate>
|
||||
<viewsAvalonDock:PanesTemplateSelector.ThemeTemplate>
|
||||
<DataTemplate>
|
||||
<themeEditorViews:ThemeEditorView DataContext="{Binding}" />
|
||||
<themeEditorViews:ThemeControl DataContext="{Binding}" />
|
||||
</DataTemplate>
|
||||
</viewsAvalonDock:PanesTemplateSelector.ThemeEditorTemplate>
|
||||
</viewsAvalonDock:PanesTemplateSelector.ThemeTemplate>
|
||||
</viewsAvalonDock:PanesTemplateSelector>
|
||||
</xcad:DockingManager.LayoutItemTemplateSelector>
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Filtration.Views.AvalonDock
|
|||
public DataTemplate SectionBrowserTemplate { get; set; }
|
||||
public DataTemplate BlockOutputPreviewTemplate { get; set; }
|
||||
public DataTemplate StartPageTemplate { get; set; }
|
||||
public DataTemplate ThemeEditorTemplate { get; set; }
|
||||
public DataTemplate ThemeTemplate { get; set; }
|
||||
|
||||
public override DataTemplate SelectTemplate(object item, DependencyObject container)
|
||||
{
|
||||
|
@ -25,9 +25,9 @@ namespace Filtration.Views.AvalonDock
|
|||
return ItemFilterScriptTemplate;
|
||||
}
|
||||
|
||||
if (item is ThemeEditorViewModel)
|
||||
if (item is IThemeViewModel)
|
||||
{
|
||||
return ThemeEditorTemplate;
|
||||
return ThemeTemplate;
|
||||
}
|
||||
|
||||
if (item is SectionBrowserViewModel)
|
||||
|
|
|
@ -24,4 +24,6 @@
|
|||
<Image Source="/Filtration;component/Resources/Icons/block_output_preview_icon.png" x:Key="BlockOutputPreviewIcon" x:Shared="False" />
|
||||
<Image Source="/Filtration;component/Resources/Icons/expand_icon.png" x:Key="ExpandIcon" x:Shared="False" />
|
||||
<Image Source="/Filtration;component/Resources/Icons/collapse_icon.png" x:Key="CollapseIcon" x:Shared="False" />
|
||||
<Image Source="/Filtration;component/Resources/Icons/theme_icon.png" x:Key="ThemeIcon" x:Shared="False" />
|
||||
<Image Source="/Filtration;component/Resources/Icons/script_icon.png" x:Key="ScriptIcon" x:Shared="False" />
|
||||
</ResourceDictionary>
|
|
@ -15,9 +15,10 @@
|
|||
<MenuItem Header="_File">
|
||||
<MenuItem Header="_New Script" Command="{Binding NewScriptCommand}" Icon="{StaticResource NewIcon}"/>
|
||||
<MenuItem Header="_Open Script" Command="{Binding OpenScriptCommand}" Icon="{StaticResource OpenIcon}"/>
|
||||
<MenuItem Header="_Save Script" Command="{Binding SaveScriptCommand}" Icon="{StaticResource SaveIcon}"/>
|
||||
<MenuItem Header="Save Script _As" Command="{Binding SaveScriptAsCommand}" Icon="{StaticResource SaveIcon}"/>
|
||||
<MenuItem Header="_Close Script" Command="{Binding CloseScriptCommand}" />
|
||||
<MenuItem Header="_Open Theme" Command="{Binding OpenThemeCommand}" Icon="{StaticResource OpenIcon}"/>
|
||||
<MenuItem Header="_Save" Command="{Binding SaveCommand}" Icon="{StaticResource SaveIcon}"/>
|
||||
<MenuItem Header="Save _As" Command="{Binding SaveAsCommand}" Icon="{StaticResource SaveIcon}"/>
|
||||
<MenuItem Header="_Close Script" Command="{Binding CloseCommand}" />
|
||||
<MenuItem Header="E_xit"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Edit">
|
||||
|
@ -33,7 +34,6 @@
|
|||
</MenuItem>
|
||||
<MenuItem Header="_Tools">
|
||||
<MenuItem Header="_Replace Colors" Command="{Binding ReplaceColorsCommand}" Icon="{StaticResource ReplaceColorsIcon}" />
|
||||
<MenuItem Header="_Theme Editor" Command="{Binding OpenThemeEditorCommand}" Icon="{StaticResource ReplaceColorsIcon}" />
|
||||
<MenuItem Header="_Settings" Command="{Binding OpenSettingsWindowCommand}" />
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Help">
|
||||
|
@ -44,7 +44,10 @@
|
|||
<ToolBar>
|
||||
<Button Command="{Binding NewScriptCommand}" Content="{StaticResource NewIcon}" ToolTip="New Script" />
|
||||
<Button Command="{Binding OpenScriptCommand}" Content="{StaticResource OpenIcon}" ToolTip="Open Script" />
|
||||
<Button Command="{Binding SaveScriptCommand}" Content="{StaticResource SaveIcon}" ToolTip="Save Script" />
|
||||
<Button Command="{Binding SaveCommand}" Content="{StaticResource SaveIcon}" ToolTip="Save" />
|
||||
<Separator />
|
||||
<Button Command="{Binding CreateThemeCommand}" Content="{StaticResource ThemeIcon}" ToolTip="Create Theme for Script" />
|
||||
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<Grid>
|
||||
|
|
|
@ -10,11 +10,6 @@ namespace Filtration.WindsorInstallers
|
|||
{
|
||||
public void Install(IWindsorContainer container, IConfigurationStore store)
|
||||
{
|
||||
container.Register(
|
||||
Component.For<IFileSystemService>()
|
||||
.ImplementedBy<FileSystemService>()
|
||||
.LifeStyle.Singleton);
|
||||
|
||||
container.Register(
|
||||
Component.For<IItemFilterPersistenceService>()
|
||||
.ImplementedBy<ItemFilterPersistenceService>()
|
||||
|
|
|
@ -61,7 +61,6 @@ namespace Filtration.WindsorInstallers
|
|||
.ImplementedBy<SettingsWindowViewModel>()
|
||||
.LifeStyle.Transient);
|
||||
|
||||
container.AddFacility<TypedFactoryFacility>();
|
||||
container.Register(
|
||||
Component.For<IItemFilterBlockViewModelFactory>().AsFactory());
|
||||
|
||||
|
|
Loading…
Reference in New Issue