Added Replace Colors functionality
This commit is contained in:
parent
a403fdb23c
commit
db1b783f49
|
@ -4,7 +4,9 @@ using System.Collections.ObjectModel;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Models;
|
||||
using Filtration.Models.BlockItemTypes;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.Tests.Models
|
||||
|
@ -42,5 +44,94 @@ namespace Filtration.Tests.Models
|
|||
// Assert
|
||||
Assert.AreEqual(0, result.Count(r => r.Contains("A script must have at least one block")));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReplaceColors_ReplacesBackgroundColorsCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
var oldColor = new Color {A = 255, R = 255, G = 0, B = 0};
|
||||
var newColor = new Color {A = 255, R = 0, G = 255, B = 100};
|
||||
|
||||
var testInputReplaceColors = new ReplaceColorsParameterSet
|
||||
{
|
||||
OldBackgroundColor = oldColor,
|
||||
NewBackgroundColor = newColor,
|
||||
ReplaceBackgroundColor = true
|
||||
};
|
||||
|
||||
var testInputBlock1 = new LootFilterBlock();
|
||||
testInputBlock1.BlockItems.Add(new BackgroundColorBlockItem(new Color {A = 255, R = 255, G = 0, B = 0}));
|
||||
var testInputBlock2 = new LootFilterBlock();
|
||||
testInputBlock2.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 255, G = 1, B = 0 }));
|
||||
var testInputBlock3 = new LootFilterBlock();
|
||||
testInputBlock3.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 255, G = 0, B = 0 }));
|
||||
|
||||
var script = new LootFilterScript()
|
||||
{
|
||||
LootFilterBlocks = new ObservableCollection<LootFilterBlock>
|
||||
{
|
||||
testInputBlock1,
|
||||
testInputBlock2,
|
||||
testInputBlock3
|
||||
}
|
||||
};
|
||||
|
||||
// Act
|
||||
script.ReplaceColors(testInputReplaceColors);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(newColor, testInputBlock1.BlockItems.OfType<BackgroundColorBlockItem>().First().Color);
|
||||
Assert.AreNotEqual(newColor, testInputBlock2.BlockItems.OfType<BackgroundColorBlockItem>().First().Color);
|
||||
Assert.AreEqual(newColor, testInputBlock3.BlockItems.OfType<BackgroundColorBlockItem>().First().Color);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReplaceColors_OnlyReplacesColorsWhenAllSetParametersMatched()
|
||||
{
|
||||
// Arrange
|
||||
var oldBackgroundColor = new Color { A = 255, R = 255, G = 0, B = 0 };
|
||||
var newBackgroundColor = new Color { A = 255, R = 0, G = 255, B = 100 };
|
||||
|
||||
var oldTextColor = new Color { A = 255, R = 100, G = 0, B = 50 };
|
||||
var newTextColor = new Color { A = 255, R = 101, G = 255, B = 51 };
|
||||
|
||||
var testInputReplaceColors = new ReplaceColorsParameterSet
|
||||
{
|
||||
OldBackgroundColor = oldBackgroundColor,
|
||||
NewBackgroundColor = newBackgroundColor,
|
||||
OldTextColor = oldTextColor,
|
||||
NewTextColor = newTextColor,
|
||||
ReplaceBackgroundColor = true,
|
||||
ReplaceTextColor = true
|
||||
};
|
||||
|
||||
var testInputBlock1 = new LootFilterBlock();
|
||||
testInputBlock1.BlockItems.Add(new BackgroundColorBlockItem(oldBackgroundColor));
|
||||
testInputBlock1.BlockItems.Add(new TextColorBlockItem(oldTextColor));
|
||||
var testInputBlock2 = new LootFilterBlock();
|
||||
testInputBlock2.BlockItems.Add(new BackgroundColorBlockItem(oldBackgroundColor));
|
||||
testInputBlock2.BlockItems.Add(new TextColorBlockItem(new Color {A = 1, R = 2, G = 3, B = 4}));
|
||||
|
||||
var script = new LootFilterScript
|
||||
{
|
||||
LootFilterBlocks = new ObservableCollection<LootFilterBlock>
|
||||
{
|
||||
testInputBlock1,
|
||||
testInputBlock2
|
||||
}
|
||||
};
|
||||
|
||||
// Act
|
||||
script.ReplaceColors(testInputReplaceColors);
|
||||
|
||||
// Assert
|
||||
// First test block has had its colors changed
|
||||
Assert.AreEqual(newBackgroundColor, testInputBlock1.BlockItems.OfType<BackgroundColorBlockItem>().First().Color);
|
||||
Assert.AreEqual(newTextColor, testInputBlock1.BlockItems.OfType<TextColorBlockItem>().First().Color);
|
||||
|
||||
// Second test block has not had its colors changed
|
||||
Assert.AreEqual(oldBackgroundColor, testInputBlock2.BlockItems.OfType<BackgroundColorBlockItem>().First().Color);
|
||||
Assert.AreNotEqual(newTextColor, testInputBlock2.BlockItems.OfType<TextColorBlockItem>().First().Color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,12 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>Filtration.App</StartupObject>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>Resources\filtration.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Castle.Core">
|
||||
<HintPath>..\packages\Castle.Core.3.3.0\lib\net45\Castle.Core.dll</HintPath>
|
||||
|
@ -129,6 +135,7 @@
|
|||
<Compile Include="Models\LootFilterSection.cs" />
|
||||
<Compile Include="Models\NumericFilterPredicate.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\SocketGroupBlockItemBase.cs" />
|
||||
<Compile Include="Models\ReplaceColorsParameterSet.cs" />
|
||||
<Compile Include="Properties\Annotations.cs" />
|
||||
<Compile Include="Services\FileSystemService.cs" />
|
||||
<Compile Include="Services\LootFilterPersistenceService.cs" />
|
||||
|
@ -146,6 +153,7 @@
|
|||
<Compile Include="ViewModels\ILootFilterBlockViewModelFactory.cs" />
|
||||
<Compile Include="ViewModels\LootFilterBlockViewModel.cs" />
|
||||
<Compile Include="ViewModels\LootFilterScriptViewModel.cs" />
|
||||
<Compile Include="ViewModels\ReplaceColorsViewModel.cs" />
|
||||
<Compile Include="Views\BindingProxy.cs" />
|
||||
<Compile Include="Views\BlockTemplateSelector.cs" />
|
||||
<Compile Include="Views\LootFilterBlockDisplaySettingsView.xaml.cs">
|
||||
|
@ -166,6 +174,9 @@
|
|||
<Compile Include="Views\AboutWindow.xaml.cs">
|
||||
<DependentUpon>AboutWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ReplaceColorsWindow.xaml.cs">
|
||||
<DependentUpon>ReplaceColorsWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindsorInstallers\ModelsInstaller.cs" />
|
||||
<Compile Include="WindsorInstallers\ServicesInstaller.cs" />
|
||||
<Compile Include="WindsorInstallers\TranslatorsInstaller.cs" />
|
||||
|
@ -228,6 +239,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ReplaceColorsWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
|
@ -282,6 +297,8 @@
|
|||
<Resource Include="Resources\Icons\arrow_top_icon.png" />
|
||||
<Resource Include="Resources\Icons\arrow_bottom_icon.png" />
|
||||
<Resource Include="Resources\Icons\about_icon.png" />
|
||||
<Resource Include="Resources\filtration.ico" />
|
||||
<Resource Include="Resources\Icons\replace_colors_icon.png" />
|
||||
<Content Include="Resources\ItemBaseTypes.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
|
@ -37,12 +37,12 @@ namespace Filtration.Models.BlockItemTypes
|
|||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.Plum; }
|
||||
get { return Colors.LightBlue; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
get { return Colors.Black; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace Filtration.Models.BlockItemTypes
|
|||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.Tan; }
|
||||
get { return Colors.MediumPurple; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.ObjectModel;
|
|||
using System.Linq;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
using Filtration.Models.BlockItemTypes;
|
||||
|
||||
namespace Filtration.Models
|
||||
{
|
||||
|
@ -41,5 +42,10 @@ namespace Filtration.Models
|
|||
var blockItem = (ILootFilterBlockItem)Activator.CreateInstance(type);
|
||||
return BlockCount(type) < blockItem.MaximumAllowed;
|
||||
}
|
||||
|
||||
public bool HasBlockItemOfType<T>()
|
||||
{
|
||||
return BlockItems.Count(b => b is T) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Filtration.Models.BlockItemTypes;
|
||||
|
||||
namespace Filtration.Models
|
||||
{
|
||||
|
@ -27,5 +29,65 @@ namespace Filtration.Models
|
|||
|
||||
return validationErrors;
|
||||
}
|
||||
|
||||
public void ReplaceColors(ReplaceColorsParameterSet replaceColorsParameterSet)
|
||||
{
|
||||
|
||||
foreach (
|
||||
var block in
|
||||
LootFilterBlocks.Where(b => BlockIsColorReplacementCandidate(replaceColorsParameterSet, b)))
|
||||
{
|
||||
if (replaceColorsParameterSet.ReplaceTextColor)
|
||||
{
|
||||
var textColorBlockItem = block.BlockItems.OfType<TextColorBlockItem>().First();
|
||||
textColorBlockItem.Color = replaceColorsParameterSet.NewTextColor;
|
||||
}
|
||||
if (replaceColorsParameterSet.ReplaceBackgroundColor)
|
||||
{
|
||||
var backgroundColorBlockItem = block.BlockItems.OfType<BackgroundColorBlockItem>().First();
|
||||
backgroundColorBlockItem.Color = replaceColorsParameterSet.NewBackgroundColor;
|
||||
}
|
||||
if (replaceColorsParameterSet.ReplaceBorderColor)
|
||||
{
|
||||
var borderColorBlockItem = block.BlockItems.OfType<BorderColorBlockItem>().First();
|
||||
borderColorBlockItem.Color = replaceColorsParameterSet.NewBorderColor;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private bool BlockIsColorReplacementCandidate(ReplaceColorsParameterSet replaceColorsParameterSet, LootFilterBlock block)
|
||||
{
|
||||
var textColorItem = block.HasBlockItemOfType<TextColorBlockItem>()
|
||||
? block.BlockItems.OfType<TextColorBlockItem>().First()
|
||||
: null;
|
||||
var backgroundColorItem = block.HasBlockItemOfType<BackgroundColorBlockItem>()
|
||||
? block.BlockItems.OfType<BackgroundColorBlockItem>().First()
|
||||
: null;
|
||||
var borderColorItem = block.HasBlockItemOfType<BorderColorBlockItem>()
|
||||
? block.BlockItems.OfType<BorderColorBlockItem>().First()
|
||||
: null;
|
||||
|
||||
// If we don't have all of the things we want to replace, then we aren't a candidate for replacing those things.
|
||||
if ((textColorItem == null && replaceColorsParameterSet.ReplaceTextColor) ||
|
||||
(backgroundColorItem == null && replaceColorsParameterSet.ReplaceBackgroundColor) ||
|
||||
(borderColorItem == null && replaceColorsParameterSet.ReplaceBorderColor))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((replaceColorsParameterSet.ReplaceTextColor &&
|
||||
textColorItem.Color != replaceColorsParameterSet.OldTextColor) ||
|
||||
(replaceColorsParameterSet.ReplaceBackgroundColor &&
|
||||
backgroundColorItem.Color != replaceColorsParameterSet.OldBackgroundColor) ||
|
||||
(replaceColorsParameterSet.ReplaceBorderColor &&
|
||||
borderColorItem.Color != replaceColorsParameterSet.OldBorderColor))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.Models
|
||||
{
|
||||
internal class ReplaceColorsParameterSet
|
||||
{
|
||||
public Color OldTextColor { get; set; }
|
||||
public Color NewTextColor { get; set; }
|
||||
public Color OldBackgroundColor { get; set; }
|
||||
public Color NewBackgroundColor { get; set; }
|
||||
public Color OldBorderColor { get; set; }
|
||||
public Color NewBorderColor { get; set; }
|
||||
public bool ReplaceTextColor { get; set; }
|
||||
public bool ReplaceBackgroundColor { get; set; }
|
||||
public bool ReplaceBorderColor { get; set; }
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 325 B |
Binary file not shown.
After Width: | Height: | Size: 97 KiB |
|
@ -3,12 +3,11 @@ using System.Collections.Generic;
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Models;
|
||||
using Filtration.Models.BlockItemTypes;
|
||||
using Filtration.Services;
|
||||
using Filtration.Translators;
|
||||
using Filtration.Views;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
|
@ -23,14 +22,17 @@ namespace Filtration.ViewModels
|
|||
internal class LootFilterBlockViewModel : FiltrationViewModelBase, ILootFilterBlockViewModel
|
||||
{
|
||||
private readonly IStaticDataService _staticDataService;
|
||||
private readonly IReplaceColorsViewModel _replaceColorsViewModel;
|
||||
private readonly MediaPlayer _mediaPlayer = new MediaPlayer();
|
||||
private LootFilterScriptViewModel _parentScriptViewModel;
|
||||
|
||||
private bool _displaySettingsPopupOpen;
|
||||
|
||||
public LootFilterBlockViewModel(IStaticDataService staticDataService)
|
||||
public LootFilterBlockViewModel(IStaticDataService staticDataService, IReplaceColorsViewModel replaceColorsViewModel)
|
||||
{
|
||||
_staticDataService = staticDataService;
|
||||
_replaceColorsViewModel = replaceColorsViewModel;
|
||||
|
||||
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand);
|
||||
PasteBlockCommand = new RelayCommand(OnPasteBlockCommand);
|
||||
AddBlockCommand = new RelayCommand(OnAddBlockCommand);
|
||||
|
@ -40,6 +42,7 @@ namespace Filtration.ViewModels
|
|||
MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand);
|
||||
MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand);
|
||||
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand);
|
||||
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand);
|
||||
AddFilterBlockItemCommand = new RelayCommand<Type>(OnAddFilterBlockItemCommand);
|
||||
AddAudioVisualBlockItemCommand = new RelayCommand<Type>(OnAddAudioVisualBlockItemCommand);
|
||||
RemoveFilterBlockItemCommand = new RelayCommand<ILootFilterBlockItem>(OnRemoveFilterBlockItemCommand);
|
||||
|
@ -74,6 +77,7 @@ namespace Filtration.ViewModels
|
|||
public RelayCommand MoveBlockDownCommand { get; private set; }
|
||||
public RelayCommand MoveBlockToTopCommand { get; private set; }
|
||||
public RelayCommand MoveBlockToBottomCommand { get; private set; }
|
||||
public RelayCommand ReplaceColorsCommand { get; private set; }
|
||||
public RelayCommand<Type> AddFilterBlockItemCommand { get; private set; }
|
||||
public RelayCommand<Type> AddAudioVisualBlockItemCommand { get; private set; }
|
||||
public RelayCommand<ILootFilterBlockItem> RemoveFilterBlockItemCommand { get; private set; }
|
||||
|
@ -188,7 +192,7 @@ namespace Filtration.ViewModels
|
|||
|
||||
public bool HasTextColor
|
||||
{
|
||||
get { return FilterBlockItems.Count(b => b is TextColorBlockItem) > 0; }
|
||||
get { return Block.HasBlockItemOfType<TextColorBlockItem>(); }
|
||||
}
|
||||
|
||||
public Color DisplayTextColor
|
||||
|
@ -203,7 +207,7 @@ namespace Filtration.ViewModels
|
|||
|
||||
public bool HasBackgroundColor
|
||||
{
|
||||
get { return FilterBlockItems.Count(b => b is BackgroundColorBlockItem) > 0; }
|
||||
get { return Block.HasBlockItemOfType<BackgroundColorBlockItem>(); }
|
||||
}
|
||||
|
||||
public Color DisplayBackgroundColor
|
||||
|
@ -218,7 +222,7 @@ namespace Filtration.ViewModels
|
|||
|
||||
public bool HasBorderColor
|
||||
{
|
||||
get { return FilterBlockItems.Count(b => b is BorderColorBlockItem) > 0; }
|
||||
get { return Block.HasBlockItemOfType<BorderColorBlockItem>(); }
|
||||
}
|
||||
|
||||
public Color DisplayBorderColor
|
||||
|
@ -233,12 +237,12 @@ namespace Filtration.ViewModels
|
|||
|
||||
public bool HasFontSize
|
||||
{
|
||||
get { return FilterBlockItems.Count(b => b is FontSizeBlockItem) > 0; }
|
||||
get { return Block.HasBlockItemOfType<FontSizeBlockItem>(); }
|
||||
}
|
||||
|
||||
public bool HasSound
|
||||
{
|
||||
get { return FilterBlockItems.Count(b => b is SoundBlockItem) > 0; }
|
||||
get { return Block.HasBlockItemOfType<SoundBlockItem>(); }
|
||||
}
|
||||
|
||||
private void OnAddFilterBlockItemCommand(Type blockItemType)
|
||||
|
@ -320,6 +324,13 @@ namespace Filtration.ViewModels
|
|||
{
|
||||
_parentScriptViewModel.MoveBlockToBottom(this);
|
||||
}
|
||||
|
||||
private void OnReplaceColorsCommand()
|
||||
{
|
||||
_replaceColorsViewModel.Initialise(_parentScriptViewModel.Script, Block);
|
||||
var replaceColorsWindow = new ReplaceColorsWindow { DataContext = _replaceColorsViewModel };
|
||||
replaceColorsWindow.ShowDialog();
|
||||
}
|
||||
|
||||
private bool AddBlockItemAllowed(Type type)
|
||||
{
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Filtration.ViewModels
|
|||
LootFilterScript Script { get; }
|
||||
bool IsDirty { get; }
|
||||
string Description { get; set; }
|
||||
string DisplayName { get; }
|
||||
void Initialise(LootFilterScript lootFilterScript);
|
||||
ILootFilterBlockViewModel SelectedBlockViewModel { get; set; }
|
||||
void RemoveDirtyFlag();
|
||||
|
@ -93,7 +94,10 @@ namespace Filtration.ViewModels
|
|||
public bool IsDirty
|
||||
{
|
||||
get { return _isDirty || HasDirtyChildren; }
|
||||
set { _isDirty = value; }
|
||||
set
|
||||
{
|
||||
_isDirty = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool HasDirtyChildren
|
||||
|
@ -113,6 +117,8 @@ namespace Filtration.ViewModels
|
|||
{
|
||||
CleanChildren();
|
||||
IsDirty = false;
|
||||
RaisePropertyChanged("Filename");
|
||||
RaisePropertyChanged("DisplayName");
|
||||
}
|
||||
|
||||
public string DisplayName
|
||||
|
@ -279,7 +285,7 @@ namespace Filtration.ViewModels
|
|||
var newBlock = new LootFilterBlock();
|
||||
vm.Initialise(newBlock, this);
|
||||
|
||||
if (LootFilterBlockViewModels.Count > 0)
|
||||
if (targetBlockViewModel != null)
|
||||
{
|
||||
Script.LootFilterBlocks.Insert(Script.LootFilterBlocks.IndexOf(targetBlockViewModel.Block) + 1, newBlock);
|
||||
LootFilterBlockViewModels.Insert(LootFilterBlockViewModels.IndexOf(targetBlockViewModel) + 1, vm);
|
||||
|
|
|
@ -26,16 +26,19 @@ namespace Filtration.ViewModels
|
|||
private readonly ILootFilterScriptViewModelFactory _lootFilterScriptViewModelFactory;
|
||||
private readonly ILootFilterPersistenceService _persistenceService;
|
||||
private readonly ILootFilterScriptTranslator _lootFilterScriptTranslator;
|
||||
private readonly IReplaceColorsViewModel _replaceColorsViewModel;
|
||||
private ILootFilterScriptViewModel _currentScriptViewModel;
|
||||
private readonly ObservableCollection<ILootFilterScriptViewModel> _scriptViewModels;
|
||||
|
||||
public MainWindowViewModel(ILootFilterScriptViewModelFactory lootFilterScriptViewModelFactory,
|
||||
ILootFilterPersistenceService persistenceService,
|
||||
ILootFilterScriptTranslator lootFilterScriptTranslator)
|
||||
ILootFilterScriptTranslator lootFilterScriptTranslator,
|
||||
IReplaceColorsViewModel replaceColorsViewModel)
|
||||
{
|
||||
_lootFilterScriptViewModelFactory = lootFilterScriptViewModelFactory;
|
||||
_persistenceService = persistenceService;
|
||||
_lootFilterScriptTranslator = lootFilterScriptTranslator;
|
||||
_replaceColorsViewModel = replaceColorsViewModel;
|
||||
|
||||
_scriptViewModels = new ObservableCollection<ILootFilterScriptViewModel>();
|
||||
|
||||
|
@ -48,8 +51,9 @@ namespace Filtration.ViewModels
|
|||
PasteCommand = new RelayCommand(OnPasteCommand, () => CurrentScriptViewModel != null);
|
||||
NewScriptCommand = new RelayCommand(OnNewScriptCommand);
|
||||
CloseScriptCommand = new RelayCommand<ILootFilterScriptViewModel>(OnCloseScriptCommand, v => CurrentScriptViewModel != null);
|
||||
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => CurrentScriptViewModel != null);
|
||||
|
||||
LoadScriptFromFile("C:\\ThioleLootFilter.txt");
|
||||
//LoadScriptFromFile("C:\\ThioleLootFilter.txt");
|
||||
|
||||
SetLootFilterScriptDirectory();
|
||||
}
|
||||
|
@ -63,6 +67,7 @@ namespace Filtration.ViewModels
|
|||
public RelayCommand NewScriptCommand { get; private set; }
|
||||
public RelayCommand<ILootFilterScriptViewModel> CloseScriptCommand { get; private set; }
|
||||
public RelayCommand OpenAboutWindowCommand { get; private set; }
|
||||
public RelayCommand ReplaceColorsCommand { get; private set; }
|
||||
|
||||
public ObservableCollection<ILootFilterScriptViewModel> ScriptViewModels
|
||||
{
|
||||
|
@ -87,11 +92,17 @@ namespace Filtration.ViewModels
|
|||
{
|
||||
_currentScriptViewModel = value;
|
||||
RaisePropertyChanged();
|
||||
RaisePropertyChanged("NoScriptsOpen");
|
||||
SaveScriptCommand.RaiseCanExecuteChanged();
|
||||
SaveScriptAsCommand.RaiseCanExecuteChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public bool NoScriptsOpen
|
||||
{
|
||||
get { return _currentScriptViewModel == null; }
|
||||
}
|
||||
|
||||
private void OnOpenAboutWindowCommand()
|
||||
{
|
||||
var aboutWindow = new AboutWindow();
|
||||
|
@ -206,6 +217,13 @@ namespace Filtration.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
private void OnReplaceColorsCommand()
|
||||
{
|
||||
_replaceColorsViewModel.Initialise(CurrentScriptViewModel.Script);
|
||||
var replaceColorsWindow = new ReplaceColorsWindow {DataContext = _replaceColorsViewModel};
|
||||
replaceColorsWindow.ShowDialog();
|
||||
}
|
||||
|
||||
private bool ValidateScript()
|
||||
{
|
||||
var result = CurrentScriptViewModel.Script.Validate();
|
||||
|
|
|
@ -0,0 +1,171 @@
|
|||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Models;
|
||||
using Filtration.Models.BlockItemTypes;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal interface IReplaceColorsViewModel
|
||||
{
|
||||
void Initialise(LootFilterScript lootFilterScript, LootFilterBlock initialiseFromBlock);
|
||||
void Initialise(LootFilterScript lootFilterScript);
|
||||
}
|
||||
|
||||
internal class ReplaceColorsViewModel : FiltrationViewModelBase, IReplaceColorsViewModel
|
||||
{
|
||||
private LootFilterScript _lootFilterScript;
|
||||
private ReplaceColorsParameterSet _replaceColorsParameterSet;
|
||||
|
||||
public ReplaceColorsViewModel()
|
||||
{
|
||||
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand);
|
||||
}
|
||||
|
||||
public RelayCommand ReplaceColorsCommand { get; private set; }
|
||||
|
||||
public void Initialise(LootFilterScript lootFilterScript, LootFilterBlock initialiseFromBlock)
|
||||
{
|
||||
_replaceColorsParameterSet = new ReplaceColorsParameterSet();
|
||||
|
||||
if (initialiseFromBlock.BlockItems.Count(b => b.GetType() == typeof (TextColorBlockItem)) > 0)
|
||||
{
|
||||
_replaceColorsParameterSet.ReplaceTextColor = true;
|
||||
_replaceColorsParameterSet.OldTextColor =
|
||||
((TextColorBlockItem)
|
||||
initialiseFromBlock.BlockItems.First(b => b.GetType() == typeof (TextColorBlockItem))).Color;
|
||||
}
|
||||
|
||||
if (initialiseFromBlock.BlockItems.Count(b => b.GetType() == typeof(BackgroundColorBlockItem)) > 0)
|
||||
{
|
||||
_replaceColorsParameterSet.ReplaceBackgroundColor = true;
|
||||
_replaceColorsParameterSet.OldBackgroundColor =
|
||||
((BackgroundColorBlockItem)
|
||||
initialiseFromBlock.BlockItems.First(b => b.GetType() == typeof(BackgroundColorBlockItem))).Color;
|
||||
}
|
||||
|
||||
if (initialiseFromBlock.BlockItems.Count(b => b.GetType() == typeof(BorderColorBlockItem)) > 0)
|
||||
{
|
||||
_replaceColorsParameterSet.ReplaceBorderColor = true;
|
||||
_replaceColorsParameterSet.OldBorderColor =
|
||||
((BorderColorBlockItem)
|
||||
initialiseFromBlock.BlockItems.First(b => b.GetType() == typeof(BorderColorBlockItem))).Color;
|
||||
}
|
||||
|
||||
_lootFilterScript = lootFilterScript;
|
||||
}
|
||||
|
||||
public Color NewTextColor
|
||||
{
|
||||
get { return _replaceColorsParameterSet.NewTextColor; }
|
||||
set
|
||||
{
|
||||
_replaceColorsParameterSet.NewTextColor = value;
|
||||
RaisePropertyChanged();
|
||||
RaisePropertyChanged("DisplayTextColor");
|
||||
}
|
||||
}
|
||||
|
||||
public Color DisplayTextColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _replaceColorsParameterSet.ReplaceTextColor
|
||||
? _replaceColorsParameterSet.NewTextColor
|
||||
: new Color {A = 255, R = 255, G = 255, B = 255};
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReplaceTextColor
|
||||
{
|
||||
get { return _replaceColorsParameterSet.ReplaceTextColor; }
|
||||
set
|
||||
{
|
||||
_replaceColorsParameterSet.ReplaceTextColor = value;
|
||||
RaisePropertyChanged("DisplayTextColor");
|
||||
}
|
||||
}
|
||||
|
||||
public Color NewBackgroundColor
|
||||
{
|
||||
get { return _replaceColorsParameterSet.NewBackgroundColor; }
|
||||
set
|
||||
{
|
||||
_replaceColorsParameterSet.NewBackgroundColor = value;
|
||||
RaisePropertyChanged();
|
||||
RaisePropertyChanged("DisplayBackgroundColor");
|
||||
}
|
||||
}
|
||||
|
||||
public Color DisplayBackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _replaceColorsParameterSet.ReplaceBackgroundColor
|
||||
? _replaceColorsParameterSet.NewBackgroundColor
|
||||
: new Color { A = 255, R = 0, G = 0, B = 0 };
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReplaceBackgroundColor
|
||||
{
|
||||
get { return _replaceColorsParameterSet.ReplaceBackgroundColor; }
|
||||
set
|
||||
{
|
||||
_replaceColorsParameterSet.ReplaceBackgroundColor = value;
|
||||
RaisePropertyChanged("DisplayBackgroundColor");
|
||||
}
|
||||
}
|
||||
|
||||
public Color NewBorderColor
|
||||
{
|
||||
get { return _replaceColorsParameterSet.NewBorderColor; }
|
||||
set
|
||||
{
|
||||
_replaceColorsParameterSet.NewBorderColor = value;
|
||||
RaisePropertyChanged();
|
||||
RaisePropertyChanged("DisplayBorderColor");
|
||||
}
|
||||
}
|
||||
|
||||
public Color DisplayBorderColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _replaceColorsParameterSet.ReplaceBorderColor
|
||||
? _replaceColorsParameterSet.NewBorderColor
|
||||
: new Color { A = 255, R = 0, G = 0, B = 0 };
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReplaceBorderColor
|
||||
{
|
||||
get { return _replaceColorsParameterSet.ReplaceBorderColor; }
|
||||
set
|
||||
{
|
||||
_replaceColorsParameterSet.ReplaceBorderColor = value;
|
||||
RaisePropertyChanged("DisplayBorderColor");
|
||||
}
|
||||
}
|
||||
|
||||
public ReplaceColorsParameterSet ReplaceColorsParameterSet
|
||||
{
|
||||
get
|
||||
{
|
||||
return _replaceColorsParameterSet;
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialise(LootFilterScript lootFilterScript)
|
||||
{
|
||||
_replaceColorsParameterSet = new ReplaceColorsParameterSet();
|
||||
_lootFilterScript = lootFilterScript;
|
||||
}
|
||||
|
||||
private void OnReplaceColorsCommand()
|
||||
{
|
||||
_lootFilterScript.ReplaceColors(_replaceColorsParameterSet);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -16,4 +16,5 @@
|
|||
<Image Source="/Filtration;component/Resources/Icons/speaker_icon.png" x:Key="SpeakerIcon" x:Shared="false" />
|
||||
<Image Source="/Filtration;component/Resources/Icons/play_icon.png" x:Key="PlayIcon" x:Shared="false" />
|
||||
<Image Source="/Filtration;component/Resources/Icons/about_icon.png" x:Key="AboutIcon" x:Shared="false" />
|
||||
<Image Source="/Filtration;component/Resources/Icons/replace_colors_icon.png" x:Key="ReplaceColorsIcon" x:Shared="false" />
|
||||
</ResourceDictionary>
|
|
@ -92,7 +92,7 @@
|
|||
<TextBlock Grid.Column="0" Text="{Binding DisplayHeading}" Style="{StaticResource DisplayHeading}" />
|
||||
<WrapPanel Grid.Column="1" Grid.Row="0" HorizontalAlignment="Right">
|
||||
<Button Command="{Binding ElementName=SettingsGrid, Path=DataContext.PlaySoundCommand}" Width="20" Height="20" Padding="3" Background="Transparent" BorderBrush="Transparent">
|
||||
<Image Source="/Filtration;component/Resources/Icons/play_icon.png" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
<Image Source="/Filtration;component/Resources/Icons/speaker_icon.png" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
</Button>
|
||||
<ComboBox ItemsSource="{Binding ElementName=SettingsGrid, Path=DataContext.SoundsAvailable}" SelectedValue="{Binding Value}" />
|
||||
<xctk:ShortUpDown Value="{Binding Path=SecondValue}" Minimum="1" Maximum="100" HorizontalAlignment="Right" ToolTip="Volume"/>
|
||||
|
|
|
@ -52,6 +52,8 @@
|
|||
<MenuItem Header="Move Block Up" Command="{Binding Data.MoveBlockUpCommand, Source={StaticResource proxy}}" Icon="{StaticResource MoveUpIcon}" />
|
||||
<MenuItem Header="Move Block Down" Command="{Binding Data.MoveBlockDownCommand, Source={StaticResource proxy}}" Icon="{StaticResource MoveDownIcon}" />
|
||||
<MenuItem Header="Move Block To Bottom" Command="{Binding Data.MoveBlockToBottomCommand, Source={StaticResource proxy}}" Icon="{StaticResource MoveToBottomIcon}" />
|
||||
<Separator />
|
||||
<MenuItem Header="Replace Colors" Command="{Binding Data.ReplaceColorsCommand, Source={StaticResource proxy}}" Icon="{StaticResource ReplaceColorsIcon}" />
|
||||
</ContextMenu.Items>
|
||||
</ContextMenu>
|
||||
</Expander.ContextMenu>
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<!--<Border Grid.Row="0" BorderThickness="2" BorderBrush="SlateGray" CornerRadius="4" Margin="5,5,5,0">-->
|
||||
<Border Grid.Row="0" BorderThickness="1" BorderBrush="DarkGray" Margin="5,5,5,0">
|
||||
<StackPanel Margin="2,2,2,2">
|
||||
<Expander Style="{StaticResource ExpanderRightAlignStyle}">
|
||||
|
@ -45,7 +44,6 @@
|
|||
</Expander>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<!--<Border Grid.Row="1" BorderThickness="2" BorderBrush="SlateGray" CornerRadius="4" Margin="5,5,5,5">-->
|
||||
<Border Grid.Row="1" BorderThickness="1" BorderBrush="DarkGray" Margin="5,5,5,5" Padding="2">
|
||||
<DockPanel LastChildFill="True">
|
||||
<ToolBarTray DockPanel.Dock="Top">
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:MainWindowViewModel}"
|
||||
Title="{Binding WindowTitle}" Height="707" Width="930" BorderThickness="1" BorderBrush="Black">
|
||||
<Window.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
</Window.Resources>
|
||||
|
||||
<DockPanel>
|
||||
<Menu DockPanel.Dock="Top">
|
||||
<MenuItem Header="_File">
|
||||
|
@ -27,6 +31,9 @@
|
|||
<Separator />
|
||||
<MenuItem Header="Copy _Script" Command="{Binding CopyScriptCommand}" Icon="{StaticResource CopyIcon}" />
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Tools">
|
||||
<MenuItem Header="_Replace Colors" Command="{Binding ReplaceColorsCommand}" Icon="{StaticResource ReplaceColorsIcon}" />
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Help">
|
||||
<MenuItem Header="_About" Command="{Binding OpenAboutWindowCommand}" Icon="{StaticResource AboutIcon}" />
|
||||
</MenuItem>
|
||||
|
@ -38,22 +45,26 @@
|
|||
<Button Command="{Binding SaveScriptCommand}" Content="{StaticResource SaveIcon}" ToolTip="Save Script" />
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<controls:MetroTabControl ItemsSource="{Binding ScriptViewModels}" SelectedItem="{Binding CurrentScriptViewModel}" Name="TabControl">
|
||||
<TabControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" Margin="5,0,0,0">
|
||||
<TextBlock Text="{Binding DisplayName}" FontSize="16" VerticalAlignment="Center" Margin="0,0,3,0" />
|
||||
<userControls:CrossButton Height="12" Command="{Binding ElementName=TabControl, Path=DataContext.CloseScriptCommand}" CommandParameter="{Binding}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</TabControl.ItemTemplate>
|
||||
<TabControl.ContentTemplate>
|
||||
<DataTemplate>
|
||||
<controls:MetroContentControl>
|
||||
<views:LootFilterScriptView DataContext="{Binding}" />
|
||||
</controls:MetroContentControl>
|
||||
</DataTemplate>
|
||||
</TabControl.ContentTemplate>
|
||||
</controls:MetroTabControl>
|
||||
<Grid>
|
||||
<controls:MetroTabControl ItemsSource="{Binding ScriptViewModels}" SelectedItem="{Binding CurrentScriptViewModel}" Name="TabControl" Background="White">
|
||||
<TabControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" Margin="5,0,0,0">
|
||||
<TextBlock Text="{Binding DisplayName}" FontSize="16" VerticalAlignment="Center" Margin="0,0,3,0" />
|
||||
<userControls:CrossButton Height="12" Command="{Binding ElementName=TabControl, Path=DataContext.CloseScriptCommand}" CommandParameter="{Binding}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</TabControl.ItemTemplate>
|
||||
<TabControl.ContentTemplate>
|
||||
<DataTemplate>
|
||||
<controls:MetroContentControl>
|
||||
<views:LootFilterScriptView DataContext="{Binding}" />
|
||||
</controls:MetroContentControl>
|
||||
</DataTemplate>
|
||||
</TabControl.ContentTemplate>
|
||||
</controls:MetroTabControl>
|
||||
<TextBlock FontStyle="Italic" Margin="5" FontSize="13" Visibility="{Binding NoScriptsOpen, Converter={StaticResource BooleanToVisibilityConverter}}">Welcome to Filtration, to get started either
|
||||
<Hyperlink Command="{Binding NewScriptCommand}">create a new script</Hyperlink> or <Hyperlink Command="{Binding OpenScriptCommand}">open an existing script</Hyperlink></TextBlock>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</controls:MetroWindow>
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
<controls:MetroWindow x:Class="Filtration.Views.ReplaceColorsWindow"
|
||||
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:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:ReplaceColorsViewModel}"
|
||||
ShowMaxRestoreButton="False"
|
||||
Title="Replace Script Colors" Height="230" Width="500"
|
||||
BorderThickness="1" BorderBrush="Black"
|
||||
Loaded="ReplaceColorsWindow_OnLoaded">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="LootFilterBlockViewDictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid Margin="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"></ColumnDefinition>
|
||||
<ColumnDefinition Width="20"></ColumnDefinition>
|
||||
<ColumnDefinition Width="Auto"></ColumnDefinition>
|
||||
<ColumnDefinition Width="5"></ColumnDefinition>
|
||||
<ColumnDefinition></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox Grid.Row="0" Grid.Column="0" Content="Replace Text Color" IsChecked="{Binding ReplaceTextColor}" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" VerticalAlignment="Center">Existing Text Color</TextBlock>
|
||||
<xctk:ColorPicker Grid.Row="0" Grid.Column="4" SelectedColor="{Binding ReplaceColorsParameterSet.OldTextColor}" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="2" VerticalAlignment="Center">New Text Color</TextBlock>
|
||||
<xctk:ColorPicker Grid.Row="1" Grid.Column="4" SelectedColor="{Binding NewTextColor}" />
|
||||
|
||||
|
||||
<CheckBox Grid.Row="2" Grid.Column="0" Content="Replace Background Color" IsChecked="{Binding ReplaceBackgroundColor}" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="2" VerticalAlignment="Center">Existing Background Color</TextBlock>
|
||||
<xctk:ColorPicker Grid.Row="2" Grid.Column="4" SelectedColor="{Binding ReplaceColorsParameterSet.OldBackgroundColor}" />
|
||||
<TextBlock Grid.Row="3" Grid.Column="2" VerticalAlignment="Center">New Background Color</TextBlock>
|
||||
<xctk:ColorPicker Grid.Row="3" Grid.Column="4" SelectedColor="{Binding NewBackgroundColor}" />
|
||||
|
||||
<CheckBox Grid.Row="4" Grid.Column="0" Content="Replace Border Color" IsChecked="{Binding ReplaceBorderColor}" />
|
||||
<TextBlock Grid.Row="4" Grid.Column="2" VerticalAlignment="Center">Existing Border Color</TextBlock>
|
||||
<xctk:ColorPicker Grid.Row="4" Grid.Column="4" SelectedColor="{Binding ReplaceColorsParameterSet.OldBorderColor}" />
|
||||
<TextBlock Grid.Row="5" Grid.Column="2" VerticalAlignment="Center">New Border Color</TextBlock>
|
||||
<xctk:ColorPicker Grid.Row="5" Grid.Column="4" SelectedColor="{Binding NewBorderColor}" />
|
||||
|
||||
<Grid Grid.Row="6" Grid.Column="4">
|
||||
<Image Source="pack://application:,,,/resources/groundtile.png" Stretch="Fill" />
|
||||
<Border Padding="4,2,4,2" BorderThickness="2" BorderBrush="{Binding DisplayBorderColor, Converter={StaticResource ColorToSolidColorBrushConverter}}">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="{Binding DisplayBackgroundColor}" />
|
||||
</Border.Background>
|
||||
<TextBlock TextAlignment="Center" Text="Test Item Preview" Style="{StaticResource PathOfExileFont}">
|
||||
<TextBlock.Foreground>
|
||||
<SolidColorBrush Color="{Binding DisplayTextColor}" />
|
||||
</TextBlock.Foreground>
|
||||
</TextBlock>
|
||||
</Border>
|
||||
</Grid>
|
||||
<TextBlock Grid.Row="7" Grid.Column="2" VerticalAlignment="Center">Preview</TextBlock>
|
||||
<Button Grid.Row="7" Grid.Column="4" Command="{Binding ReplaceColorsCommand}">Replace Colors</Button>
|
||||
</Grid>
|
||||
</controls:MetroWindow>
|
|
@ -0,0 +1,20 @@
|
|||
using System.Windows;
|
||||
|
||||
namespace Filtration.Views
|
||||
{
|
||||
public partial class ReplaceColorsWindow
|
||||
{
|
||||
public ReplaceColorsWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ReplaceColorsWindow_OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var curApp = Application.Current;
|
||||
var mainWindow = curApp.MainWindow;
|
||||
Left = mainWindow.Left + (mainWindow.Width - ActualWidth) / 2;
|
||||
Top = mainWindow.Top + (mainWindow.Height - ActualHeight) / 2;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,6 +25,11 @@ namespace Filtration.WindsorInstallers
|
|||
.ImplementedBy<LootFilterScriptViewModel>()
|
||||
.LifeStyle.Transient);
|
||||
|
||||
container.Register(
|
||||
Component.For<IReplaceColorsViewModel>()
|
||||
.ImplementedBy<ReplaceColorsViewModel>()
|
||||
.LifeStyle.Singleton);
|
||||
|
||||
container.AddFacility<TypedFactoryFacility>();
|
||||
container.Register(
|
||||
Component.For<ILootFilterBlockViewModelFactory>().AsFactory());
|
||||
|
|
Loading…
Reference in New Issue