commit
15c63fa222
|
@ -222,7 +222,7 @@
|
|||
<Button Grid.Column="0" Grid.Row="0" Command="{Binding Path=DataContext.PlayCustomSoundCommand, 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 Grid.Column="1" Grid.Row="0" ItemsSource="{Binding Path=DataContext.CustomSoundsAvailable, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType={x:Type views:ItemFilterBlockView}}}"
|
||||
<ComboBox Grid.Column="1" Grid.Row="0" ItemsSource="{Binding Path=DataContext.CustomSoundsAvailable, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType={x:Type views:ItemFilterScriptView}}}"
|
||||
SelectedValue="{Binding Value, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource MetroComboBox}"/>
|
||||
<Button Grid.Column="1" Grid.Row="0" Command="{Binding Path=DataContext.CustomSoundFileDialogCommand, RelativeSource={RelativeSource AncestorType={x:Type views:ItemFilterBlockView}}}"
|
||||
Width="20" Height="20" Background="Transparent" BorderBrush="Transparent" Margin="0,0,30,0" VerticalAlignment="Center" HorizontalAlignment="Right">
|
||||
|
|
|
@ -31,7 +31,6 @@ namespace Filtration.ViewModels
|
|||
private readonly IStaticDataService _staticDataService;
|
||||
private readonly IReplaceColorsViewModel _replaceColorsViewModel;
|
||||
private readonly MediaPlayer _mediaPlayer = new MediaPlayer();
|
||||
public static ObservableCollection<string> _customSoundsAvailable;
|
||||
|
||||
private bool _displaySettingsPopupOpen;
|
||||
private bool _isExpanded;
|
||||
|
@ -53,14 +52,6 @@ namespace Filtration.ViewModels
|
|||
PlayPositionalSoundCommand = new RelayCommand(OnPlayPositionalSoundCommand, () => HasPositionalSound);
|
||||
PlayCustomSoundCommand = new RelayCommand(OnPlayCustomSoundCommand, () => HasCustomSound);
|
||||
CustomSoundFileDialogCommand = new RelayCommand(OnCustomSoundFileDialog);
|
||||
|
||||
if(_customSoundsAvailable == null || _customSoundsAvailable.Count < 1)
|
||||
{
|
||||
_customSoundsAvailable = new ObservableCollection<string> {
|
||||
"1maybevaluable.mp3", "2currency.mp3", "3uniques.mp3", "4maps.mp3", "5highmaps.mp3",
|
||||
"6veryvaluable.mp3", "7chancing.mp3", "12leveling.mp3", "placeholder.mp3"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override void Initialise(IItemFilterBlockBase itemFilterBlockBase, IItemFilterScriptViewModel parentScriptViewModel)
|
||||
|
@ -80,15 +71,6 @@ namespace Filtration.ViewModels
|
|||
foreach (var blockItem in itemFilterBlock.BlockItems)
|
||||
{
|
||||
blockItem.PropertyChanged += OnBlockItemChanged;
|
||||
|
||||
var customSoundBlockItem = blockItem as CustomSoundBlockItem;
|
||||
if (customSoundBlockItem != null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(customSoundBlockItem.Value) && _customSoundsAvailable.IndexOf(customSoundBlockItem.Value) < 0)
|
||||
{
|
||||
_customSoundsAvailable.Add(customSoundBlockItem.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
base.Initialise(itemFilterBlock, parentScriptViewModel);
|
||||
}
|
||||
|
@ -237,8 +219,6 @@ namespace Filtration.ViewModels
|
|||
|
||||
public ObservableCollection<ColorItem> AvailableColors => PathOfExileColors.DefaultColors;
|
||||
|
||||
public ObservableCollection<string> CustomSoundsAvailable => _customSoundsAvailable;
|
||||
|
||||
public Color DisplayTextColor => Block.DisplayTextColor;
|
||||
public Color DisplayBackgroundColor => Block.DisplayBackgroundColor;
|
||||
public Color DisplayBorderColor => Block.DisplayBorderColor;
|
||||
|
@ -461,11 +441,10 @@ namespace Filtration.ViewModels
|
|||
var customSoundBlockItem = sender as CustomSoundBlockItem;
|
||||
if (customSoundBlockItem != null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(customSoundBlockItem.Value) && _customSoundsAvailable.IndexOf(customSoundBlockItem.Value) < 0)
|
||||
if (!string.IsNullOrWhiteSpace(customSoundBlockItem.Value) && _parentScriptViewModel.CustomSoundsAvailable.IndexOf(customSoundBlockItem.Value) < 0)
|
||||
{
|
||||
_customSoundsAvailable.Add(customSoundBlockItem.Value);
|
||||
_parentScriptViewModel.CustomSoundsAvailable.Add(customSoundBlockItem.Value);
|
||||
}
|
||||
RaisePropertyChanged(nameof(CustomSoundsAvailable));
|
||||
}
|
||||
Block.IsEdited = true;
|
||||
//if (sender is IAudioVisualBlockItem)
|
||||
|
@ -515,10 +494,9 @@ namespace Filtration.ViewModels
|
|||
|
||||
var customSoundBlockItem = BlockItems.First(b => b.GetType() == typeof(CustomSoundBlockItem)) as CustomSoundBlockItem;
|
||||
|
||||
if (CustomSoundsAvailable.IndexOf(fileName) < 0)
|
||||
if (_parentScriptViewModel.CustomSoundsAvailable.IndexOf(fileName) < 0)
|
||||
{
|
||||
CustomSoundsAvailable.Add(fileName);
|
||||
RaisePropertyChanged(nameof(CustomSoundsAvailable));
|
||||
_parentScriptViewModel.CustomSoundsAvailable.Add(fileName);
|
||||
}
|
||||
customSoundBlockItem.Value = fileName;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ using Filtration.Common.ViewModels;
|
|||
using Filtration.Interface;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.ObjectModel.Commands;
|
||||
using Filtration.ObjectModel.Commands.ItemFilterScript;
|
||||
using Filtration.Parser.Interface.Services;
|
||||
|
@ -34,6 +35,7 @@ namespace Filtration.ViewModels
|
|||
IItemFilterBlockViewModelBase SelectedBlockViewModel { get; set; }
|
||||
IItemFilterCommentBlockViewModel CommentBlockBrowserBrowserSelectedBlockViewModel { get; set; }
|
||||
IEnumerable<IItemFilterCommentBlockViewModel> ItemFilterCommentBlockViewModels { get; }
|
||||
ObservableCollection<string> CustomSoundsAvailable { get; }
|
||||
Predicate<IItemFilterBlockViewModel> BlockFilterPredicate { get; set; }
|
||||
|
||||
bool ShowAdvanced { get; }
|
||||
|
@ -106,6 +108,8 @@ namespace Filtration.ViewModels
|
|||
private Predicate<IItemFilterBlockViewModel> _blockFilterPredicate;
|
||||
private ICommandManager _scriptCommandManager;
|
||||
|
||||
private ObservableCollection<string> _customSoundsAvailable;
|
||||
|
||||
public ItemFilterScriptViewModel(IItemFilterBlockBaseViewModelFactory itemFilterBlockBaseViewModelFactory,
|
||||
IItemFilterBlockTranslator blockTranslator,
|
||||
IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel,
|
||||
|
@ -161,6 +165,11 @@ namespace Filtration.ViewModels
|
|||
IconSource = icon;
|
||||
|
||||
_viewItemFilterBlockViewModels = new ObservableCollection<IItemFilterBlockViewModelBase>();
|
||||
|
||||
_customSoundsAvailable = new ObservableCollection<string> {
|
||||
"1maybevaluable.mp3", "2currency.mp3", "3uniques.mp3", "4maps.mp3", "5highmaps.mp3",
|
||||
"6veryvaluable.mp3", "7chancing.mp3", "12leveling.mp3", "placeholder.mp3"
|
||||
};
|
||||
}
|
||||
|
||||
public void Initialise(IItemFilterScript itemFilterScript, bool newScript)
|
||||
|
@ -171,7 +180,19 @@ namespace Filtration.ViewModels
|
|||
_scriptCommandManager = Script.CommandManager;
|
||||
AddItemFilterBlockViewModels(Script.ItemFilterBlocks, -1);
|
||||
|
||||
foreach(var block in Script.ItemFilterBlocks.OfType<IItemFilterBlock>())
|
||||
{
|
||||
foreach (var customSoundBlockItem in block.BlockItems.OfType<CustomSoundBlockItem>())
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(customSoundBlockItem.Value) && CustomSoundsAvailable.IndexOf(customSoundBlockItem.Value) < 0)
|
||||
{
|
||||
CustomSoundsAvailable.Add(customSoundBlockItem.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Script.ItemFilterBlocks.CollectionChanged += ItemFilterBlocksOnCollectionChanged;
|
||||
_customSoundsAvailable.CollectionChanged += CustomSoundsAvailableOnCollectionChanged;
|
||||
|
||||
_filenameIsFake = newScript;
|
||||
|
||||
|
@ -211,6 +232,11 @@ namespace Filtration.ViewModels
|
|||
UpdateBlockModelsForView();
|
||||
}
|
||||
|
||||
private void CustomSoundsAvailableOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs)
|
||||
{
|
||||
RaisePropertyChanged(nameof(CustomSoundsAvailable));
|
||||
}
|
||||
|
||||
private void AddItemFilterBlockViewModels(IEnumerable<IItemFilterBlockBase> itemFilterBlocks, int addAtIndex)
|
||||
{
|
||||
var firstNewViewModel = true;
|
||||
|
@ -235,6 +261,18 @@ namespace Filtration.ViewModels
|
|||
SelectedBlockViewModel = vm;
|
||||
firstNewViewModel = false;
|
||||
}
|
||||
|
||||
var itemBlock = itemFilterBlock as IItemFilterBlock;
|
||||
if (itemBlock != null)
|
||||
{
|
||||
foreach (var customSoundBlockItem in itemBlock.BlockItems.OfType<CustomSoundBlockItem>())
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(customSoundBlockItem.Value) && CustomSoundsAvailable.IndexOf(customSoundBlockItem.Value) < 0)
|
||||
{
|
||||
CustomSoundsAvailable.Add(customSoundBlockItem.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,6 +331,16 @@ namespace Filtration.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<string> CustomSoundsAvailable
|
||||
{
|
||||
get => _customSoundsAvailable;
|
||||
set
|
||||
{
|
||||
_customSoundsAvailable = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<IItemFilterBlockViewModelBase> ViewItemFilterBlockViewModels
|
||||
{
|
||||
get
|
||||
|
|
Loading…
Reference in New Issue