Fixed a crash when loading filters with custom sounds
This commit is contained in:
parent
fd2023598b
commit
6838cb12a8
@ -191,6 +191,8 @@ namespace Filtration.ViewModels
|
|||||||
|
|
||||||
Script = itemFilterScript;
|
Script = itemFilterScript;
|
||||||
_scriptCommandManager = Script.CommandManager;
|
_scriptCommandManager = Script.CommandManager;
|
||||||
|
InitialiseCustomSounds();
|
||||||
|
|
||||||
AddItemFilterBlockViewModels(Script.ItemFilterBlocks, -1);
|
AddItemFilterBlockViewModels(Script.ItemFilterBlocks, -1);
|
||||||
|
|
||||||
UpdateChildCount();
|
UpdateChildCount();
|
||||||
@ -206,8 +208,26 @@ namespace Filtration.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Script.ItemFilterBlocks.CollectionChanged += ItemFilterBlocksOnCollectionChanged;
|
||||||
|
|
||||||
|
_filenameIsFake = newScript;
|
||||||
|
|
||||||
|
if (newScript)
|
||||||
|
{
|
||||||
|
Script.FilePath = "Untitled.filter";
|
||||||
|
}
|
||||||
|
|
||||||
|
Title = Filename;
|
||||||
|
ContentId = "ScriptContentId";
|
||||||
|
|
||||||
|
CollapseAllSections();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitialiseCustomSounds()
|
||||||
|
{
|
||||||
_customSoundsAvailable = new ObservableCollection<string>();
|
_customSoundsAvailable = new ObservableCollection<string>();
|
||||||
|
_customSoundsAvailable.CollectionChanged += CustomSoundsAvailableOnCollectionChanged;
|
||||||
|
|
||||||
var poeFolderFiles = Directory.GetFiles(_persistenceService.ItemFilterScriptDirectory + "\\").Where(
|
var poeFolderFiles = Directory.GetFiles(_persistenceService.ItemFilterScriptDirectory + "\\").Where(
|
||||||
s => s.EndsWith(".mp3")
|
s => s.EndsWith(".mp3")
|
||||||
@ -223,21 +243,6 @@ namespace Filtration.ViewModels
|
|||||||
{
|
{
|
||||||
_customSoundsAvailable.Add(file.Replace(_persistenceService.ItemFilterScriptDirectory + "\\", ""));
|
_customSoundsAvailable.Add(file.Replace(_persistenceService.ItemFilterScriptDirectory + "\\", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
Script.ItemFilterBlocks.CollectionChanged += ItemFilterBlocksOnCollectionChanged;
|
|
||||||
_customSoundsAvailable.CollectionChanged += CustomSoundsAvailableOnCollectionChanged;
|
|
||||||
|
|
||||||
_filenameIsFake = newScript;
|
|
||||||
|
|
||||||
if (newScript)
|
|
||||||
{
|
|
||||||
Script.FilePath = "Untitled.filter";
|
|
||||||
}
|
|
||||||
|
|
||||||
Title = Filename;
|
|
||||||
ContentId = "ScriptContentId";
|
|
||||||
|
|
||||||
CollapseAllSections();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ItemFilterBlocksOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs)
|
private void ItemFilterBlocksOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user