8 Commits
0.16 ... 0.17

Author SHA1 Message Date
Ben Wallis
1ecec4e9dc Bumped version to 0.17 2017-12-08 17:58:53 +00:00
Ben Wallis
404a04c210 Merge pull request #51 from GlenCFL/fixes
0.16 Regression Fixing
2017-12-08 17:57:13 +00:00
GlenCFL
f1b2be7d74 Add in Ben's fix for Comments not setting dirty state. 2017-12-08 12:54:53 -05:00
GlenCFL
6393a53bf5 Remove code duplication. 2017-12-08 12:12:17 -05:00
GlenCFL
a0a72b5fe8 Mark comments as two way, fixing updating issues. 2017-12-08 10:44:22 -05:00
GlenCFL
d96234f099 Fix the contextual Delete Section command. 2017-12-08 09:15:01 -05:00
GlenCFL
07fdc2eb49 Fix the Add Section crash. 2017-12-08 07:41:16 -05:00
GlenCFL
86ff670fb0 Fix for the ShChaos sound not playing. 2017-12-08 01:42:00 -05:00
6 changed files with 210 additions and 111 deletions

View File

@@ -15,7 +15,10 @@ namespace Filtration.ObjectModel.Commands.ItemFilterScript
}
public void Execute()
{
_newItemFilterBlock = new ItemFilterCommentBlock(_itemFilterScript);
_newItemFilterBlock = new ItemFilterCommentBlock(_itemFilterScript)
{
Comment = string.Empty
};
if (_addAfterItemFilterBlock != null)
{
_itemFilterScript.ItemFilterBlocks.Insert(_itemFilterScript.ItemFilterBlocks.IndexOf(_addAfterItemFilterBlock) + 1, _newItemFilterBlock);

View File

@@ -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.16")]
[assembly: AssemblyVersion("0.17")]
[assembly: InternalsVisibleTo("Filtration.Tests")]
[assembly: InternalsVisibleTo("Filtration.ItemFilterPreview.Tests")]

View File

@@ -28,7 +28,6 @@ namespace Filtration.ViewModels
private readonly IStaticDataService _staticDataService;
private readonly IReplaceColorsViewModel _replaceColorsViewModel;
private readonly MediaPlayer _mediaPlayer = new MediaPlayer();
private IItemFilterScriptViewModel _parentScriptViewModel;
private bool _displaySettingsPopupOpen;
private bool _isExpanded;
@@ -39,17 +38,8 @@ namespace Filtration.ViewModels
_staticDataService = staticDataService;
_replaceColorsViewModel = replaceColorsViewModel;
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand);
PasteBlockCommand = new RelayCommand(OnPasteBlockCommand);
CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand);
PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand);
AddBlockCommand = new RelayCommand(OnAddBlockCommand);
AddSectionCommand = new RelayCommand(OnAddSectionCommand);
DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand);
MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand);
MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand);
MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand);
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand);
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand);
AddFilterBlockItemCommand = new RelayCommand<Type>(OnAddFilterBlockItemCommand);
ToggleBlockActionCommand = new RelayCommand(OnToggleBlockActionCommand);
@@ -82,17 +72,8 @@ namespace Filtration.ViewModels
base.Initialise(itemFilterBlock, parentScriptViewModel);
}
public RelayCommand CopyBlockCommand { get; }
public RelayCommand PasteBlockCommand { get; }
public RelayCommand CopyBlockStyleCommand { get; }
public RelayCommand PasteBlockStyleCommand { get; }
public RelayCommand AddBlockCommand { get; }
public RelayCommand AddSectionCommand { get; }
public RelayCommand DeleteBlockCommand { get; }
public RelayCommand MoveBlockUpCommand { get; }
public RelayCommand MoveBlockDownCommand { get; }
public RelayCommand MoveBlockToTopCommand { get; }
public RelayCommand MoveBlockToBottomCommand { get; }
public RelayCommand ToggleBlockActionCommand { get; }
public RelayCommand ReplaceColorsCommand { get; }
public RelayCommand<Type> AddFilterBlockItemCommand { get; }
@@ -231,7 +212,7 @@ namespace Filtration.ViewModels
public bool HasSound => Block.HasBlockItemOfType<SoundBlockItem>();
public bool HasPositionalSound => Block.HasBlockItemOfType<PositionalSoundBlockItem>();
public bool HasAudioVisualBlockItems => AudioVisualBlockItems.Any();
private void OnSwitchBlockItemsViewCommand()
@@ -338,63 +319,63 @@ namespace Filtration.ViewModels
return blockCount < blockItem.MaximumAllowed;
}
private string ComputeFilePartFromNumber(string identifier)
{
if (Int32.TryParse(identifier, out int x))
{
if (x <= 9)
{
return "AlertSound_0" + x + ".wav";
}
else
{
return "AlertSound_" + x + ".wav";
}
}
return "";
private string ComputeFilePartFromNumber(string identifier)
{
if (Int32.TryParse(identifier, out int x))
{
if (x <= 9)
{
return "AlertSound_0" + x + ".wav";
}
else
{
return "AlertSound_" + x + ".wav";
}
}
return "";
}
private string ComputeFilePartFromID(string identifier)
{
string filePart;
switch (identifier) {
case "ShGeneral":
filePart = "SH22General.wav";
break;
case "ShBlessed":
filePart = "SH22Blessed.wav";
break;
case "SH22Chaos":
filePart = "SH22Chaos.wav";
break;
case "ShDivine":
filePart = "SH22Divine.wav";
break;
case "ShExalted":
filePart = "SH22Exalted.wav";
break;
case "ShMirror":
filePart = "SH22Mirror.wav";
break;
case "ShAlchemy":
filePart = "SH22Alchemy.wav";
break;
case "ShFusing":
filePart = "SH22Fusing.wav";
break;
case "ShRegal":
filePart = "SH22Regal.wav";
break;
case "ShVaal":
filePart = "SH22Vaal.wav";
break;
default:
filePart = ComputeFilePartFromNumber(identifier);
break;
}
return filePart;
private string ComputeFilePartFromID(string identifier)
{
string filePart;
switch (identifier) {
case "ShGeneral":
filePart = "SH22General.wav";
break;
case "ShBlessed":
filePart = "SH22Blessed.wav";
break;
case "ShChaos":
filePart = "SH22Chaos.wav";
break;
case "ShDivine":
filePart = "SH22Divine.wav";
break;
case "ShExalted":
filePart = "SH22Exalted.wav";
break;
case "ShMirror":
filePart = "SH22Mirror.wav";
break;
case "ShAlchemy":
filePart = "SH22Alchemy.wav";
break;
case "ShFusing":
filePart = "SH22Fusing.wav";
break;
case "ShRegal":
filePart = "SH22Regal.wav";
break;
case "ShVaal":
filePart = "SH22Vaal.wav";
break;
default:
filePart = ComputeFilePartFromNumber(identifier);
break;
}
return filePart;
}
private void OnPlaySoundCommand()
@@ -403,32 +384,32 @@ namespace Filtration.ViewModels
var prefix = "Resources/AlertSounds/";
var filePart = ComputeFilePartFromID(identifier);
if (filePart == "")
{
return;
if (filePart == "")
{
return;
}
else
{
_mediaPlayer.Open(new Uri(prefix + filePart, UriKind.Relative));
_mediaPlayer.Play();
else
{
_mediaPlayer.Open(new Uri(prefix + filePart, UriKind.Relative));
_mediaPlayer.Play();
}
}
private void OnPlayPositionalSoundCommand()
{
var identifier = BlockItems.OfType<PositionalSoundBlockItem>().First().Value;
var prefix = "Resources/AlertSounds/";
var filePart = ComputeFilePartFromID(identifier);
if (filePart == "")
{
return;
}
else
{
_mediaPlayer.Open(new Uri(prefix + filePart, UriKind.Relative));
_mediaPlayer.Play();
}
private void OnPlayPositionalSoundCommand()
{
var identifier = BlockItems.OfType<PositionalSoundBlockItem>().First().Value;
var prefix = "Resources/AlertSounds/";
var filePart = ComputeFilePartFromID(identifier);
if (filePart == "")
{
return;
}
else
{
_mediaPlayer.Open(new Uri(prefix + filePart, UriKind.Relative));
_mediaPlayer.Play();
}
}
private void OnBlockItemChanged(object sender, EventArgs e)

View File

@@ -1,6 +1,7 @@
using System;
using Filtration.ObjectModel;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.CommandWpf;
namespace Filtration.ViewModels
{
@@ -16,14 +17,40 @@ namespace Filtration.ViewModels
{
private bool _isDirty;
public ItemFilterBlockViewModelBase()
{
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand);
PasteBlockCommand = new RelayCommand(OnPasteBlockCommand);
AddBlockCommand = new RelayCommand(OnAddBlockCommand);
AddSectionCommand = new RelayCommand(OnAddSectionCommand);
DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand);
MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand);
MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand);
MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand);
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand);
}
public virtual void Initialise(IItemFilterBlockBase itemfilterBlock, IItemFilterScriptViewModel itemFilterScriptViewModel)
{
BaseBlock = itemfilterBlock;
_parentScriptViewModel = itemFilterScriptViewModel;
}
public event EventHandler BlockBecameDirty;
public IItemFilterBlockBase BaseBlock { get; protected set; }
public IItemFilterScriptViewModel _parentScriptViewModel;
public RelayCommand CopyBlockCommand { get; }
public RelayCommand PasteBlockCommand { get; }
public RelayCommand AddBlockCommand { get; }
public RelayCommand AddSectionCommand { get; }
public RelayCommand DeleteBlockCommand { get; }
public RelayCommand MoveBlockUpCommand { get; }
public RelayCommand MoveBlockDownCommand { get; }
public RelayCommand MoveBlockToTopCommand { get; }
public RelayCommand MoveBlockToBottomCommand { get; }
public bool IsDirty
{
@@ -38,5 +65,50 @@ namespace Filtration.ViewModels
}
}
}
private void OnCopyBlockCommand()
{
_parentScriptViewModel.CopyBlock(this);
}
private void OnPasteBlockCommand()
{
_parentScriptViewModel.PasteBlock(this);
}
private void OnAddBlockCommand()
{
_parentScriptViewModel.AddBlock(this);
}
private void OnAddSectionCommand()
{
_parentScriptViewModel.AddCommentBlock(this);
}
private void OnDeleteBlockCommand()
{
_parentScriptViewModel.DeleteBlock(this);
}
private void OnMoveBlockUpCommand()
{
_parentScriptViewModel.MoveBlockUp(this);
}
private void OnMoveBlockDownCommand()
{
_parentScriptViewModel.MoveBlockDown(this);
}
private void OnMoveBlockToTopCommand()
{
_parentScriptViewModel.MoveBlockToTop(this);
}
private void OnMoveBlockToBottomCommand()
{
_parentScriptViewModel.MoveBlockToBottom(this);
}
}
}

