* Added default colours for TextColor, BorderColor and BackgroundColor block items (previously the default color was completely transparent)

* Bumped version to 1.0.0-beta3
This commit is contained in:
Ben Wallis 2018-09-28 17:47:23 +01:00
parent f51fe315ad
commit ac904c31ff
5 changed files with 34 additions and 41 deletions

View File

@ -7,6 +7,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
public BackgroundColorBlockItem() public BackgroundColorBlockItem()
{ {
Color = new Color { A = 240, R = 0, G = 0, B = 0 };
} }
public BackgroundColorBlockItem(Color color) : base(color) public BackgroundColorBlockItem(Color color) : base(color)

View File

@ -7,6 +7,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
public BorderColorBlockItem() public BorderColorBlockItem()
{ {
Color = new Color {A = 240, R = 0, G = 0, B = 0};
} }
public BorderColorBlockItem(Color color) : base(color) public BorderColorBlockItem(Color color) : base(color)

View File

@ -1,5 +1,6 @@
using System.Windows.Media; using System.Windows.Media;
using Filtration.ObjectModel.BlockItemBaseTypes; using Filtration.ObjectModel.BlockItemBaseTypes;
using Filtration.ObjectModel.Enums;
namespace Filtration.ObjectModel.BlockItemTypes namespace Filtration.ObjectModel.BlockItemTypes
{ {
@ -7,6 +8,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
public TextColorBlockItem() public TextColorBlockItem()
{ {
Color = PathOfExileNamedColors.Colors[PathOfExileNamedColor.WhiteItem];
} }
public TextColorBlockItem(Color color) : base(color) public TextColorBlockItem(Color color) : base(color)

View File

@ -11,7 +11,7 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.0")] [assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0-beta2")] [assembly: AssemblyInformationalVersion("1.0.0-beta3")]
[assembly: InternalsVisibleTo("Filtration.Tests")] [assembly: InternalsVisibleTo("Filtration.Tests")]
[assembly: InternalsVisibleTo("Filtration.ItemFilterPreview.Tests")] [assembly: InternalsVisibleTo("Filtration.ItemFilterPreview.Tests")]

View File

