Cleaned up BlockItem classes, added BlockItemBase and pulled up ILootFilterBlockItem abstract members into it.
Added click toggle for Show/Hide as per suggestion from Antnee
This commit is contained in:
parent
270645623a
commit
0bab1e7c9a
|
@ -107,6 +107,7 @@
|
|||
<Compile Include="Extensions\EnumHelper.cs" />
|
||||
<Compile Include="Extensions\HyperlinkExtensions.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\ActionBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\BlockItemBase.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\ColorBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\DualIntegerBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\IntegerBlockItem.cs" />
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal class ActionBlockItem : ILootFilterBlockItem
|
||||
internal class ActionBlockItem : BlockItemBase
|
||||
{
|
||||
private BlockAction _action;
|
||||
|
||||
|
@ -28,17 +25,17 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||
}
|
||||
}
|
||||
|
||||
public string PrefixText
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return string.Empty; }
|
||||
}
|
||||
|
||||
public int MaximumAllowed
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public string DisplayHeading
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -46,7 +43,7 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||
}
|
||||
}
|
||||
|
||||
public string SummaryText
|
||||
public override string SummaryText
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -54,7 +51,7 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||
}
|
||||
}
|
||||
|
||||
public Color SummaryBackgroundColor
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -62,7 +59,7 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||
}
|
||||
}
|
||||
|
||||
public Color SummaryTextColor
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -70,15 +67,11 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||
}
|
||||
}
|
||||
|
||||
public int SortOrder { get { return 0; } }
|
||||
public override int SortOrder { get { return 0; } }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
public void ToggleAction()
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
Action = Action == BlockAction.Show ? BlockAction.Hide : BlockAction.Show;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class ColorBlockItem : ILootFilterBlockItem, IAudioVisualBlockItem
|
||||
internal abstract class ColorBlockItem : BlockItemBase, IAudioVisualBlockItem
|
||||
{
|
||||
private Color _color;
|
||||
|
||||
|
@ -18,19 +15,13 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||
Color = color;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
|
||||
public abstract string DisplayHeading { get; }
|
||||
|
||||
public string SummaryText
|
||||
public override string SummaryText
|
||||
{
|
||||
get { return string.Empty; }
|
||||
}
|
||||
|
||||
public Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
||||
public Color SummaryTextColor { get { return Colors.Transparent; } }
|
||||
public abstract int SortOrder { get; }
|
||||
public override Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
||||
public override Color SummaryTextColor { get { return Colors.Transparent; } }
|
||||
|
||||
public Color Color
|
||||
{
|
||||
|
@ -41,13 +32,5 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class DualIntegerBlockItem : ILootFilterBlockItem, IAudioVisualBlockItem
|
||||
internal abstract class DualIntegerBlockItem : BlockItemBase, IAudioVisualBlockItem
|
||||
{
|
||||
private int _value;
|
||||
private int _secondValue;
|
||||
|
@ -20,14 +17,9 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||
SecondValue = secondValue;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
public abstract string DisplayHeading { get; }
|
||||
|
||||
public string SummaryText { get { return string.Empty; } }
|
||||
public Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
||||
public Color SummaryTextColor { get { return Colors.Transparent; } }
|
||||
public abstract int SortOrder { get; }
|
||||
public override string SummaryText { get { return string.Empty; } }
|
||||
public override Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
||||
public override Color SummaryTextColor { get { return Colors.Transparent; } }
|
||||
|
||||
public int Value
|
||||
{
|
||||
|
@ -48,13 +40,5 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class IntegerBlockItem : ILootFilterBlockItem, IAudioVisualBlockItem
|
||||
internal abstract class IntegerBlockItem : BlockItemBase, IAudioVisualBlockItem
|
||||
{
|
||||
private int _value;
|
||||
|
||||
|
@ -18,15 +15,9 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||
Value = value;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
|
||||
public abstract string DisplayHeading { get; }
|
||||
|
||||
public string SummaryText { get { return string.Empty; } }
|
||||
public Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
||||
public Color SummaryTextColor { get { return Colors.Transparent; } }
|
||||
public abstract int SortOrder { get; }
|
||||
public override string SummaryText { get { return string.Empty; } }
|
||||
public override Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
||||
public override Color SummaryTextColor { get { return Colors.Transparent; } }
|
||||
|
||||
public abstract int Minimum { get; }
|
||||
public abstract int Maximum { get; }
|
||||
|
@ -40,13 +31,5 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
using Filtration.Enums;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class NumericFilterPredicateBlockItem : ILootFilterBlockItem
|
||||
internal abstract class NumericFilterPredicateBlockItem : BlockItemBase
|
||||
{
|
||||
private NumericFilterPredicate _filterPredicate;
|
||||
|
||||
|
@ -23,14 +19,6 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||
FilterPredicate.PropertyChanged += OnFilterPredicateChanged;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
public abstract string DisplayHeading { get; }
|
||||
public abstract string SummaryText { get; }
|
||||
public abstract Color SummaryBackgroundColor { get; }
|
||||
public abstract Color SummaryTextColor { get; }
|
||||
public abstract int SortOrder { get; }
|
||||
|
||||
public abstract int Minimum { get; }
|
||||
public abstract int Maximum { get; }
|
||||
|
||||
|
@ -49,13 +37,5 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||
OnPropertyChanged("FilterPredicate");
|
||||
OnPropertyChanged("SummaryText");
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,44 +1,22 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
using Filtration.Enums;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class SocketGroupBlockItemBase : ILootFilterBlockItem
|
||||
internal abstract class SocketGroupBlockItemBase : BlockItemBase
|
||||
{
|
||||
protected SocketGroupBlockItemBase()
|
||||
{
|
||||
SocketColorGroups = new ObservableCollection<List<SocketColor>>();
|
||||
SocketColorGroups.CollectionChanged += OnSocketColorGroupsCollectionChanged;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
public abstract string DisplayHeading { get; }
|
||||
|
||||
public abstract string SummaryText { get; }
|
||||
public abstract Color SummaryBackgroundColor { get; }
|
||||
public abstract Color SummaryTextColor { get; }
|
||||
public abstract int SortOrder { get; }
|
||||
public ObservableCollection<List<SocketColor>> SocketColorGroups { get; private set; }
|
||||
|
||||
private void OnSocketColorGroupsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged("SocketColorGroups");
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class StringListBlockItem : ILootFilterBlockItem
|
||||
internal abstract class StringListBlockItem : BlockItemBase
|
||||
{
|
||||
protected StringListBlockItem()
|
||||
{
|
||||
|
@ -15,14 +11,6 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||
Items.CollectionChanged += OnItemsCollectionChanged;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
public abstract string DisplayHeading { get; }
|
||||
|
||||
public abstract string SummaryText { get; }
|
||||
public abstract Color SummaryBackgroundColor { get; }
|
||||
public abstract Color SummaryTextColor { get; }
|
||||
public abstract int SortOrder { get; }
|
||||
public ObservableCollection<string> Items { get; protected set; }
|
||||
|
||||
private void OnItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
|
@ -30,13 +18,5 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||
OnPropertyChanged("Items");
|
||||
OnPropertyChanged("SummaryText");
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Filtration.Models.BlockItemTypes;
|
||||
using Filtration.ViewModels;
|
||||
using Filtration.Views;
|
||||
|
||||
namespace Filtration.Models
|
||||
{
|
||||
|
|
|
@ -3,8 +3,10 @@ using System.Collections.Generic;
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Models;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
using Filtration.Models.BlockItemTypes;
|
||||
using Filtration.Services;
|
||||
using Filtration.Views;
|
||||
|
@ -44,6 +46,7 @@ namespace Filtration.ViewModels
|
|||
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand);
|
||||
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand);
|
||||
AddFilterBlockItemCommand = new RelayCommand<Type>(OnAddFilterBlockItemCommand);
|
||||
ToggleBlockActionCommand = new RelayCommand(OnToggleBlockActionCommand);
|
||||
AddAudioVisualBlockItemCommand = new RelayCommand<Type>(OnAddAudioVisualBlockItemCommand);
|
||||
RemoveFilterBlockItemCommand = new RelayCommand<ILootFilterBlockItem>(OnRemoveFilterBlockItemCommand);
|
||||
RemoveAudioVisualBlockItemCommand = new RelayCommand<ILootFilterBlockItem>(OnRemoveAudioVisualBlockItemCommand);
|
||||
|
@ -77,6 +80,7 @@ namespace Filtration.ViewModels
|
|||
public RelayCommand MoveBlockDownCommand { get; private set; }
|
||||
public RelayCommand MoveBlockToTopCommand { get; private set; }
|
||||
public RelayCommand MoveBlockToBottomCommand { get; private set; }
|
||||
public RelayCommand ToggleBlockActionCommand { get; private set; }
|
||||
public RelayCommand ReplaceColorsCommand { get; private set; }
|
||||
public RelayCommand<Type> AddFilterBlockItemCommand { get; private set; }
|
||||
public RelayCommand<Type> AddAudioVisualBlockItemCommand { get; private set; }
|
||||
|
@ -245,6 +249,15 @@ namespace Filtration.ViewModels
|
|||
get { return Block.HasBlockItemOfType<SoundBlockItem>(); }
|
||||
}
|
||||
|
||||
private void OnToggleBlockActionCommand()
|
||||
{
|
||||
var actionBlock = Block.BlockItems.OfType<ActionBlockItem>().First();
|
||||
if (actionBlock != null)
|
||||
{
|
||||
actionBlock.ToggleAction();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAddFilterBlockItemCommand(Type blockItemType)
|
||||
{
|
||||
if (!AddBlockItemAllowed(blockItemType)) return;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
xmlns:blockItemTypes="clr-namespace:Filtration.Models.BlockItemTypes"
|
||||
xmlns:enums="clr-namespace:Filtration.Enums"
|
||||
xmlns:extensions="clr-namespace:Filtration.Extensions"
|
||||
xmlns:models="clr-namespace:Filtration.Models"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:LootFilterBlockViewModel}"
|
||||
d:DesignHeight="200" d:DesignWidth="800">
|
||||
|
@ -72,13 +73,24 @@
|
|||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ItemsControl.Resources>
|
||||
|
||||
|
||||
|
||||
<DataTemplate DataType="{x:Type blockItemBaseTypes:BlockItemBase}">
|
||||
<Border BorderBrush="Black" CornerRadius="4" Margin="0,2,2,2" BorderThickness="1" Background="{Binding SummaryBackgroundColor, Converter={StaticResource ColorToSolidColorBrushConverter}}">
|
||||
<TextBlock Text="{Binding SummaryText}" Margin="5,1,5,1" Foreground="{Binding SummaryTextColor, Converter={StaticResource ColorToSolidColorBrushConverter}}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type blockItemBaseTypes:ActionBlockItem}">
|
||||
<Button Command="{Binding ElementName=TopLevelGrid, Path=DataContext.ToggleBlockActionCommand}" Style="{StaticResource ChromelessButton}">
|
||||
<Border BorderBrush="Black" CornerRadius="4" Margin="0,2,2,2" BorderThickness="1" Background="{Binding SummaryBackgroundColor, Converter={StaticResource ColorToSolidColorBrushConverter}}">
|
||||
<TextBlock Text="{Binding SummaryText}" Margin="5,1,5,1" Foreground="{Binding SummaryTextColor, Converter={StaticResource ColorToSolidColorBrushConverter}}" />
|
||||
</Border>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
<!--</ItemsControl.ItemTemplate>-->
|
||||
</ItemsControl.Resources>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
|
||||
|
|
|
@ -21,6 +21,17 @@
|
|||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="ChromelessButton" TargetType="{x:Type Button}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border BorderThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<ContentPresenter/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<converters:IntToItemRarityConverter x:Key="IntToItemRarityConverter" />
|
||||
<converters:StringToVisibilityConverter x:Key="StringToVisibilityConverter" />
|
||||
<converters:BoolInverterConverter x:Key="BoolInverterConverter" />
|
||||
|
|
Loading…
Reference in New Issue