View File

@@ -10,12 +10,9 @@ namespace Filtration.ViewModels
internal class ItemFilterCommentBlockViewModel : ItemFilterBlockViewModelBase, IItemFilterCommentBlockViewModel
{
public ItemFilterCommentBlockViewModel()
{
}
public override void Initialise(IItemFilterBlockBase itemfilterBlock, IItemFilterScriptViewModel itemFilterScriptViewModel)
{
_parentScriptViewModel = itemFilterScriptViewModel;
ItemFilterCommentBlock = itemfilterBlock as IItemFilterCommentBlock;
BaseBlock = ItemFilterCommentBlock;
@@ -24,6 +21,21 @@ namespace Filtration.ViewModels
public IItemFilterCommentBlock ItemFilterCommentBlock { get; private set; }
public string Comment => ItemFilterCommentBlock.Comment;
public string Comment
{
get
{
return ItemFilterCommentBlock.Comment;
}
set
{
if (ItemFilterCommentBlock.Comment != value)
{
ItemFilterCommentBlock.Comment = value;
IsDirty = true;
RaisePropertyChanged();
}
}
}
}
}

View File

@@ -4,16 +4,47 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
xmlns:views="clr-namespace:Filtration.Views"
xmlns:converters="clr-namespace:Filtration.Converters"
d:DataContext="{d:DesignInstance Type=viewModels:ItemFilterCommentBlockViewModel}"
mc:Ignorable="d"
d:DesignHeight="50" d:DesignWidth="300">
<UserControl.Resources>
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource MetroTextBox}">
<Style.Setters>
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
</Style.Setters>
</Style>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<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>
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource MetroTextBox}">
<Style.Setters>
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
</Style.Setters>
</Style>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ContextMenu>
@@ -45,7 +76,7 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBox Grid.Column ="0" Text="{Binding Comment, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" VerticalAlignment="Center" TextWrapping="Wrap" MinWidth="150"/>
<TextBox Grid.Column ="0" Text="{Binding Comment, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" VerticalAlignment="Center" TextWrapping="Wrap" MinWidth="150"/>
</Grid>
</Border>
</Grid>