@ -15,6 +15,7 @@ using GalaSoft.MvvmLight.CommandWpf;
using GalaSoft.MvvmLight.Messaging; using GalaSoft.MvvmLight.Messaging;
using Microsoft.Win32; using Microsoft.Win32;
using Xceed.Wpf.Toolkit; using Xceed.Wpf.Toolkit;
using static System.Int32;
namespace Filtration.ViewModels namespace Filtration.ViewModels
{ {
@ -59,8 +60,7 @@ namespace Filtration.ViewModels
public override void Initialise(IItemFilterBlockBase itemFilterBlockBase, IItemFilterScriptViewModel parentScriptViewModel) public override void Initialise(IItemFilterBlockBase itemFilterBlockBase, IItemFilterScriptViewModel parentScriptViewModel)
{ {
var itemFilterBlock = itemFilterBlockBase as IItemFilterBlock; if (!(itemFilterBlockBase is IItemFilterBlock itemFilterBlock) || parentScriptViewModel == null)
if (itemFilterBlock == null || parentScriptViewModel == null)
{ {
throw new ArgumentNullException(nameof(itemFilterBlock)); throw new ArgumentNullException(nameof(itemFilterBlock));
} }
@ -136,7 +136,7 @@ namespace Filtration.ViewModels
public bool AudioVisualBlockItemsGridVisible public bool AudioVisualBlockItemsGridVisible
{ {
get { return _audioVisualBlockItemsGridVisible; } get => _audioVisualBlockItemsGridVisible;
set set
{ {
_audioVisualBlockItemsGridVisible = value; _audioVisualBlockItemsGridVisible = value;
@ -150,7 +150,7 @@ namespace Filtration.ViewModels
public bool DisplaySettingsPopupOpen public bool DisplaySettingsPopupOpen
{ {
get { return _displaySettingsPopupOpen; } get => _displaySettingsPopupOpen;
set set
{ {
_displaySettingsPopupOpen = value; _displaySettingsPopupOpen = value;
@ -205,7 +205,7 @@ namespace Filtration.ViewModels
public bool BlockEnabled public bool BlockEnabled
{ {
get { return Block.Enabled; } get => Block.Enabled;
set set
{ {
if (Block.Enabled != value) if (Block.Enabled != value)
@ -219,10 +219,7 @@ namespace Filtration.ViewModels
public string BlockDescription public string BlockDescription
{ {
get get => Block.Description;
{
return Block.Description;
}
set set
{ {
if (Block.Description != value) if (Block.Description != value)
@ -269,8 +266,7 @@ namespace Filtration.ViewModels
newBlockItem.PropertyChanged += OnBlockItemChanged; newBlockItem.PropertyChanged += OnBlockItemChanged;
var customSoundBlockItem = newBlockItem as CustomSoundBlockItem; if(newBlockItem is CustomSoundBlockItem customSoundBlockItem && _parentScriptViewModel.CustomSoundsAvailable.Count > 0)
if(customSoundBlockItem != null && _parentScriptViewModel.CustomSoundsAvailable.Count > 0)
{ {
customSoundBlockItem.Value = _parentScriptViewModel.CustomSoundsAvailable[0]; customSoundBlockItem.Value = _parentScriptViewModel.CustomSoundsAvailable[0];
} }
@ -364,17 +360,15 @@ namespace Filtration.ViewModels
private string ComputeFilePartFromNumber(string identifier) private string ComputeFilePartFromNumber(string identifier)
{ {
if (Int32.TryParse(identifier, out int x)) if (TryParse(identifier, out int x))
{ {
if (x <= 9) if (x <= 9)
{ {
return "AlertSound_0" + x + ".mp3"; return "AlertSound_0" + x + ".mp3";
} }
else
{
return "AlertSound_" + x + ".mp3"; return "AlertSound_" + x + ".mp3";
} }
}
return ""; return "";
} }
@ -431,12 +425,10 @@ namespace Filtration.ViewModels
{ {
return; return;
} }
else
{
_mediaPlayer.Open(new Uri(prefix + filePart, UriKind.Relative)); _mediaPlayer.Open(new Uri(prefix + filePart, UriKind.Relative));
_mediaPlayer.Play(); _mediaPlayer.Play();
} }
}
private void OnPlayPositionalSoundCommand() private void OnPlayPositionalSoundCommand()
{ {
@ -448,12 +440,10 @@ namespace Filtration.ViewModels
{ {
return; return;
} }
else
{
_mediaPlayer.Open(new Uri(prefix + filePart, UriKind.Relative)); _mediaPlayer.Open(new Uri(prefix + filePart, UriKind.Relative));
_mediaPlayer.Play(); _mediaPlayer.Play();
} }
}
private void OnBlockEnabledStatusChanged(object sender, EventArgs e) private void OnBlockEnabledStatusChanged(object sender, EventArgs e)
{ {
@ -462,13 +452,12 @@ namespace Filtration.ViewModels
private void OnBlockItemChanged(object sender, EventArgs e) private void OnBlockItemChanged(object sender, EventArgs e)
{ {
var itemFilterBlockItem = sender as IItemFilterBlockItem; if (sender is IItemFilterBlockItem itemFilterBlockItem && itemFilterBlockItem.IsDirty)
if ( itemFilterBlockItem != null && itemFilterBlockItem.IsDirty)
{ {
IsDirty = true; IsDirty = true;
} }
var customSoundBlockItem = sender as CustomSoundBlockItem;
if (customSoundBlockItem != null) if (sender is CustomSoundBlockItem customSoundBlockItem)
{ {
if (!string.IsNullOrWhiteSpace(customSoundBlockItem.Value) && _parentScriptViewModel.CustomSoundsAvailable.IndexOf(customSoundBlockItem.Value) < 0) if (!string.IsNullOrWhiteSpace(customSoundBlockItem.Value) && _parentScriptViewModel.CustomSoundsAvailable.IndexOf(customSoundBlockItem.Value) < 0)
{ {
@ -507,12 +496,11 @@ namespace Filtration.ViewModels
private void OnCustomSoundFileDialog() private void OnCustomSoundFileDialog()
{ {
OpenFileDialog fileDialog = new OpenFileDialog(); OpenFileDialog fileDialog = new OpenFileDialog {DefaultExt = ".mp3"};
fileDialog.DefaultExt = ".mp3"; var poePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\My Games\Path of Exile\";
var poePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString() + @"\My Games\Path of Exile\";
fileDialog.InitialDirectory = poePath; fileDialog.InitialDirectory = poePath;
Nullable<bool> result = fileDialog.ShowDialog(); bool? result = fileDialog.ShowDialog();
if (result == true) if (result == true)
{ {
var fileName = fileDialog.FileName; var fileName = fileDialog.FileName;
@ -533,7 +521,7 @@ namespace Filtration.ViewModels
private void OnPlayCustomSoundCommand() private void OnPlayCustomSoundCommand()
{ {
var poePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString() + @"\My Games\Path of Exile\"; var poePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\My Games\Path of Exile\";
var identifier = BlockItems.OfType<CustomSoundBlockItem>().First().Value; var identifier = BlockItems.OfType<CustomSoundBlockItem>().First().Value;
if(!Path.IsPathRooted(identifier)) if(!Path.IsPathRooted(identifier))
@ -569,9 +557,11 @@ namespace Filtration.ViewModels
var newGroup = new ItemFilterBlockGroup(BlockGroupSearch, null, AdvancedBlockGroup, false); var newGroup = new ItemFilterBlockGroup(BlockGroupSearch, null, AdvancedBlockGroup, false);
if (baseBlock.BlockGroup == null) if (baseBlock.BlockGroup == null)
{ {
baseBlock.BlockGroup = new ItemFilterBlockGroup("", null, false, true); baseBlock.BlockGroup = new ItemFilterBlockGroup("", null, false, true)
baseBlock.BlockGroup.IsShowChecked = baseBlock.Action == BlockAction.Show; {
baseBlock.BlockGroup.IsEnableChecked = BlockEnabled; IsShowChecked = baseBlock.Action == BlockAction.Show,
IsEnableChecked = BlockEnabled
};
} }
newGroup.AddOrJoinBlockGroup(baseBlock.BlockGroup); newGroup.AddOrJoinBlockGroup(baseBlock.BlockGroup);
blockToAdd.AddOrJoinBlockGroup(newGroup); blockToAdd.AddOrJoinBlockGroup(newGroup);
@ -611,8 +601,7 @@ namespace Filtration.ViewModels
private void UpdateBlockGroups() private void UpdateBlockGroups()
{ {
var baseBlock = Block as ItemFilterBlock; if (!(Block is ItemFilterBlock baseBlock))
if (baseBlock == null)
return; return;
var currentGroup = baseBlock.BlockGroup; var currentGroup = baseBlock.BlockGroup;