Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5dcdf0af9 | ||
|
|
da3759cd76 | ||
|
|
d586492de8 | ||
|
|
3337531161 | ||
|
|
0c470b3c97 | ||
|
|
3a60a5005b | ||
|
|
8b6207e334 | ||
|
|
fea6bf6da2 | ||
|
|
b6d1befd23 | ||
|
|
2475d90bac | ||
|
|
aae014b6e0 | ||
|
|
aadd56c473 | ||
|
|
8f533e8fd7 | ||
|
|
272b7e8360 |
@@ -49,11 +49,13 @@
|
||||
<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.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" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -64,6 +66,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\FileSystemService.cs" />
|
||||
<Compile Include="Services\MessageBoxService.cs" />
|
||||
<Compile Include="ViewModels\FiltrationViewModelBase.cs" />
|
||||
<Compile Include="ViewModels\PaneViewModel.cs" />
|
||||
<Compile Include="WindsorInstallers\ServicesInstaller.cs" />
|
||||
|
||||
17
Filtration.Common/Services/MessageBoxService.cs
Normal file
17
Filtration.Common/Services/MessageBoxService.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace Filtration.Common.Services
|
||||
{
|
||||
public interface IMessageBoxService
|
||||
{
|
||||
MessageBoxResult Show(string caption, string message, MessageBoxButton buttons, MessageBoxImage image);
|
||||
}
|
||||
|
||||
public class MessageBoxService : IMessageBoxService
|
||||
{
|
||||
public MessageBoxResult Show(string caption, string message, MessageBoxButton buttons, MessageBoxImage image)
|
||||
{
|
||||
return MessageBox.Show(message, caption, buttons, image);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,11 @@ namespace Filtration.Common.WindsorInstallers
|
||||
Component.For<IFileSystemService>()
|
||||
.ImplementedBy<FileSystemService>()
|
||||
.LifeStyle.Singleton);
|
||||
|
||||
container.Register(
|
||||
Component.For<IMessageBoxService>()
|
||||
.ImplementedBy<MessageBoxService>()
|
||||
.LifeStyle.Singleton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ namespace Filtration.Tests.Services
|
||||
{
|
||||
// Arrange
|
||||
var testInputData = @"<UpdateData>
|
||||
<CurrentVersion>0.2</CurrentVersion>
|
||||
<LatestVersionMajorPart>1</LatestVersionMajorPart>
|
||||
<LatestVersionMinorPart>3</LatestVersionMinorPart>
|
||||
<ReleaseDate>2015-07-01</ReleaseDate>
|
||||
<DownloadUrl>http://www.google.com</DownloadUrl>
|
||||
<ReleaseNotes>* Release notes line 1
|
||||
@@ -28,7 +29,8 @@ namespace Filtration.Tests.Services
|
||||
|
||||
var expectedResult = new UpdateData
|
||||
{
|
||||
CurrentVersion = 0.2m,
|
||||
LatestVersionMajorPart = 1,
|
||||
LatestVersionMinorPart = 3,
|
||||
DownloadUrl = "http://www.google.com",
|
||||
ReleaseDate = new DateTime(2015, 7, 1),
|
||||
ReleaseNotes = @"* Release notes line 1
|
||||
@@ -43,7 +45,8 @@ namespace Filtration.Tests.Services
|
||||
var result = service.DeserializeUpdateData(testInputData);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(expectedResult.CurrentVersion, result.CurrentVersion);
|
||||
Assert.AreEqual(expectedResult.LatestVersionMajorPart, result.LatestVersionMajorPart);
|
||||
Assert.AreEqual(expectedResult.LatestVersionMinorPart, result.LatestVersionMinorPart);
|
||||
Assert.AreEqual(expectedResult.DownloadUrl, result.DownloadUrl);
|
||||
Assert.AreEqual(expectedResult.ReleaseDate, result.ReleaseDate);
|
||||
Assert.AreEqual(expectedResult.ReleaseNotes, result.ReleaseNotes);
|
||||
|
||||
@@ -506,6 +506,7 @@ namespace Filtration.Tests.Translators
|
||||
t =>
|
||||
t.AddComponent(ThemeComponentType.TextColor, "Rare Item Text",
|
||||
new Color {A = 255, R = 255, G = 20, B = 100})).Returns(testComponent).Verifiable();
|
||||
_testUtility.MockThemeComponentListBuilder.SetupGet(t => t.IsInitialised).Returns(true);
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString);
|
||||
@@ -1460,6 +1461,23 @@ namespace Filtration.Tests.Translators
|
||||
Assert.AreEqual(0, testInputBlockItems.Count(b => b is BorderColorBlockItem));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReplaceColorBlockItemsFromString_ThemeComponentBuilderNotInitialised_DoesNotCallAddComponent()
|
||||
{
|
||||
// Arrange
|
||||
var testInputString = "SetTextColor 240 200 150 # Rarest Currency";
|
||||
|
||||
var testInputBlockItems = new ObservableCollection<IItemFilterBlockItem>();
|
||||
var testInputBlockItem = new TextColorBlockItem(Colors.Red);
|
||||
testInputBlockItems.Add(testInputBlockItem);
|
||||
_testUtility.MockThemeComponentListBuilder.Setup(t => t.AddComponent(It.IsAny<ThemeComponentType>(), It.IsAny<string>(), It.IsAny<Color>())).Verifiable();
|
||||
|
||||
// Act
|
||||
_testUtility.Translator.ReplaceColorBlockItemsFromString(testInputBlockItems, testInputString);
|
||||
|
||||
// Assert
|
||||
_testUtility.MockThemeComponentListBuilder.Verify(t => t.AddComponent(It.IsAny<ThemeComponentType>(), It.IsAny<string>(), It.IsAny<Color>()), Times.Never);
|
||||
}
|
||||
private class ItemFilterBlockTranslatorTestUtility
|
||||
{
|
||||
public ItemFilterBlockTranslatorTestUtility()
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Filtration.Tests.Translators
|
||||
var testInputColor = new Color();
|
||||
|
||||
var builder = new ThemeComponentListBuilder();
|
||||
builder.Initialise();
|
||||
|
||||
// Act
|
||||
var firstResult = builder.AddComponent(testInputTargetType, testInputComponentName, testInputColor);
|
||||
@@ -28,5 +29,32 @@ namespace Filtration.Tests.Translators
|
||||
// Assert
|
||||
Assert.AreSame(firstResult, secondResult);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsInitialised_NotInitialised_ReturnsFalse()
|
||||
{
|
||||
// Arrange
|
||||
var builder = new ThemeComponentListBuilder();
|
||||
|
||||
// Act
|
||||
var result = builder.IsInitialised;
|
||||
|
||||
// Assert
|
||||
Assert.IsFalse(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsInitialised_Initialised_ReturnsTrue()
|
||||
{
|
||||
// Arrange
|
||||
var builder = new ThemeComponentListBuilder();
|
||||
builder.Initialise();
|
||||
|
||||
// Act
|
||||
var result = builder.IsInitialised;
|
||||
|
||||
// Assert
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,10 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Filtration.Common\Filtration.Common.csproj">
|
||||
<Project>{8cb44f28-2956-4c2a-9314-72727262edd4}</Project>
|
||||
<Name>Filtration.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
|
||||
<Name>Filtration.ObjectModel</Name>
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.Common.Services;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
using Filtration.ThemeEditor.Services;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.ThemeEditor.Tests.Services
|
||||
@@ -27,8 +29,9 @@ namespace Filtration.ThemeEditor.Tests.Services
|
||||
var testInputThemeComponent = new ThemeComponent(ThemeComponentType.TextColor, "Test Component 1", testInputThemeComponentColor);
|
||||
testInputTheme.Components.Add(testInputThemeComponent);
|
||||
testInputBlockItem.ThemeComponent = testInputThemeComponent;
|
||||
var mockMessageBoxService = new Mock<IMessageBoxService>();
|
||||
|
||||
var service = new ThemeService();
|
||||
var service = new ThemeService(mockMessageBoxService.Object);
|
||||
|
||||
// Act
|
||||
service.ApplyThemeToScript(testInputTheme, testInputScript);
|
||||
@@ -54,8 +57,10 @@ namespace Filtration.ThemeEditor.Tests.Services
|
||||
var testInputBlockItemThemeComponent = new ThemeComponent(ThemeComponentType.TextColor, "Different Component", testInputThemeComponentColor);
|
||||
testInputTheme.Components.Add(testInputThemeComponent);
|
||||
testInputBlockItem.ThemeComponent = testInputBlockItemThemeComponent;
|
||||
|
||||
var mockMessageBoxService = new Mock<IMessageBoxService>();
|
||||
|
||||
var service = new ThemeService();
|
||||
var service = new ThemeService(mockMessageBoxService.Object);
|
||||
|
||||
// Act
|
||||
service.ApplyThemeToScript(testInputTheme, testInputScript);
|
||||
|
||||
@@ -54,6 +54,9 @@
|
||||
<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="NLog">
|
||||
<HintPath>..\packages\NLog.4.0.1\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using Filtration.Common.Services;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
@@ -16,6 +17,13 @@ namespace Filtration.ThemeEditor.Services
|
||||
|
||||
public class ThemeService : IThemeService
|
||||
{
|
||||
private readonly IMessageBoxService _messageBoxService;
|
||||
|
||||
public ThemeService(IMessageBoxService messageBoxService)
|
||||
{
|
||||
_messageBoxService = messageBoxService;
|
||||
}
|
||||
|
||||
public void ApplyThemeToScript(Theme theme, ItemFilterScript script)
|
||||
{
|
||||
var mismatchedComponents = false;
|
||||
@@ -58,9 +66,9 @@ namespace Filtration.ThemeEditor.Services
|
||||
|
||||
if (mismatchedComponents)
|
||||
{
|
||||
MessageBox.Show(
|
||||
_messageBoxService.Show("Possible Theme Mismatch",
|
||||
"Not all theme components had matches - are you sure this theme is designed for this script?",
|
||||
"Possible Theme Mismatch", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,11 @@ using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Filtration.Common.Services;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.Interface;
|
||||
using Filtration.ThemeEditor.Providers;
|
||||
using NLog;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
|
||||
namespace Filtration.ThemeEditor.ViewModels
|
||||
@@ -23,13 +25,18 @@ namespace Filtration.ThemeEditor.ViewModels
|
||||
|
||||
public class ThemeViewModel : PaneViewModel, IThemeViewModel
|
||||
{
|
||||
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private readonly IThemeProvider _themeProvider;
|
||||
private readonly IMessageBoxService _messageBoxService;
|
||||
private bool _filenameIsFake;
|
||||
private string _filePath;
|
||||
|
||||
public ThemeViewModel(IThemeProvider themeProvider)
|
||||
public ThemeViewModel(IThemeProvider themeProvider,
|
||||
IMessageBoxService messageBoxService)
|
||||
{
|
||||
_themeProvider = themeProvider;
|
||||
_messageBoxService = messageBoxService;
|
||||
|
||||
Components = new ObservableCollection<ThemeComponentViewModel>();
|
||||
|
||||
@@ -85,8 +92,12 @@ namespace Filtration.ThemeEditor.ViewModels
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(@"Error saving filter theme - " + e.Message, @"Save Error", MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
if (_logger.IsErrorEnabled)
|
||||
{
|
||||
_logger.Error(e);
|
||||
}
|
||||
|
||||
_messageBoxService.Show("Save Error", "Error saving filter theme - " + e.Message, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,19 +114,24 @@ namespace Filtration.ThemeEditor.ViewModels
|
||||
if (result != DialogResult.OK) return;
|
||||
|
||||
var previousFilePath = FilePath;
|
||||
//try
|
||||
//{
|
||||
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;
|
||||
//}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (_logger.IsErrorEnabled)
|
||||
{
|
||||
_logger.Error(e);
|
||||
}
|
||||
|
||||
_messageBoxService.Show("Save Error", "Error saving theme file - " + e.Message, MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
FilePath = previousFilePath;
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<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}" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding ComponentName}" ToolTip="{Binding ComponentName}" />
|
||||
<xctk:ColorPicker Grid.Row="2" Grid.Column="0" SelectedColor="{Binding Color}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -5,17 +5,37 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:viewModels="clr-namespace:Filtration.ThemeEditor.ViewModels"
|
||||
xmlns:views="clr-namespace:Filtration.ThemeEditor.Views"
|
||||
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:ThemeViewModel}"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<UserControl.Resources>
|
||||
<CollectionViewSource Source="{Binding Components}" x:Key="ComponentsViewSource">
|
||||
<CollectionViewSource.GroupDescriptions>
|
||||
<PropertyGroupDescription PropertyName="ComponentType" />
|
||||
</CollectionViewSource.GroupDescriptions>
|
||||
<CollectionViewSource.SortDescriptions>
|
||||
<componentModel:SortDescription PropertyName="ComponentType" />
|
||||
</CollectionViewSource.SortDescriptions>
|
||||
</CollectionViewSource>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
|
||||
<ItemsControl ItemsSource="{Binding Components}" Margin="10">
|
||||
<ItemsControl ItemsSource="{Binding Source={StaticResource ComponentsViewSource}}" Margin="10">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.GroupStyle>
|
||||
<GroupStyle>
|
||||
<GroupStyle.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock FontWeight="Bold" FontSize="15" Text="{Binding Path=Name}"/>
|
||||
</DataTemplate>
|
||||
</GroupStyle.HeaderTemplate>
|
||||
</GroupStyle>
|
||||
</ItemsControl.GroupStyle>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<views:ThemeComponentControl DataContext="{Binding}" Margin="10,5,10,5" />
|
||||
|
||||
@@ -6,4 +6,5 @@
|
||||
<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" />
|
||||
<package id="NLog" version="4.0.1" targetFramework="net451" />
|
||||
</packages>
|
||||
@@ -16,12 +16,15 @@
|
||||
<setting name="ExtraLineBetweenBlocks" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="SuppressUpdatesUpToVersion" serializeAs="String">
|
||||
<setting name="SuppressUpdatesUpToVersionMajorPart" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
<setting name="SuppressUpdates" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="SuppressUpdatesUpToVersionMinorPart" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
</Filtration.Properties.Settings>
|
||||
</userSettings>
|
||||
<runtime>
|
||||
|
||||
@@ -11,8 +11,25 @@
|
||||
<ResourceDictionary Source="Views/Styles/CheckBox.xaml" />
|
||||
<ResourceDictionary Source="Views/Styles/ListBoxItem.xaml" />
|
||||
<ResourceDictionary Source="Views/Styles/TreeViewItem.xaml" />
|
||||
|
||||
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Sizes.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.ComboBox.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.RadioButton.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Scrollbars.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.TextBox.xaml" />
|
||||
|
||||
<ResourceDictionary Source="Views/CrossButton.xaml" />
|
||||
<ResourceDictionary Source="Views/IconsDictionary.xaml" />
|
||||
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="ComboBox" BasedOn="{StaticResource MetroComboBox}" />
|
||||
<Style TargetType="ComboBoxItem" BasedOn="{StaticResource MetroComboBoxItem}" />
|
||||
<Style TargetType="ScrollBar" BasedOn="{StaticResource MetroScrollBar}" />
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource MetroTextBox}" />
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
@@ -14,15 +14,19 @@ using Filtration.Properties;
|
||||
using Filtration.ThemeEditor.ViewModels;
|
||||
using Filtration.ViewModels;
|
||||
using Filtration.Views;
|
||||
using NLog;
|
||||
|
||||
namespace Filtration
|
||||
{
|
||||
public partial class App
|
||||
{
|
||||
private IWindsorContainer _container;
|
||||
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private void Application_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
DispatcherUnhandledException += OnDispatcherUnhandledException;
|
||||
|
||||
_container = new WindsorContainer();
|
||||
|
||||
var propInjector = _container.Kernel.ComponentModelBuilder
|
||||
@@ -59,7 +63,6 @@ namespace Filtration
|
||||
Mapper.CreateMap<IThemeViewModel, Theme>();
|
||||
|
||||
Mapper.AssertConfigurationIsValid();
|
||||
DispatcherUnhandledException += OnDispatcherUnhandledException;
|
||||
|
||||
var mainWindow = _container.Resolve<IMainWindow>();
|
||||
mainWindow.Show();
|
||||
@@ -67,6 +70,7 @@ namespace Filtration
|
||||
|
||||
public void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
_logger.Fatal(e.Exception);
|
||||
var exception = e.Exception.Message + Environment.NewLine + e.Exception.StackTrace;
|
||||
var innerException = e.Exception.InnerException != null
|
||||
? e.Exception.InnerException.Message + Environment.NewLine +
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
public class BlockItemToRemoveEnabledVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var actionBlock = value as ActionBlockItem;
|
||||
|
||||
return actionBlock != null ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ using System.Windows.Data;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class BooleanVisibilityConverter : IValueConverter
|
||||
internal class BooleanVisibilityConverterCopy : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Windows.Data;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class BooleanVisibilityConverterCopy : IValueConverter
|
||||
internal class BooleanVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
|
||||
@@ -64,6 +64,12 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MahApps.Metro">
|
||||
<HintPath>..\packages\MahApps.Metro.1.1.2.0\lib\net45\MahApps.Metro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog">
|
||||
<HintPath>..\packages\NLog.4.0.1\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.ObjectModel" />
|
||||
@@ -78,7 +84,7 @@
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Fluent.Ribbon.3.4.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||
<HintPath>..\packages\MahApps.Metro.1.1.2.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -130,11 +136,13 @@
|
||||
<Compile Include="Converters\BooleanInverterConverter.cs" />
|
||||
<Compile Include="Converters\BooleanToBlockActionInverseConverter.cs" />
|
||||
<Compile Include="Converters\BooleanToBlockActionConverter.cs" />
|
||||
<Compile Include="Converters\BooleanVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\BooleanVisibilityConverterCopy.cs" />
|
||||
<Compile Include="Converters\BlockItemToRemoveEnabledVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\ColorToSolidColorBrushConverter.cs" />
|
||||
<Compile Include="Converters\HashSignRemovalConverter.cs" />
|
||||
<Compile Include="Converters\ItemRarityConverter.cs" />
|
||||
<Compile Include="Converters\BooleanVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\InverseBooleanVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\StringToVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\TreeViewMarginConverter.cs" />
|
||||
<Compile Include="Extensions\EnumerationExtension.cs" />
|
||||
@@ -152,6 +160,9 @@
|
||||
<Compile Include="Translators\ItemFilterScriptTranslator.cs" />
|
||||
<Compile Include="Translators\ThemeComponentListBuilder.cs" />
|
||||
<Compile Include="UserControls\AutoScrollingListBox.cs" />
|
||||
<Compile Include="UserControls\BlockItemControl.xaml.cs">
|
||||
<DependentUpon>BlockItemControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControls\CrossButton.cs" />
|
||||
<Compile Include="UserControls\EditableListBoxControl.xaml.cs">
|
||||
<DependentUpon>EditableListBoxControl.xaml</DependentUpon>
|
||||
@@ -186,6 +197,10 @@
|
||||
<Compile Include="Views\SettingsPageView.xaml.cs">
|
||||
<DependentUpon>SettingsPageView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="UserControls\BlockItemControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\Styles\ListBoxItem.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -194,9 +209,6 @@
|
||||
<DependentUpon>BlockGroupBrowserView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\BlockTemplateSelector.cs" />
|
||||
<Compile Include="Views\ItemFilterBlockDisplaySettingsView.xaml.cs">
|
||||
<DependentUpon>ItemFilterBlockDisplaySettingsView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ItemFilterScriptView.xaml.cs">
|
||||
<DependentUpon>ItemFilterScriptView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -256,6 +268,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\Styles\TextBox.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\Styles\TreeViewItem.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -280,10 +296,6 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ItemFilterBlockDisplaySettingsView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ToolPanes\BlockOutputPreviewView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -360,6 +372,12 @@
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<Content Include="NLog.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="NLog.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
|
||||
@@ -9,7 +9,8 @@ namespace Filtration.Models
|
||||
private string _releaseNotes;
|
||||
|
||||
public string DownloadUrl { get; set; }
|
||||
public decimal CurrentVersion { get; set; }
|
||||
public int LatestVersionMajorPart { get; set; }
|
||||
public int LatestVersionMinorPart { get; set; }
|
||||
public DateTime ReleaseDate { get; set; }
|
||||
|
||||
public string ReleaseNotes
|
||||
|
||||
22
Filtration/NLog.config
Normal file
22
Filtration/NLog.config
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log" >
|
||||
|
||||
<targets>
|
||||
<target xsi:type="File" name="fErrors" fileName="${basedir}/Filtration_errors_${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
<target xsi:type="File" name="fDebug" fileName="${basedir}/Filtration_debug_${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
|
||||
<!-- Uncomment the Debug line to enable Debug logging -->
|
||||
<!--<logger name="*" minlevel="Debug" writeTo="fDebug" final="true" />-->
|
||||
<logger name="*" minlevel="Error" writeTo="fErrors" />
|
||||
|
||||
</rules>
|
||||
</nlog>
|
||||
2479
Filtration/NLog.xsd
Normal file
2479
Filtration/NLog.xsd
Normal file
File diff suppressed because it is too large
Load Diff
@@ -50,7 +50,7 @@ using System.Windows;
|
||||
// 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("0.4.*")]
|
||||
[assembly: AssemblyVersion("0.6.*")]
|
||||
|
||||
[assembly: InternalsVisibleTo("Filtration.Tests")]
|
||||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
|
||||
18
Filtration/Properties/Settings.Designer.cs
generated
18
Filtration/Properties/Settings.Designer.cs
generated
@@ -50,12 +50,12 @@ namespace Filtration.Properties {
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||
public decimal SuppressUpdatesUpToVersion {
|
||||
public int SuppressUpdatesUpToVersionMajorPart {
|
||||
get {
|
||||
return ((decimal)(this["SuppressUpdatesUpToVersion"]));
|
||||
return ((int)(this["SuppressUpdatesUpToVersionMajorPart"]));
|
||||
}
|
||||
set {
|
||||
this["SuppressUpdatesUpToVersion"] = value;
|
||||
this["SuppressUpdatesUpToVersionMajorPart"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,5 +70,17 @@ namespace Filtration.Properties {
|
||||
this["SuppressUpdates"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||
public int SuppressUpdatesUpToVersionMinorPart {
|
||||
get {
|
||||
return ((int)(this["SuppressUpdatesUpToVersionMinorPart"]));
|
||||
}
|
||||
set {
|
||||
this["SuppressUpdatesUpToVersionMinorPart"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,14 @@
|
||||
<Setting Name="ExtraLineBetweenBlocks" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="SuppressUpdatesUpToVersion" Type="System.Decimal" Scope="User">
|
||||
<Setting Name="SuppressUpdatesUpToVersionMajorPart" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">0</Value>
|
||||
</Setting>
|
||||
<Setting Name="SuppressUpdates" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="SuppressUpdatesUpToVersionMinorPart" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">0</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -28,15 +28,7 @@ namespace Filtration.Repositories
|
||||
|
||||
public IItemFilterScriptViewModel LoadScriptFromFile(string path)
|
||||
{
|
||||
ItemFilterScript loadedScript;
|
||||
try
|
||||
{
|
||||
loadedScript = _itemFilterPersistenceService.LoadItemFilterScript(path);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new IOException("Error loading filter script - " + e.Message);
|
||||
}
|
||||
var loadedScript = _itemFilterPersistenceService.LoadItemFilterScript(path);
|
||||
|
||||
var newViewModel = _itemFilterScriptViewModelFactory.Create();
|
||||
newViewModel.Initialise(loadedScript, false);
|
||||
|
||||
@@ -23,6 +23,7 @@ Decoy Totem
|
||||
Desecrate
|
||||
Determination
|
||||
Detonate Dead
|
||||
Detonate Mines
|
||||
Devouring Totem
|
||||
Discharge
|
||||
Discipline
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using Filtration.Models;
|
||||
@@ -14,7 +13,8 @@ namespace Filtration.Services
|
||||
internal class UpdateCheckService : IUpdateCheckService
|
||||
{
|
||||
private readonly IHTTPService _httpService;
|
||||
private const string UpdateDataUrl = "http://ben-wallis.github.io/Filtration/filtration_version.xml";
|
||||
//private const string UpdateDataUrl = "http://ben-wallis.github.io/Filtration/filtration_version.xml";
|
||||
private const string UpdateDataUrl = "http://xvar.net/filtration_version.xml";
|
||||
|
||||
public UpdateCheckService(IHTTPService httpService)
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace Filtration.Translators
|
||||
{
|
||||
internal interface IItemFilterBlockTranslator
|
||||
{
|
||||
void InitialiseForExistingScript(ItemFilterScript script);
|
||||
ItemFilterBlock TranslateStringToItemFilterBlock(string inputString);
|
||||
string TranslateItemFilterBlockToString(ItemFilterBlock block);
|
||||
void ReplaceColorBlockItemsFromString(ObservableCollection<IItemFilterBlockItem> blockItems, string inputString);
|
||||
@@ -34,6 +35,12 @@ namespace Filtration.Translators
|
||||
_themeComponentListBuilder = themeComponentListBuilder;
|
||||
}
|
||||
|
||||
public void InitialiseForExistingScript(ItemFilterScript script)
|
||||
{
|
||||
_themeComponentListBuilder.Initialise(script.ThemeComponents);
|
||||
_blockGroupHierarchyBuilder.Initialise(script.ItemFilterBlockGroups.First());
|
||||
}
|
||||
|
||||
// This method converts a string into a ItemFilterBlock. This is used for pasting ItemFilterBlocks
|
||||
// and reading ItemFilterScripts from a file.
|
||||
public ItemFilterBlock TranslateStringToItemFilterBlock(string inputString)
|
||||
@@ -293,14 +300,17 @@ namespace Filtration.Translators
|
||||
{
|
||||
throw new Exception("Parsing error - unknown theme component type");
|
||||
}
|
||||
|
||||
blockItem.ThemeComponent = _themeComponentListBuilder.AddComponent(componentType, componentName, blockItem.Color);
|
||||
if (_themeComponentListBuilder.IsInitialised)
|
||||
{
|
||||
blockItem.ThemeComponent = _themeComponentListBuilder.AddComponent(componentType, componentName,
|
||||
blockItem.Color);
|
||||
}
|
||||
}
|
||||
|
||||
return blockItem;
|
||||
}
|
||||
|
||||
public void ReplaceColorBlockItemsFromString(ObservableCollection<IItemFilterBlockItem> blockItems , string inputString)
|
||||
public void ReplaceColorBlockItemsFromString(ObservableCollection<IItemFilterBlockItem> blockItems, string inputString)
|
||||
{
|
||||
// Reverse iterate to remove existing IAudioVisualBlockItems
|
||||
for (var idx = blockItems.Count - 1; idx >= 0; idx--)
|
||||
@@ -342,26 +352,7 @@ namespace Filtration.Translators
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ReplaceColorBlockItem<T>(ObservableCollection<IItemFilterBlockItem> blockItems, string inputString) where T : ColorBlockItem
|
||||
{
|
||||
var newBlockItem = GetColorBlockItemFromString<T>(inputString);
|
||||
var existingBlockItem = blockItems.OfType<T>().FirstOrDefault();
|
||||
blockItems.Remove(existingBlockItem);
|
||||
blockItems.Add(newBlockItem);
|
||||
}
|
||||
|
||||
private void ReplaceFontSizeBlockItem(ObservableCollection<IItemFilterBlockItem> blockItems, string inputString)
|
||||
{
|
||||
var match = Regex.Match(inputString, @"\s+(\d+)");
|
||||
if (!match.Success) return;
|
||||
|
||||
var newBlockItem = new FontSizeBlockItem(Convert.ToInt16(match.Value));
|
||||
var existingBlockItem = blockItems.OfType<FontSizeBlockItem>().FirstOrDefault();
|
||||
blockItems.Remove(existingBlockItem);
|
||||
blockItems.Add(newBlockItem);
|
||||
}
|
||||
|
||||
|
||||
private void AddBlockGroupToBlock(ItemFilterBlock block, string inputString)
|
||||
{
|
||||
var blockGroupStart = inputString.IndexOf("#", StringComparison.Ordinal);
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Filtration.Translators
|
||||
internal interface IThemeComponentListBuilder
|
||||
{
|
||||
void Initialise();
|
||||
void Initialise(List<ThemeComponent> themeComponents);
|
||||
bool IsInitialised { get; }
|
||||
ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, Color componentColor);
|
||||
List<ThemeComponent> GetComponents();
|
||||
void Cleanup();
|
||||
@@ -21,7 +23,14 @@ namespace Filtration.Translators
|
||||
|
||||
public ThemeComponentListBuilder()
|
||||
{
|
||||
_themeComponents = new List<ThemeComponent>();
|
||||
}
|
||||
|
||||
public bool IsInitialised
|
||||
{
|
||||
get
|
||||
{
|
||||
return _themeComponents != null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialise()
|
||||
@@ -29,6 +38,11 @@ namespace Filtration.Translators
|
||||
_themeComponents = new List<ThemeComponent>();
|
||||
}
|
||||
|
||||
public void Initialise(List<ThemeComponent> themeComponents)
|
||||
{
|
||||
_themeComponents = themeComponents;
|
||||
}
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
_themeComponents = null;
|
||||
|
||||
113
Filtration/UserControls/BlockItemControl.xaml
Normal file
113
Filtration/UserControls/BlockItemControl.xaml
Normal file
@@ -0,0 +1,113 @@
|
||||
<UserControl x:Class="Filtration.UserControls.BlockItemControl"
|
||||
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:userControls="clr-namespace:Filtration.UserControls"
|
||||
xmlns:blockItemBaseTypes="clr-namespace:Filtration.ObjectModel.BlockItemBaseTypes;assembly=Filtration.ObjectModel"
|
||||
xmlns:blockItemTypes="clr-namespace:Filtration.ObjectModel.BlockItemTypes;assembly=Filtration.ObjectModel"
|
||||
xmlns:extensions="clr-namespace:Filtration.Extensions"
|
||||
xmlns:enums="clr-namespace:Filtration.ObjectModel.Enums;assembly=Filtration.ObjectModel"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:views="clr-namespace:Filtration.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=userControls:BlockItemControl}"
|
||||
d:DesignHeight="200" d:DesignWidth="150">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="{x:Type Border}" x:Key="BlockItemBorder">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="BorderBrush" Value="Black" />
|
||||
<Setter Property="CornerRadius" Value="3" />
|
||||
<Setter Property="Margin" Value="0,0,5,5" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary Source="../Views/SharedResourcesDictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Border Style="{StaticResource BlockItemBorder}" Width="142">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Grid.Row="0" Background="PowderBlue" CornerRadius="3,3,0,0">
|
||||
<Grid Margin="3,0,3,0">
|
||||
<TextBlock Text="{Binding BlockItem.DisplayHeading}" Grid.Row="0" VerticalAlignment="Center" Foreground="Navy" />
|
||||
<userControls:CrossButton Grid.Row="0" Height="12" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding RemoveItemCommand}" CommandParameter="{Binding BlockItem}" Visibility="{Binding RemoveEnabled}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ContentControl Grid.Row="1" Content="{Binding BlockItem}" Name="BlockItemContentControl" Margin="3">
|
||||
<ContentControl.Resources>
|
||||
<!-- Action Template -->
|
||||
<DataTemplate DataType="{x:Type blockItemBaseTypes:ActionBlockItem}">
|
||||
<WrapPanel VerticalAlignment="Center" Margin="5,5,5,5">
|
||||
<RadioButton IsChecked="{Binding Action, Converter={StaticResource BooleanToBlockActionConverter}}" Margin="0,0,10,0">Show</RadioButton>
|
||||
<RadioButton IsChecked="{Binding Action, Converter={StaticResource BooleanToBlockActionInverseConverter}}">Hide</RadioButton>
|
||||
</WrapPanel>
|
||||
</DataTemplate>
|
||||
|
||||
<!-- NumericFilterPredicate Template -->
|
||||
<DataTemplate DataType="{x:Type blockItemBaseTypes:NumericFilterPredicateBlockItem}">
|
||||
<userControls:NumericFilterPredicateControl Margin="5,5,5,5" NumericFilterPredicate="{Binding FilterPredicate}" Minimum="{Binding Minimum, Mode=OneTime}" Maximum="{Binding Maximum, Mode=OneTime}" />
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Rarity Template -->
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:RarityBlockItem}">
|
||||
<StackPanel Orientation="Horizontal" Margin="5,5,5,5">
|
||||
<ComboBox ItemsSource="{Binding Source={extensions:Enumeration {x:Type enums:FilterPredicateOperator}}}"
|
||||
DisplayMemberPath="Description"
|
||||
SelectedValue="{Binding FilterPredicate.PredicateOperator}"
|
||||
SelectedValuePath="Value" Width="50" Margin="0,0,6,0" />
|
||||
<ComboBox ItemsSource="{Binding Source={extensions:Enumeration {x:Type enums:ItemRarity}}}"
|
||||
DisplayMemberPath="Description"
|
||||
SelectedValue="{Binding FilterPredicate.PredicateOperand, Converter={StaticResource IntToItemRarityConverter}}"
|
||||
SelectedValuePath="Value" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Class Template -->
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:ClassBlockItem}">
|
||||
<userControls:EditableListBoxControl Margin="5,5,5,5" ItemsSource="{Binding Items}" AutoCompleteItemsSource="{Binding ElementName=TopLevelGrid, Path=DataContext.AutoCompleteItemClasses}" />
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Base Type Template -->
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:BaseTypeBlockItem}">
|
||||
<userControls:EditableListBoxControl Margin="5,5,5,5" ItemsSource="{Binding Items}" AutoCompleteItemsSource="{Binding ElementName=TopLevelGrid, Path=DataContext.AutoCompleteItemBaseTypes}" />
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Socket Groups Template -->
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:SocketGroupBlockItem}">
|
||||
<userControls:EditableListBoxControl Margin="5,5,5,5" ItemsSource="{Binding Items}" />
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Color Template -->
|
||||
<DataTemplate DataType="{x:Type blockItemBaseTypes:ColorBlockItem}">
|
||||
<xctk:ColorPicker SelectedColor="{Binding Color}" AvailableColors="{Binding ElementName=BlockItemContentControl, Path=DataContext.AvailableColors }" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors"/>
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Font Size Template -->
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:FontSizeBlockItem}">
|
||||
<WrapPanel HorizontalAlignment="Left">
|
||||
<xctk:ShortUpDown Value="{Binding Value}" Minimum="{Binding Minimum}" Maximum="{Binding Maximum}" Width="50" />
|
||||
</WrapPanel>
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Sound Template -->
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:SoundBlockItem}">
|
||||
<WrapPanel HorizontalAlignment="Left">
|
||||
<Button Command="{Binding Path=DataContext.PlaySoundCommand, RelativeSource={RelativeSource AncestorType={x:Type views:ItemFilterBlockView}}}" Width="20" Height="20" Background="Transparent" BorderBrush="Transparent">
|
||||
<Image Source="/Filtration;component/Resources/Icons/speaker_icon.png" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
</Button>
|
||||
<ComboBox ItemsSource="{Binding ElementName=BlockItemContentControl, Path=DataContext.SoundsAvailable}" SelectedValue="{Binding Value}" Style="{StaticResource MetroComboBox}" />
|
||||
<xctk:ShortUpDown Value="{Binding Path=SecondValue}" Minimum="1" Maximum="100" HorizontalAlignment="Right" ToolTip="Volume"/>
|
||||
</WrapPanel>
|
||||
</DataTemplate>
|
||||
</ContentControl.Resources>
|
||||
</ContentControl>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
106
Filtration/UserControls/BlockItemControl.xaml.cs
Normal file
106
Filtration/UserControls/BlockItemControl.xaml.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using Filtration.Annotations;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.Views;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
using Xceed.Wpf.Toolkit;
|
||||
|
||||
namespace Filtration.UserControls
|
||||
{
|
||||
public partial class BlockItemControl : INotifyPropertyChanged
|
||||
{
|
||||
public BlockItemControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
(Content as FrameworkElement).DataContext = this;
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty BlockItemProperty = DependencyProperty.Register(
|
||||
"BlockItem",
|
||||
typeof(IItemFilterBlockItem),
|
||||
typeof(BlockItemControl),
|
||||
new FrameworkPropertyMetadata());
|
||||
|
||||
public static readonly DependencyProperty RemoveItemCommandProperty = DependencyProperty.Register(
|
||||
"RemoveItemCommand",
|
||||
typeof(RelayCommand<IItemFilterBlockItem>),
|
||||
typeof(BlockItemControl),
|
||||
new FrameworkPropertyMetadata());
|
||||
|
||||
public static readonly DependencyProperty RemoveEnabledProperty = DependencyProperty.Register(
|
||||
"RemoveEnabled",
|
||||
typeof(Visibility),
|
||||
typeof(BlockItemControl),
|
||||
new FrameworkPropertyMetadata());
|
||||
|
||||
public IItemFilterBlockItem BlockItem
|
||||
{
|
||||
get
|
||||
{
|
||||
return (IItemFilterBlockItem)GetValue(BlockItemProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(BlockItemProperty, value);
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public RelayCommand<IItemFilterBlockItem> RemoveItemCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return (RelayCommand<IItemFilterBlockItem>)GetValue(RemoveItemCommandProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(RemoveItemCommandProperty, value);
|
||||
}
|
||||
}
|
||||
public Visibility RemoveEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Visibility)GetValue(RemoveEnabledProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(RemoveEnabledProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ObservableCollection<ColorItem> AvailableColors
|
||||
{
|
||||
get
|
||||
{
|
||||
{
|
||||
return PathOfExileColors.DefaultColors;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<int> SoundsAvailable
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@
|
||||
<KeyBinding Key="Delete" Command="{Binding Path=DeleteItemCommand}" CommandParameter="{Binding ElementName=ControlListBox, Path=SelectedValue}" />
|
||||
</ListBox.InputBindings>
|
||||
</ListBox>
|
||||
<toolkit:AutoCompleteBox Grid.Row="1" Grid.Column="0" ItemsSource="{Binding AutoCompleteItemsSource}" FilterMode="Contains" Text="{Binding AddItemText, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" ></toolkit:AutoCompleteBox>
|
||||
<toolkit:AutoCompleteBox Grid.Row="1" Grid.Column="0" ItemsSource="{Binding AutoCompleteItemsSource}" FilterMode="Contains" Text="{Binding AddItemText, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
|
||||
<Button Grid.Row="1" Grid.Column="1" Command="{Binding AddItemCommand}" IsDefault="True">Add</Button>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace Filtration.UserControls
|
||||
InitializeComponent();
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
(Content as FrameworkElement).DataContext = this;
|
||||
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty TextColorProperty = DependencyProperty.Register(
|
||||
|
||||
@@ -63,6 +63,8 @@ namespace Filtration.ViewModels
|
||||
get { return _activeDocument; }
|
||||
set
|
||||
{
|
||||
if (value == _activeDocument) return;
|
||||
|
||||
_activeDocument = value;
|
||||
RaisePropertyChanged();
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace Filtration.ViewModels
|
||||
|
||||
private bool _displaySettingsPopupOpen;
|
||||
private bool _isExpanded;
|
||||
private bool _audioVisualBlockItemsGridVisible;
|
||||
|
||||
public ItemFilterBlockViewModel(IStaticDataService staticDataService, IReplaceColorsViewModel replaceColorsViewModel)
|
||||
{
|
||||
@@ -55,7 +56,7 @@ namespace Filtration.ViewModels
|
||||
ToggleBlockActionCommand = new RelayCommand(OnToggleBlockActionCommand);
|
||||
AddAudioVisualBlockItemCommand = new RelayCommand<Type>(OnAddAudioVisualBlockItemCommand);
|
||||
RemoveFilterBlockItemCommand = new RelayCommand<IItemFilterBlockItem>(OnRemoveFilterBlockItemCommand);
|
||||
RemoveAudioVisualBlockItemCommand = new RelayCommand<IItemFilterBlockItem>(OnRemoveAudioVisualBlockItemCommand);
|
||||
SwitchBlockItemsViewCommand = new RelayCommand(OnSwitchBlockItemsViewCommand);
|
||||
PlaySoundCommand = new RelayCommand(OnPlaySoundCommand, () => HasSound);
|
||||
}
|
||||
|
||||
@@ -93,8 +94,8 @@ namespace Filtration.ViewModels
|
||||
public RelayCommand<Type> AddFilterBlockItemCommand { get; private set; }
|
||||
public RelayCommand<Type> AddAudioVisualBlockItemCommand { get; private set; }
|
||||
public RelayCommand<IItemFilterBlockItem> RemoveFilterBlockItemCommand { get; private set; }
|
||||
public RelayCommand<IItemFilterBlockItem> RemoveAudioVisualBlockItemCommand { get; private set; }
|
||||
public RelayCommand PlaySoundCommand { get; private set; }
|
||||
public RelayCommand SwitchBlockItemsViewCommand { get; private set; }
|
||||
|
||||
public ItemFilterBlock Block { get; private set; }
|
||||
|
||||
@@ -120,6 +121,11 @@ namespace Filtration.ViewModels
|
||||
get { return Block.BlockItems.Where(b => !(b is IAudioVisualBlockItem)); }
|
||||
}
|
||||
|
||||
public IEnumerable<IItemFilterBlockItem> RegularBlockItems
|
||||
{
|
||||
get { return Block.BlockItems.Where(b => !(b is IAudioVisualBlockItem)); }
|
||||
}
|
||||
|
||||
public IEnumerable<IItemFilterBlockItem> AudioVisualBlockItems
|
||||
{
|
||||
get { return Block.BlockItems.Where(b => b is IAudioVisualBlockItem); }
|
||||
@@ -133,6 +139,20 @@ namespace Filtration.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool AudioVisualBlockItemsGridVisible
|
||||
{
|
||||
get { return _audioVisualBlockItemsGridVisible; }
|
||||
set
|
||||
{
|
||||
_audioVisualBlockItemsGridVisible = value;
|
||||
RaisePropertyChanged();
|
||||
if (value && IsExpanded == false)
|
||||
{
|
||||
IsExpanded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool DisplaySettingsPopupOpen
|
||||
{
|
||||
get { return _displaySettingsPopupOpen; }
|
||||
@@ -153,25 +173,6 @@ namespace Filtration.ViewModels
|
||||
get { return _staticDataService.ItemBaseTypes; }
|
||||
}
|
||||
|
||||
public List<int> SoundsAvailable
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<int>
|
||||
{
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public List<Type> BlockItemTypesAvailable
|
||||
{
|
||||
get
|
||||
@@ -293,7 +294,6 @@ namespace Filtration.ViewModels
|
||||
var fontSize = HasFontSize ? (BlockItems.OfType<FontSizeBlockItem>().First().Value / 1.8) : 19;
|
||||
|
||||
return fontSize;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,6 +302,11 @@ namespace Filtration.ViewModels
|
||||
get { return Block.HasBlockItemOfType<SoundBlockItem>(); }
|
||||
}
|
||||
|
||||
private void OnSwitchBlockItemsViewCommand()
|
||||
{
|
||||
AudioVisualBlockItemsGridVisible = !AudioVisualBlockItemsGridVisible;
|
||||
}
|
||||
|
||||
private void OnToggleBlockActionCommand()
|
||||
{
|
||||
var actionBlock = Block.BlockItems.OfType<ActionBlockItem>().First();
|
||||
@@ -323,6 +328,13 @@ namespace Filtration.ViewModels
|
||||
private void OnRemoveFilterBlockItemCommand(IItemFilterBlockItem blockItem)
|
||||
{
|
||||
BlockItems.Remove(blockItem);
|
||||
|
||||
if (blockItem is IAudioVisualBlockItem)
|
||||
{
|
||||
blockItem.PropertyChanged -= OnAudioVisualBlockItemChanged;
|
||||
OnAudioVisualBlockItemChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
IsDirty = true;
|
||||
}
|
||||
|
||||
@@ -333,15 +345,7 @@ namespace Filtration.ViewModels
|
||||
|
||||
newBlockItem.PropertyChanged += OnAudioVisualBlockItemChanged;
|
||||
BlockItems.Add(newBlockItem);
|
||||
OnAudioVisualBlockItemChanged(null, null);
|
||||
IsDirty = true;
|
||||
}
|
||||
|
||||
private void OnRemoveAudioVisualBlockItemCommand(IItemFilterBlockItem blockItem)
|
||||
{
|
||||
blockItem.PropertyChanged -= OnAudioVisualBlockItemChanged;
|
||||
BlockItems.Remove(blockItem);
|
||||
OnAudioVisualBlockItemChanged(null, null);
|
||||
OnAudioVisualBlockItemChanged(this, EventArgs.Empty);
|
||||
IsDirty = true;
|
||||
}
|
||||
|
||||
@@ -437,6 +441,7 @@ namespace Filtration.ViewModels
|
||||
|
||||
private void OnBlockItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
RaisePropertyChanged("RegularBlockItems");
|
||||
RaisePropertyChanged("SummaryBlockItems");
|
||||
RaisePropertyChanged("AudioVisualBlockItems");
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Windows.Data;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Castle.Core.Internal;
|
||||
using Filtration.Common.Services;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.Interface;
|
||||
using Filtration.ObjectModel;
|
||||
@@ -16,8 +17,8 @@ using Filtration.Services;
|
||||
using Filtration.Translators;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using NLog;
|
||||
using Clipboard = System.Windows.Clipboard;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
@@ -63,10 +64,13 @@ namespace Filtration.ViewModels
|
||||
|
||||
internal class ItemFilterScriptViewModel : PaneViewModel, IItemFilterScriptViewModel
|
||||
{
|
||||
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private readonly IItemFilterBlockViewModelFactory _itemFilterBlockViewModelFactory;
|
||||
private readonly IItemFilterBlockTranslator _blockTranslator;
|
||||
private readonly IAvalonDockWorkspaceViewModel _avalonDockWorkspaceViewModel;
|
||||
private readonly IItemFilterPersistenceService _persistenceService;
|
||||
private readonly IMessageBoxService _messageBoxService;
|
||||
|
||||
private bool _isDirty;
|
||||
private IItemFilterBlockViewModel _selectedBlockViewModel;
|
||||
@@ -78,13 +82,15 @@ namespace Filtration.ViewModels
|
||||
public ItemFilterScriptViewModel(IItemFilterBlockViewModelFactory itemFilterBlockViewModelFactory,
|
||||
IItemFilterBlockTranslator blockTranslator,
|
||||
IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel,
|
||||
IItemFilterPersistenceService persistenceService)
|
||||
IItemFilterPersistenceService persistenceService,
|
||||
IMessageBoxService messageBoxService)
|
||||
{
|
||||
_itemFilterBlockViewModelFactory = itemFilterBlockViewModelFactory;
|
||||
_blockTranslator = blockTranslator;
|
||||
_avalonDockWorkspaceViewModel = avalonDockWorkspaceViewModel;
|
||||
_avalonDockWorkspaceViewModel.ActiveDocumentChanged += OnActiveDocumentChanged;
|
||||
_persistenceService = persistenceService;
|
||||
_messageBoxService = messageBoxService;
|
||||
_itemFilterBlockViewModels = new ObservableCollection<IItemFilterBlockViewModel>();
|
||||
|
||||
ToggleShowAdvancedCommand = new RelayCommand<bool>(OnToggleShowAdvancedCommand);
|
||||
@@ -314,7 +320,7 @@ namespace Filtration.ViewModels
|
||||
}
|
||||
|
||||
Title = Filename;
|
||||
ContentId = "testcontentid";
|
||||
ContentId = "ScriptContentId";
|
||||
}
|
||||
|
||||
public void Save()
|
||||
@@ -334,8 +340,13 @@ namespace Filtration.ViewModels
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(@"Error saving filter file - " + e.Message, @"Save Error", MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
if (_logger.IsErrorEnabled)
|
||||
{
|
||||
_logger.Error(e);
|
||||
}
|
||||
|
||||
_messageBoxService.Show("Save Error", "Error saving filter file - " + e.Message, MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,7 +376,12 @@ namespace Filtration.ViewModels
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(@"Error saving filter file - " + e.Message, @"Save Error", MessageBoxButton.OK,
|
||||
if (_logger.IsErrorEnabled)
|
||||
{
|
||||
_logger.Error(e);
|
||||
}
|
||||
|
||||
_messageBoxService.Show("Save Error", "Error saving filter file - " + e.Message, MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
Script.FilePath = previousFilePath;
|
||||
}
|
||||
@@ -408,7 +424,8 @@ namespace Filtration.ViewModels
|
||||
|
||||
var messageText = "The following script validation errors occurred:" + Environment.NewLine + failures;
|
||||
|
||||
MessageBox.Show(messageText, "Script Validation Failure", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
_messageBoxService.Show("Script Validation Failure", messageText, MessageBoxButton.OK,
|
||||
MessageBoxImage.Exclamation);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -425,8 +442,9 @@ namespace Filtration.ViewModels
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = MessageBox.Show(@"Want to save your changes to this script?",
|
||||
@"Filtration", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
|
||||
var result = _messageBoxService.Show("Filtration",
|
||||
"Want to save your changes to this script?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case MessageBoxResult.Yes:
|
||||
@@ -520,29 +538,41 @@ namespace Filtration.ViewModels
|
||||
|
||||
public void PasteBlock(IItemFilterBlockViewModel targetBlockViewModel)
|
||||
{
|
||||
var clipboardText = Clipboard.GetText();
|
||||
if (clipboardText.IsNullOrEmpty()) return;
|
||||
|
||||
var translatedBlock = _blockTranslator.TranslateStringToItemFilterBlock(clipboardText);
|
||||
if (translatedBlock == null) return;
|
||||
|
||||
var vm = _itemFilterBlockViewModelFactory.Create();
|
||||
vm.Initialise(translatedBlock, this);
|
||||
|
||||
if (ItemFilterBlockViewModels.Count > 0)
|
||||
try
|
||||
{
|
||||
Script.ItemFilterBlocks.Insert(Script.ItemFilterBlocks.IndexOf(targetBlockViewModel.Block) + 1, translatedBlock);
|
||||
ItemFilterBlockViewModels.Insert(ItemFilterBlockViewModels.IndexOf(targetBlockViewModel) + 1, vm);
|
||||
var clipboardText = Clipboard.GetText();
|
||||
if (clipboardText.IsNullOrEmpty()) return;
|
||||
|
||||
_blockTranslator.InitialiseForExistingScript(Script);
|
||||
var translatedBlock = _blockTranslator.TranslateStringToItemFilterBlock(clipboardText);
|
||||
if (translatedBlock == null) return;
|
||||
|
||||
var vm = _itemFilterBlockViewModelFactory.Create();
|
||||
vm.Initialise(translatedBlock, this);
|
||||
|
||||
if (ItemFilterBlockViewModels.Count > 0)
|
||||
{
|
||||
Script.ItemFilterBlocks.Insert(Script.ItemFilterBlocks.IndexOf(targetBlockViewModel.Block) + 1,
|
||||
translatedBlock);
|
||||
ItemFilterBlockViewModels.Insert(ItemFilterBlockViewModels.IndexOf(targetBlockViewModel) + 1, vm);
|
||||
}
|
||||
else
|
||||
{
|
||||
Script.ItemFilterBlocks.Add(translatedBlock);
|
||||
ItemFilterBlockViewModels.Add(vm);
|
||||
}
|
||||
|
||||
SelectedBlockViewModel = vm;
|
||||
IsDirty = true;
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
Script.ItemFilterBlocks.Add(translatedBlock);
|
||||
ItemFilterBlockViewModels.Add(vm);
|
||||
_logger.Error(e);
|
||||
_messageBoxService.Show("Paste Error",
|
||||
e.Message + Environment.NewLine + e.StackTrace + Environment.NewLine +
|
||||
e.InnerException.Message + Environment.NewLine + e.InnerException.StackTrace, MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
}
|
||||
|
||||
SelectedBlockViewModel = vm;
|
||||
IsDirty = true;
|
||||
|
||||
}
|
||||
|
||||
private void OnMoveBlockToTopCommand()
|
||||
@@ -695,9 +725,10 @@ namespace Filtration.ViewModels
|
||||
|
||||
public void DeleteBlock(IItemFilterBlockViewModel targetBlockViewModel)
|
||||
{
|
||||
var result = MessageBox.Show("Are you sure you wish to delete this block?", "Delete Confirmation",
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
|
||||
var result = _messageBoxService.Show("Delete Confirmation", "Are you sure you wish to delete this block?",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
Script.ItemFilterBlocks.Remove(targetBlockViewModel.Block);
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal class LootFilterScriptViewModela : ILootFilterScriptViewModel
|
||||
{
|
||||
private readonly ILootFilterConditionViewModelFactory _lootFilterConditionViewModelFactory;
|
||||
|
||||
public LootFilterScriptViewModela(ILootFilterConditionViewModelFactory lootFilterConditionViewModelFactory)
|
||||
{
|
||||
_lootFilterConditionViewModelFactory = lootFilterConditionViewModelFactory;
|
||||
LootFilterConditionViewModels = new List<ILootFilterConditionViewModel>();
|
||||
|
||||
var testCondition = new LootFilterCondition
|
||||
{
|
||||
BackgroundColor = Colors.DarkCyan,
|
||||
TextColor = Colors.White,
|
||||
BorderColor = Colors.Red,
|
||||
Sockets =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.LessThanOrEqual, 5),
|
||||
LinkedSockets =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.Equal, 2),
|
||||
ItemRarity = new NumericFilterPredicate(FilterPredicateOperator.GreaterThan, (int) ItemRarity.Magic),
|
||||
FontSize = 10,
|
||||
Quality =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.GreaterThanOrEqual, 15),
|
||||
ItemLevel =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.GreaterThan, 50),
|
||||
DropLevel = new NumericFilterPredicate(),
|
||||
FilterDescription = "My Wicked Filter"
|
||||
};
|
||||
|
||||
var testCondition2 = new LootFilterCondition
|
||||
{
|
||||
BackgroundColor = Colors.Beige,
|
||||
TextColor = Colors.Blue,
|
||||
BorderColor = Colors.Black,
|
||||
Sockets =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.LessThan, 4),
|
||||
LinkedSockets =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.GreaterThanOrEqual, 3),
|
||||
FontSize = 12,
|
||||
Quality =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.GreaterThanOrEqual, 15),
|
||||
ItemLevel =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.Equal, 32),
|
||||
DropLevel = new NumericFilterPredicate(FilterPredicateOperator.GreaterThanOrEqual, 85),
|
||||
FilterDescription = "This is a test filter"
|
||||
};
|
||||
|
||||
|
||||
|
||||
var testCondition3 = new LootFilterCondition
|
||||
{
|
||||
BackgroundColor = Colors.Beige,
|
||||
TextColor = new Color { A = 128, R = 0, G = 0, B = 255},
|
||||
BorderColor = Colors.Black,
|
||||
Sockets =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.LessThan, 4),
|
||||
LinkedSockets =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.GreaterThanOrEqual, 3),
|
||||
FontSize = 12,
|
||||
Quality =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.GreaterThanOrEqual, 15),
|
||||
ItemLevel =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.Equal, 32),
|
||||
DropLevel = new NumericFilterPredicate(FilterPredicateOperator.GreaterThanOrEqual, 85),
|
||||
FilterDescription = "This is a test filter"
|
||||
};
|
||||
|
||||
var testConditionFilter = _lootFilterConditionViewModelFactory.Create();
|
||||
var testConditionFilter2 = _lootFilterConditionViewModelFactory.Create();
|
||||
var testConditionFilter3 = _lootFilterConditionViewModelFactory.Create();
|
||||
testConditionFilter.Initialise(testCondition);
|
||||
testConditionFilter2.Initialise(testCondition2);
|
||||
testConditionFilter3.Initialise(testCondition3);
|
||||
|
||||
testConditionFilter.Classes.Add("Test Class 1");
|
||||
testConditionFilter.Classes.Add("Test Class 2");
|
||||
testConditionFilter.Classes.Add("Test Class 3");
|
||||
testConditionFilter.Classes.Add("Test Class 4");
|
||||
testConditionFilter.Classes.Add("Test Class 5");
|
||||
testConditionFilter.Classes.Add("Test Class 6");
|
||||
testConditionFilter.Classes.Add("Test Class 7");
|
||||
testConditionFilter.Classes.Add("Test Class 8");
|
||||
testConditionFilter.Classes.Add("Test Class 9");
|
||||
testConditionFilter.Classes.Add("Test Class 10");
|
||||
testConditionFilter.BaseTypes.Add("Test Base Type 1");
|
||||
testConditionFilter.BaseTypes.Add("Test Base Type 2");
|
||||
LootFilterConditionViewModels.Add(testConditionFilter);
|
||||
LootFilterConditionViewModels.Add(testConditionFilter2);
|
||||
LootFilterConditionViewModels.Add(testConditionFilter3);
|
||||
}
|
||||
|
||||
public List<ILootFilterConditionViewModel> LootFilterConditionViewModels { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,11 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Filtration.Common.Services;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.Interface;
|
||||
using Filtration.Models;
|
||||
@@ -20,6 +21,7 @@ using Filtration.Translators;
|
||||
using Filtration.Views;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using NLog;
|
||||
using Clipboard = System.Windows.Clipboard;
|
||||
using OpenFileDialog = Microsoft.Win32.OpenFileDialog;
|
||||
|
||||
@@ -33,6 +35,8 @@ namespace Filtration.ViewModels
|
||||
|
||||
internal class MainWindowViewModel : FiltrationViewModelBase, IMainWindowViewModel
|
||||
{
|
||||
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private readonly IItemFilterScriptRepository _itemFilterScriptRepository;
|
||||
private readonly IItemFilterScriptTranslator _itemFilterScriptTranslator;
|
||||
private readonly IReplaceColorsViewModel _replaceColorsViewModel;
|
||||
@@ -42,6 +46,7 @@ namespace Filtration.ViewModels
|
||||
private readonly IThemeService _themeService;
|
||||
private readonly IUpdateCheckService _updateCheckService;
|
||||
private readonly IUpdateAvailableViewModel _updateAvailableViewModel;
|
||||
private readonly IMessageBoxService _messageBoxService;
|
||||
|
||||
public MainWindowViewModel(IItemFilterScriptRepository itemFilterScriptRepository,
|
||||
IItemFilterScriptTranslator itemFilterScriptTranslator,
|
||||
@@ -51,7 +56,8 @@ namespace Filtration.ViewModels
|
||||
IThemeProvider themeProvider,
|
||||
IThemeService themeService,
|
||||
IUpdateCheckService updateCheckService,
|
||||
IUpdateAvailableViewModel updateAvailableViewModel)
|
||||
IUpdateAvailableViewModel updateAvailableViewModel,
|
||||
IMessageBoxService messageBoxService)
|
||||
{
|
||||
_itemFilterScriptRepository = itemFilterScriptRepository;
|
||||
_itemFilterScriptTranslator = itemFilterScriptTranslator;
|
||||
@@ -62,6 +68,7 @@ namespace Filtration.ViewModels
|
||||
_themeService = themeService;
|
||||
_updateCheckService = updateCheckService;
|
||||
_updateAvailableViewModel = updateAvailableViewModel;
|
||||
_messageBoxService = messageBoxService;
|
||||
|
||||
NewScriptCommand = new RelayCommand(OnNewScriptCommand);
|
||||
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => ActiveDocumentIsScript);
|
||||
@@ -139,7 +146,6 @@ namespace Filtration.ViewModels
|
||||
}
|
||||
});
|
||||
CheckForUpdates();
|
||||
throw new Exception("Test of dispatcher exception handler");
|
||||
}
|
||||
|
||||
public RelayCommand OpenScriptCommand { get; private set; }
|
||||
@@ -176,35 +182,46 @@ namespace Filtration.ViewModels
|
||||
|
||||
public async void CheckForUpdates()
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var assemblyVersion = FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
var currentVersion = Convert.ToDecimal(assemblyVersion.FileMajorPart + "." + assemblyVersion.FileMinorPart);
|
||||
var assemblyVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
|
||||
|
||||
var result = await _updateCheckService.GetUpdateData();
|
||||
|
||||
try
|
||||
{
|
||||
if (result.CurrentVersion > currentVersion)
|
||||
if (result.LatestVersionMajorPart >= assemblyVersion.FileMajorPart &&
|
||||
result.LatestVersionMinorPart > assemblyVersion.FileMinorPart)
|
||||
{
|
||||
if (Settings.Default.SuppressUpdates == false ||
|
||||
Settings.Default.SuppressUpdatesUpToVersion < result.CurrentVersion)
|
||||
LatestVersionIsNewerThanSuppressedVersion(result))
|
||||
{
|
||||
Settings.Default.SuppressUpdates = false;
|
||||
Settings.Default.Save();
|
||||
var updateAvailableView = new UpdateAvailableView {DataContext = _updateAvailableViewModel};
|
||||
_updateAvailableViewModel.Initialise(result, currentVersion);
|
||||
_updateAvailableViewModel.Initialise(result, assemblyVersion.FileMajorPart,
|
||||
assemblyVersion.FileMinorPart);
|
||||
_updateAvailableViewModel.OnRequestClose += (s, e) => updateAvailableView.Close();
|
||||
updateAvailableView.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception e)
|
||||
{
|
||||
if (_logger.IsDebugEnabled)
|
||||
{
|
||||
_logger.Debug(e);
|
||||
}
|
||||
// We don't care if the update check fails, because it could fail for multiple reasons
|
||||
// including the user blocking Filtration in their firewall.
|
||||
}
|
||||
}
|
||||
|
||||
private bool LatestVersionIsNewerThanSuppressedVersion(UpdateData updateData)
|
||||
{
|
||||
return Settings.Default.SuppressUpdatesUpToVersionMajorPart < updateData.LatestVersionMajorPart ||
|
||||
(Settings.Default.SuppressUpdatesUpToVersionMajorPart <= updateData.LatestVersionMajorPart &&
|
||||
Settings.Default.SuppressUpdatesUpToVersionMinorPart < updateData.LatestVersionMinorPart);
|
||||
}
|
||||
|
||||
public ImageSource Icon { get; private set; }
|
||||
|
||||
public IAvalonDockWorkspaceViewModel AvalonDockWorkspaceViewModel
|
||||
@@ -302,9 +319,13 @@ namespace Filtration.ViewModels
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
MessageBox.Show(@"Error loading filter script - " + e.Message, @"Script Load Error",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
if (_logger.IsErrorEnabled)
|
||||
{
|
||||
_logger.Error(e);
|
||||
}
|
||||
_messageBoxService.Show("Script Load Error", "Error loading filter script - " + e.Message,
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -328,9 +349,13 @@ namespace Filtration.ViewModels
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
MessageBox.Show(@"Error loading filter theme - " + e.Message, @"Theme Load Error",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
if (_logger.IsErrorEnabled)
|
||||
{
|
||||
_logger.Error(e);
|
||||
}
|
||||
_messageBoxService.Show("Theme Load Error", "Error loading filter theme - " + e.Message,
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -353,15 +378,20 @@ namespace Filtration.ViewModels
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
MessageBox.Show(@"Error loading filter theme - " + e.Message, @"Theme Load Error",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
if (_logger.IsErrorEnabled)
|
||||
{
|
||||
_logger.Error(e);
|
||||
}
|
||||
_messageBoxService.Show("Theme Load Error", "Error loading filter theme - " + e.Message,
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var result = MessageBox.Show(@"Are you sure you wish to apply this theme to the current filter script?",
|
||||
@"Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
if (result == DialogResult.No)
|
||||
var result = _messageBoxService.Show("Confirm",
|
||||
"Are you sure you wish to apply this theme to the current filter script?", MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using Filtration.Common.Services;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.Properties;
|
||||
using Filtration.Services;
|
||||
@@ -14,10 +15,12 @@ namespace Filtration.ViewModels
|
||||
internal class SettingsPageViewModel : FiltrationViewModelBase, ISettingsPageViewModel
|
||||
{
|
||||
private readonly IItemFilterPersistenceService _itemFilterPersistenceService;
|
||||
private readonly IMessageBoxService _messageBoxService;
|
||||
|
||||
public SettingsPageViewModel(IItemFilterPersistenceService itemFilterPersistenceService)
|
||||
public SettingsPageViewModel(IItemFilterPersistenceService itemFilterPersistenceService, IMessageBoxService messageBoxService)
|
||||
{
|
||||
_itemFilterPersistenceService = itemFilterPersistenceService;
|
||||
_messageBoxService = messageBoxService;
|
||||
SaveCommand = new RelayCommand(OnSaveCommand);
|
||||
|
||||
DefaultFilterDirectory = Settings.Default.DefaultFilterDirectory;
|
||||
@@ -41,7 +44,7 @@ namespace Filtration.ViewModels
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
MessageBox.Show("The entered Default Filter Directory is invalid or does not exist.", "Error",
|
||||
_messageBoxService.Show("Error", "The entered Default Filter Directory is invalid or does not exist.",
|
||||
MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.Interface;
|
||||
using Filtration.ViewModels.ToolPanes;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
|
||||
@@ -31,7 +30,6 @@ namespace Filtration.ViewModels
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
private static void OnOpenScriptCommand()
|
||||
{
|
||||
Messenger.Default.Send(new NotificationMessage("OpenScript"));
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Filtration.Models;
|
||||
using Filtration.Properties;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
@@ -14,9 +9,9 @@ namespace Filtration.ViewModels
|
||||
internal interface IUpdateAvailableViewModel
|
||||
{
|
||||
event EventHandler OnRequestClose;
|
||||
void Initialise(UpdateData updateData, decimal currentVersion);
|
||||
decimal CurrentVersion { get; }
|
||||
decimal NewVersion { get; }
|
||||
void Initialise(UpdateData updateData, int currentVersionMajorPart, int currentVersionMinorPart);
|
||||
string CurrentVersion { get; }
|
||||
string NewVersion { get; }
|
||||
string ReleaseNotes { get; }
|
||||
DateTime ReleaseDate { get; }
|
||||
}
|
||||
@@ -24,7 +19,8 @@ namespace Filtration.ViewModels
|
||||
internal class UpdateAvailableViewModel : IUpdateAvailableViewModel
|
||||
{
|
||||
private UpdateData _updateData;
|
||||
private decimal _currentVersion;
|
||||
private int _currentVersionMajorPart;
|
||||
private int _currentVersionMinorPart;
|
||||
|
||||
public UpdateAvailableViewModel()
|
||||
{
|
||||
@@ -39,20 +35,21 @@ namespace Filtration.ViewModels
|
||||
public RelayCommand AskLaterCommand { get; private set; }
|
||||
public RelayCommand DownloadCommand { get; private set; }
|
||||
|
||||
public void Initialise(UpdateData updateData, decimal currentVersion)
|
||||
public void Initialise(UpdateData updateData, int currentVersionMajorPart, int currentVersionMinorPart)
|
||||
{
|
||||
_currentVersion = currentVersion;
|
||||
_currentVersionMajorPart = currentVersionMajorPart;
|
||||
_currentVersionMinorPart = currentVersionMinorPart;
|
||||
_updateData = updateData;
|
||||
}
|
||||
|
||||
public decimal CurrentVersion
|
||||
public string CurrentVersion
|
||||
{
|
||||
get { return _currentVersion; }
|
||||
get { return _currentVersionMajorPart + "." + _currentVersionMinorPart; }
|
||||
}
|
||||
|
||||
public decimal NewVersion
|
||||
public string NewVersion
|
||||
{
|
||||
get { return _updateData.CurrentVersion; }
|
||||
get { return _updateData.LatestVersionMajorPart + "." + _updateData.LatestVersionMinorPart; }
|
||||
}
|
||||
|
||||
public string ReleaseNotes
|
||||
@@ -73,7 +70,8 @@ namespace Filtration.ViewModels
|
||||
private void OnNeverAskAgainCommand()
|
||||
{
|
||||
Settings.Default.SuppressUpdates = true;
|
||||
Settings.Default.SuppressUpdatesUpToVersion = _updateData.CurrentVersion;
|
||||
Settings.Default.SuppressUpdatesUpToVersionMajorPart = _updateData.LatestVersionMajorPart;
|
||||
Settings.Default.SuppressUpdatesUpToVersionMinorPart = _updateData.LatestVersionMinorPart;
|
||||
Settings.Default.Save();
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<Grid>
|
||||
<!-- ReSharper disable once InconsistentNaming -->
|
||||
<xcad:DockingManager x:Name="dockManager"
|
||||
AnchorablesSource="{Binding Tools}"
|
||||
AnchorablesSource="{Binding Tools}"
|
||||
AllowMixedOrientation="True"
|
||||
DocumentsSource="{Binding OpenDocuments}"
|
||||
ActiveContent="{Binding ActiveDocument, Mode=TwoWay, Converter={StaticResource ActiveDocumentConverter}}" >
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
<UserControl x:Class="Filtration.Views.ItemFilterBlockDisplaySettingsView"
|
||||
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:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:userControls="clr-namespace:Filtration.UserControls"
|
||||
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
|
||||
xmlns:blockItembaseTypes="clr-namespace:Filtration.ObjectModel.BlockItemBaseTypes;assembly=Filtration.ObjectModel"
|
||||
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
|
||||
xmlns:blockItemTypes="clr-namespace:Filtration.ObjectModel.BlockItemTypes;assembly=Filtration.ObjectModel"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:ItemFilterBlockViewModel}"
|
||||
d:DesignHeight="120" d:DesignWidth="175">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="SharedResourcesDictionary.xaml" />
|
||||
<ResourceDictionary>
|
||||
<CollectionViewSource x:Key="AudioVisualBlockItemsViewSource" Source="{Binding AudioVisualBlockItems}">
|
||||
<CollectionViewSource.SortDescriptions>
|
||||
<componentModel:SortDescription PropertyName="SortOrder" />
|
||||
</CollectionViewSource.SortDescriptions>
|
||||
</CollectionViewSource>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Border BorderThickness="2" CornerRadius="4" BorderBrush="Black" Padding="4" Background="White">
|
||||
<Grid Background="White" Name="SettingsGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<ItemsControl ItemsSource="{Binding AudioVisualBlockItemTypesAvailable}" Grid.Row="0" Margin="0,0,0,5">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel></WrapPanel>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Margin="0,0,3,0">
|
||||
<Hyperlink Command="{Binding ElementName=SettingsGrid, Path=DataContext.AddAudioVisualBlockItemCommand}" CommandParameter="{Binding}">
|
||||
<TextBlock>+</TextBlock><TextBlock Text="{Binding Path=., Converter={StaticResource BlockItemTypeToStringConverter}}" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<ItemsControl Grid.Row="1" ItemsSource="{Binding Source={StaticResource AudioVisualBlockItemsViewSource}}" Grid.IsSharedSizeScope="True">
|
||||
<ItemsControl.Resources>
|
||||
<Style TargetType="{x:Type TextBlock}" x:Key="DisplayHeading">
|
||||
<Setter Property="Margin" Value="0,0,5,0" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
<DataTemplate DataType="{x:Type blockItembaseTypes:ColorBlockItem}">
|
||||
<Grid Margin="0,0,0,2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemTitleColumn" Width="*" />
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemValueColumn" Width="Auto" />
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemCloseColumn" Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding DisplayHeading}" Style="{StaticResource DisplayHeading}" />
|
||||
<xctk:ColorPicker Grid.Column="1" SelectedColor="{Binding Color}" HorizontalAlignment="Right" Width="100" AvailableColors="{Binding ElementName=SettingsGrid, Path=DataContext.AvailableColors}" ShowAvailableColors="True" AvailableColorsHeader="Path of Exile Colors"/>
|
||||
<userControls:CrossButton Grid.Column="2" Height="12" Command="{Binding ElementName=SettingsGrid, Path=DataContext.RemoveAudioVisualBlockItemCommand}" CommandParameter="{Binding}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type blockItembaseTypes:IntegerBlockItem}">
|
||||
<Grid Margin="0,0,0,2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemTitleColumn" Width="*" />
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemValueColumn" Width="Auto" />
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemCloseColumn" Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding DisplayHeading}" Style="{StaticResource DisplayHeading}" />
|
||||
<xctk:ShortUpDown Grid.Column="1" Value="{Binding Value}" Minimum="{Binding Minimum}" Maximum="{Binding Maximum}" Width="50" HorizontalAlignment="Right"/>
|
||||
<userControls:CrossButton Grid.Column="2" Height="12" Command="{Binding ElementName=SettingsGrid, Path=DataContext.RemoveAudioVisualBlockItemCommand}" CommandParameter="{Binding}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:SoundBlockItem}">
|
||||
<Grid Margin="0,0,0,2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemTitleColumn" Width="*" />
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemValueColumn" Width="Auto" />
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemCloseColumn" Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<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/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"/>
|
||||
</WrapPanel>
|
||||
<userControls:CrossButton Grid.Column="2" Grid.Row="0" Height="12" Command="{Binding ElementName=SettingsGrid, Path=DataContext.RemoveAudioVisualBlockItemCommand}" CommandParameter="{Binding}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.Resources>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace Filtration.Views
|
||||
{
|
||||
public partial class ItemFilterBlockDisplaySettingsView
|
||||
{
|
||||
public ItemFilterBlockDisplaySettingsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,7 @@
|
||||
xmlns:userControls="clr-namespace:Filtration.UserControls"
|
||||
xmlns:views="clr-namespace:Filtration.Views"
|
||||
xmlns:converters="clr-namespace:Filtration.Converters"
|
||||
xmlns:extensions="clr-namespace:Filtration.Extensions"
|
||||
xmlns:blockItemBaseTypes="clr-namespace:Filtration.ObjectModel.BlockItemBaseTypes;assembly=Filtration.ObjectModel"
|
||||
xmlns:blockItemTypes="clr-namespace:Filtration.ObjectModel.BlockItemTypes;assembly=Filtration.ObjectModel"
|
||||
xmlns:enums="clr-namespace:Filtration.ObjectModel.Enums;assembly=Filtration.ObjectModel"
|
||||
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:ItemFilterBlockViewModel}"
|
||||
@@ -22,7 +19,24 @@
|
||||
<ResourceDictionary>
|
||||
<views:BindingProxy x:Key="proxy" Data="{Binding}" />
|
||||
<converters:BlockGroupAdvancedFillColorConverter x:Key="BlockGroupAdvancedFillColorConverter" />
|
||||
|
||||
<Style TargetType="{x:Type ContentPresenter}" x:Key="BlockItemFadeInStyle">
|
||||
<Setter Property="LayoutTransform">
|
||||
<Setter.Value>
|
||||
<ScaleTransform x:Name="transform" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<EventTrigger RoutedEvent="Loaded">
|
||||
<EventTrigger.Actions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.5" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger.Actions>
|
||||
</EventTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
@@ -111,16 +125,22 @@
|
||||
|
||||
<!-- Item Preview Box -->
|
||||
<WrapPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<Image Source="/Filtration;component/Resources/Icons/speaker_icon.png"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Height="15" Width="15"
|
||||
Margin="0,0,3,0"
|
||||
Visibility="{Binding HasSound, Converter={StaticResource BooleanVisibilityConverter}}" />
|
||||
<Button Command="{Binding PlaySoundCommand}"
|
||||
Width="25"
|
||||
Height="25"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,0,3,0"
|
||||
Visibility="{Binding HasSound, Converter={StaticResource BooleanVisibilityConverter}}"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
ToolTip="Click to preview drop sound">
|
||||
<Image Source="/Filtration;component/Resources/Icons/speaker_icon.png" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
</Button>
|
||||
<ToggleButton Margin="0,2,2,2"
|
||||
Style="{StaticResource ChromelessToggleButton}"
|
||||
x:Name="ItemPreviewButton"
|
||||
IsChecked="{Binding DisplaySettingsPopupOpen, Mode=OneWayToSource}"
|
||||
IsChecked="{Binding AudioVisualBlockItemsGridVisible}"
|
||||
ToolTip="Click here to change color and font settings" Cursor="Hand" >
|
||||
<userControls:ItemPreviewControl TextColor="{Binding DisplayTextColor}"
|
||||
BackgroundColor="{Binding DisplayBackgroundColor}"
|
||||
@@ -128,200 +148,120 @@
|
||||
BlockFontSize="{Binding DisplayFontSize}" />
|
||||
</ToggleButton>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- AudioVisual BlockItem Settings Popup -->
|
||||
<Popup Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
PlacementTarget="{Binding ElementName=ItemPreviewButton}"
|
||||
Placement="Left"
|
||||
PopupAnimation="Slide"
|
||||
StaysOpen="False"
|
||||
IsOpen="{Binding DisplaySettingsPopupOpen}"
|
||||
AllowsTransparency="True"
|
||||
HorizontalOffset="-5"
|
||||
Width="250">
|
||||
<views:ItemFilterBlockDisplaySettingsView />
|
||||
</Popup>
|
||||
</Grid>
|
||||
</Expander.Header>
|
||||
<Grid Margin="10,5,10,5" x:Name="BlockItemsGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Add Block Item Links -->
|
||||
<ItemsControl ItemsSource="{Binding BlockItemTypesAvailable}" Grid.Row="0" Margin="0,0,0,10">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel></WrapPanel>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Margin="0,0,3,0">
|
||||
<Hyperlink Command="{Binding ElementName=TopLevelGrid, Path=DataContext.AddFilterBlockItemCommand}" CommandParameter="{Binding}">
|
||||
<TextBlock>+</TextBlock><TextBlock Text="{Binding Path=., Converter={StaticResource BlockItemTypeToStringConverter}}" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<Grid Grid.Row="0" Visibility="{Binding AudioVisualBlockItemsGridVisible, Converter={StaticResource InverseBooleanVisibilityConverter}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Right">
|
||||
<Hyperlink Command="{Binding SwitchBlockItemsViewCommand}">
|
||||
Switch to Appearance Block Items
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
|
||||
<!-- Block Items -->
|
||||
<WrapPanel Grid.Row="1" MaxHeight="200">
|
||||
<WrapPanel.Resources>
|
||||
<CollectionViewSource Source="{Binding BlockItems}" x:Key="BlockItemsCollectionViewSource">
|
||||
<CollectionViewSource.SortDescriptions>
|
||||
<componentModel:SortDescription PropertyName="SortOrder"/>
|
||||
</CollectionViewSource.SortDescriptions>
|
||||
</CollectionViewSource>
|
||||
</WrapPanel.Resources>
|
||||
<ItemsControl ItemsSource="{Binding Source={StaticResource BlockItemsCollectionViewSource}}">
|
||||
<!-- Add Block Item Links -->
|
||||
<ItemsControl ItemsSource="{Binding BlockItemTypesAvailable}" Grid.Row="0" Margin="0,0,0,10">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Vertical" />
|
||||
<WrapPanel></WrapPanel>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type ContentPresenter}">
|
||||
<Setter Property="LayoutTransform">
|
||||
<Setter.Value>
|
||||
<ScaleTransform x:Name="transform" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<EventTrigger RoutedEvent="Loaded">
|
||||
<EventTrigger.Actions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.5" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger.Actions>
|
||||
</EventTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ItemsControl.ItemContainerStyle>
|
||||
<ItemsControl.Resources>
|
||||
<Style TargetType="{x:Type Border}" x:Key="BlockItemBorder">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="BorderBrush" Value="Black" />
|
||||
<Setter Property="CornerRadius" Value="3" />
|
||||
<Setter Property="Width" Value="142" />
|
||||
<Setter Property="Margin" Value="0,0,5,5" />
|
||||
</Style>
|
||||
<DataTemplate DataType="{x:Type blockItemBaseTypes:ActionBlockItem}">
|
||||
<Border Style="{StaticResource BlockItemBorder}">
|
||||
<WrapPanel VerticalAlignment="Center" Margin="5,5,5,5">
|
||||
<RadioButton IsChecked="{Binding Action, Converter={StaticResource BooleanToBlockActionConverter}}" Margin="0,0,10,0">Show</RadioButton>
|
||||
<RadioButton IsChecked="{Binding Action, Converter={StaticResource BooleanToBlockActionInverseConverter}}">Hide</RadioButton>
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Margin="0,0,3,0">
|
||||
<Hyperlink Command="{Binding ElementName=TopLevelGrid, Path=DataContext.AddFilterBlockItemCommand}" CommandParameter="{Binding}">
|
||||
<TextBlock>+</TextBlock><TextBlock Text="{Binding Path=., Converter={StaticResource BlockItemTypeToStringConverter}}" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type blockItemBaseTypes:NumericFilterPredicateBlockItem}">
|
||||
<Border Style="{StaticResource BlockItemBorder}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="PowderBlue" CornerRadius="3,3,0,0">
|
||||
<Grid Margin="3,0,3,0">
|
||||
<TextBlock Text="{Binding DisplayHeading}" Grid.Row="0" VerticalAlignment="Center" Foreground="Navy" />
|
||||
<userControls:CrossButton Grid.Row="0" Height="12" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding ElementName=TopLevelGrid, Path=DataContext.RemoveFilterBlockItemCommand}" CommandParameter="{Binding}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<userControls:NumericFilterPredicateControl Grid.Row="1" Grid.Column="0" Margin="5,5,5,5" NumericFilterPredicate="{Binding FilterPredicate}" Minimum="{Binding Minimum, Mode=OneTime}" Maximum="{Binding Maximum, Mode=OneTime}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:RarityBlockItem}">
|
||||
<Border Style="{StaticResource BlockItemBorder}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="PowderBlue" CornerRadius="3,3,0,0">
|
||||
<Grid Margin="3,0,3,0">
|
||||
<TextBlock Text="{Binding DisplayHeading}" Grid.Row="0" VerticalAlignment="Center" Foreground="Navy" />
|
||||
<userControls:CrossButton Grid.Row="0" Height="12" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding ElementName=TopLevelGrid, Path=DataContext.RemoveFilterBlockItemCommand}" CommandParameter="{Binding}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" Margin="5,5,5,5">
|
||||
<ComboBox ItemsSource="{Binding Source={extensions:Enumeration {x:Type enums:FilterPredicateOperator}}}"
|
||||
DisplayMemberPath="Description"
|
||||
SelectedValue="{Binding FilterPredicate.PredicateOperator}"
|
||||
SelectedValuePath="Value" Width="50" Margin="0,0,6,0" />
|
||||
<ComboBox ItemsSource="{Binding Source={extensions:Enumeration {x:Type enums:ItemRarity}}}"
|
||||
DisplayMemberPath="Description"
|
||||
SelectedValue="{Binding FilterPredicate.PredicateOperand, Converter={StaticResource IntToItemRarityConverter}}"
|
||||
SelectedValuePath="Value" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<!-- TODO: Sort out these messy duplicated data templates -->
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:ClassBlockItem}">
|
||||
<Border Style="{StaticResource BlockItemBorder}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="PowderBlue" CornerRadius="3,3,0,0">
|
||||
<Grid Margin="3,0,3,0">
|
||||
<TextBlock Text="{Binding DisplayHeading}" Grid.Row="0" VerticalAlignment="Center" Foreground="Navy" />
|
||||
<userControls:CrossButton Grid.Row="0" Height="12" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding ElementName=TopLevelGrid, Path=DataContext.RemoveFilterBlockItemCommand}" CommandParameter="{Binding}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<userControls:EditableListBoxControl Grid.Row="1" Grid.Column="0" Margin="5,5,5,5" ItemsSource="{Binding Items}" AutoCompleteItemsSource="{Binding ElementName=TopLevelGrid, Path=DataContext.AutoCompleteItemClasses}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:BaseTypeBlockItem}">
|
||||
<Border Style="{StaticResource BlockItemBorder}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="PowderBlue" CornerRadius="3,3,0,0">
|
||||
<Grid Margin="3,0,3,0">
|
||||
<TextBlock Text="{Binding DisplayHeading}" Grid.Row="0" VerticalAlignment="Center" Foreground="Navy" />
|
||||
<userControls:CrossButton Grid.Row="0" Height="12" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding ElementName=TopLevelGrid, Path=DataContext.RemoveFilterBlockItemCommand}" CommandParameter="{Binding}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<userControls:EditableListBoxControl Grid.Row="1" Grid.Column="0" Margin="5,5,5,5" ItemsSource="{Binding Items}" AutoCompleteItemsSource="{Binding ElementName=TopLevelGrid, Path=DataContext.AutoCompleteItemBaseTypes}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:SocketGroupBlockItem}">
|
||||
<Border Style="{StaticResource BlockItemBorder}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="PowderBlue" CornerRadius="3,3,0,0">
|
||||
<Grid Margin="3,0,3,0">
|
||||
<TextBlock Text="{Binding DisplayHeading}" Grid.Row="0" VerticalAlignment="Center" Foreground="Navy" />
|
||||
<userControls:CrossButton Grid.Row="0" Height="12" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding ElementName=TopLevelGrid, Path=DataContext.RemoveFilterBlockItemCommand}" CommandParameter="{Binding}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<userControls:EditableListBoxControl Grid.Row="1" Grid.Column="0" Margin="5,5,5,5" ItemsSource="{Binding Items}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type blockItemBaseTypes:ColorBlockItem}" />
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:SoundBlockItem}" />
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:FontSizeBlockItem}" />
|
||||
</ItemsControl.Resources>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</WrapPanel>
|
||||
<Grid Grid.Row="2" Margin="0,5,0,5">
|
||||
|
||||
<!-- Block Items -->
|
||||
<WrapPanel Grid.Row="1" MaxHeight="200">
|
||||
<WrapPanel.Resources>
|
||||
<CollectionViewSource Source="{Binding RegularBlockItems}" x:Key="BlockItemsCollectionViewSource">
|
||||
<CollectionViewSource.SortDescriptions>
|
||||
<componentModel:SortDescription PropertyName="SortOrder"/>
|
||||
</CollectionViewSource.SortDescriptions>
|
||||
</CollectionViewSource>
|
||||
</WrapPanel.Resources>
|
||||
<ItemsControl ItemsSource="{Binding Source={StaticResource BlockItemsCollectionViewSource}}"
|
||||
ItemContainerStyle="{StaticResource BlockItemFadeInStyle}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Vertical" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<userControls:BlockItemControl BlockItem="{Binding}" RemoveItemCommand="{Binding ElementName=TopLevelGrid, Path=DataContext.RemoveFilterBlockItemCommand}" RemoveEnabled="{Binding Path=., Converter={StaticResource BlockItemToRemoveEnabledVisibilityConverter}}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
<Grid Grid.Row="0" Visibility="{Binding AudioVisualBlockItemsGridVisible, Converter={StaticResource BooleanVisibilityConverter}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Right">
|
||||
<Hyperlink Command="{Binding SwitchBlockItemsViewCommand}">
|
||||
Switch to Regular Block Items
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
<!-- Add AudioVisual Block Item Links -->
|
||||
<ItemsControl ItemsSource="{Binding AudioVisualBlockItemTypesAvailable}" Grid.Row="0" Margin="0,0,0,10">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel></WrapPanel>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Margin="0,0,3,0">
|
||||
<Hyperlink Command="{Binding ElementName=TopLevelGrid, Path=DataContext.AddAudioVisualBlockItemCommand}" CommandParameter="{Binding}">
|
||||
<TextBlock>+</TextBlock><TextBlock Text="{Binding Path=., Converter={StaticResource BlockItemTypeToStringConverter}}" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<!-- Block Items -->
|
||||
<WrapPanel Grid.Row="1" MaxHeight="200">
|
||||
<WrapPanel.Resources>
|
||||
<CollectionViewSource Source="{Binding AudioVisualBlockItems}" x:Key="BlockItemsCollectionViewSource">
|
||||
<CollectionViewSource.SortDescriptions>
|
||||
<componentModel:SortDescription PropertyName="SortOrder"/>
|
||||
</CollectionViewSource.SortDescriptions>
|
||||
</CollectionViewSource>
|
||||
</WrapPanel.Resources>
|
||||
<ItemsControl ItemsSource="{Binding Source={StaticResource BlockItemsCollectionViewSource}}"
|
||||
ItemContainerStyle="{StaticResource BlockItemFadeInStyle}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Vertical" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<userControls:BlockItemControl BlockItem="{Binding}" RemoveItemCommand="{Binding ElementName=TopLevelGrid, Path=DataContext.RemoveFilterBlockItemCommand}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
<Grid Grid.Row="1" Margin="0,5,0,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="50" d:DesignWidth="300">
|
||||
<UserControl.Resources>
|
||||
<Style TargetType="{x:Type TextBox}">
|
||||
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource MetroTextBox}">
|
||||
<Style.Setters>
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
|
||||
@@ -57,9 +57,9 @@
|
||||
Background="ForestGreen"
|
||||
BorderBrush="ForestGreen"
|
||||
x:Name="ScriptToolsGroup"
|
||||
Visibility="{Binding ActiveDocumentIsScript, Converter={StaticResource BooleanVisibilityConverterCopy}, ConverterParameter={x:Static Visibility.Hidden}, Mode=OneWay}" />
|
||||
Visibility="{Binding ActiveDocumentIsScript, Converter={StaticResource BooleanVisibilityConverterCopy}, Mode=OneWay}" />
|
||||
</fluent:Ribbon.ContextualGroups>
|
||||
<fluent:RibbonTabItem Header="Script Tools" ><!--Group="{Binding ElementName=ScriptToolsGroup}"-->
|
||||
<fluent:RibbonTabItem Header="Script Tools" Group="{Binding ElementName=ScriptToolsGroup}">
|
||||
<fluent:RibbonGroupBox Header="Clipboard">
|
||||
<fluent:Button Header="Copy Block" Command="{Binding CopyBlockCommand}" Icon="{StaticResource CopyIcon}" LargeIcon="{StaticResource CopyIcon}">
|
||||
</fluent:Button>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
xmlns:userControls="clr-namespace:Filtration.UserControls"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:ReplaceColorsViewModel}"
|
||||
Title="Replace Script Colors" Height="245" Width="515"
|
||||
Title="Replace Script Colors" Height="280" Width="540"
|
||||
BorderThickness="1" BorderBrush="Black"
|
||||
Loaded="ReplaceColorsWindow_OnLoaded" ResizeMode="CanMinimize">
|
||||
<!--ShowMaxRestoreButton="False"-->
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
<converters:BooleanToBlockActionInverseConverter x:Key="BooleanToBlockActionInverseConverter" />
|
||||
<converters:BlockItemTypeToStringConverter x:Key="BlockItemTypeToStringConverter" />
|
||||
<converters:BooleanVisibilityConverter x:Key="BooleanVisibilityConverter" />
|
||||
<converters:InverseBooleanVisibilityConverter x:Key="InverseBooleanVisibilityConverter" />
|
||||
<converters:BlockItemToRemoveEnabledVisibilityConverter x:Key="BlockItemToRemoveEnabledVisibilityConverter" />
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary Source="ExpanderStyle.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
@@ -26,4 +26,6 @@
|
||||
<SolidColorBrush x:Key="GrayBrush9" Color="{StaticResource Gray9}"/>
|
||||
<SolidColorBrush x:Key="GrayBrush10" Color="{StaticResource Gray10}"/>
|
||||
<SolidColorBrush x:Key="HighlightGrayBrush" Color="{StaticResource HighlightGray}" />
|
||||
<SolidColorBrush x:Key="TextBoxBackground" Color="#333337" />
|
||||
<SolidColorBrush x:Key="TextBoxBackgroundSelected" Color="#3F3F46" />
|
||||
</ResourceDictionary>
|
||||
84
Filtration/Views/Styles/TextBox.xaml
Normal file
84
Filtration/Views/Styles/TextBox.xaml
Normal file
@@ -0,0 +1,84 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style TargetType="TextBox">
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Setter Property="Foreground" Value="{StaticResource GrayBrush1}" />
|
||||
<Setter Property="CaretBrush" Value="{StaticResource GrayBrush1}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border BorderBrush="{StaticResource GrayBrush1}" BorderThickness="1">
|
||||
<Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
|
||||
<ScrollViewer x:Name="PART_ContentHost" Margin="1" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Background" Value="{StaticResource GrayBrush7}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsFocused" Value="true">
|
||||
<Setter Property="Background" Value="White" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!--<Style TargetType="TextBox"
|
||||
x:Key="SearchTextBox">
|
||||
<Setter Property="Background"
|
||||
Value="{StaticResource TextBoxBackground}" />
|
||||
<Setter Property="Foreground"
|
||||
Value="{StaticResource Foreground}" />
|
||||
<Setter Property="CaretBrush"
|
||||
Value="{StaticResource Foreground}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Grid Background="{TemplateBinding Background}"
|
||||
SnapsToDevicePixels="true">
|
||||
<TextBlock Foreground="{StaticResource SearchTextForeground}"
|
||||
Margin="5,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Name="search"
|
||||
Text="Search ..."
|
||||
Visibility="Hidden" />
|
||||
<ScrollViewer x:Name="PART_ContentHost"
|
||||
Margin="1" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="TextBox.Text"
|
||||
Value="">
|
||||
<Setter TargetName="search"
|
||||
Property="Visibility"
|
||||
Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="TextBox.Text"
|
||||
Value="{x:Null}">
|
||||
<Setter TargetName="search"
|
||||
Property="Visibility"
|
||||
Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="true">
|
||||
<Setter Property="Background"
|
||||
Value="{StaticResource TextBoxBackgroundSelected}" />
|
||||
<Setter TargetName="search"
|
||||
Property="Foreground"
|
||||
Value="{StaticResource GrayBrush6}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsFocused"
|
||||
Value="true">
|
||||
<Setter Property="Background"
|
||||
Value="{StaticResource TextBoxBackgroundSelected}" />
|
||||
<Setter TargetName="search"
|
||||
Property="Visibility"
|
||||
Value="Hidden" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>-->
|
||||
</ResourceDictionary>
|
||||
@@ -6,6 +6,10 @@
|
||||
<package id="CommonServiceLocator" version="1.3" targetFramework="net451" />
|
||||
<package id="Extended.Wpf.Toolkit" version="2.4" targetFramework="net451" />
|
||||
<package id="Fluent.Ribbon" version="3.4.0" targetFramework="net451" />
|
||||
<package id="MahApps.Metro" version="1.1.2.0" targetFramework="net451" />
|
||||
<package id="MvvmLightLibs" version="5.1.1.0" targetFramework="net451" />
|
||||
<package id="NLog" version="4.0.1" targetFramework="net451" />
|
||||
<package id="NLog.Config" version="4.0.1" targetFramework="net451" />
|
||||
<package id="NLog.Schema" version="4.0.1" targetFramework="net451" />
|
||||
<package id="WPFToolkit" version="3.5.50211.1" targetFramework="net451" />
|
||||
</packages>
|
||||
@@ -3,9 +3,9 @@
|
||||
Filtration is an editor for Path of Exile item filter scripts.
|
||||
|
||||
## Current Release
|
||||
<b>Installer (5.98mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.4/filtration_0.4_setup.exe">filtration_0.4_setup.exe</a>
|
||||
<b>Installer (6.01mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.5/filtration_0.5_setup.exe">filtration_0.5_setup.exe</a>
|
||||
|
||||
<b>Zip File (7.4mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.4/filtration_0.4.zip">filtration_0.4.zip</a>
|
||||
<b>Zip File (7.54mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.5/filtration_0.5.zip">filtration_0.5.zip</a>
|
||||
|
||||
## System Requirements
|
||||
Filtration requires .NET Framework 4.5.1 installed.
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
|
||||
</startup>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user