From c260014a164e298896d1fa252fff62b3bde28305 Mon Sep 17 00:00:00 2001 From: azakhi Date: Thu, 30 Aug 2018 19:56:47 +0300 Subject: [PATCH] Add requested changes --- .../ViewModels/ItemFilterScriptViewModel.cs | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/Filtration/ViewModels/ItemFilterScriptViewModel.cs b/Filtration/ViewModels/ItemFilterScriptViewModel.cs index 3ad06e6..e915c76 100644 --- a/Filtration/ViewModels/ItemFilterScriptViewModel.cs +++ b/Filtration/ViewModels/ItemFilterScriptViewModel.cs @@ -180,21 +180,13 @@ namespace Filtration.ViewModels _scriptCommandManager = Script.CommandManager; AddItemFilterBlockViewModels(Script.ItemFilterBlocks, -1); - foreach(var block in Script.ItemFilterBlocks) + foreach(var block in Script.ItemFilterBlocks.OfType()) { - var itemBlock = block as IItemFilterBlock; - if(itemBlock != null) + foreach (var customSoundBlockItem in block.BlockItems.OfType()) { - foreach(var blockItem in itemBlock.BlockItems) + if (!string.IsNullOrWhiteSpace(customSoundBlockItem.Value) && CustomSoundsAvailable.IndexOf(customSoundBlockItem.Value) < 0) { - var customSoundBlockItem = blockItem as CustomSoundBlockItem; - if (customSoundBlockItem != null) - { - if (!string.IsNullOrWhiteSpace(customSoundBlockItem.Value) && _customSoundsAvailable.IndexOf(customSoundBlockItem.Value) < 0) - { - CustomSoundsAvailable.Add(customSoundBlockItem.Value); - } - } + CustomSoundsAvailable.Add(customSoundBlockItem.Value); } } } @@ -273,15 +265,11 @@ namespace Filtration.ViewModels var itemBlock = itemFilterBlock as IItemFilterBlock; if (itemBlock != null) { - foreach (var blockItem in itemBlock.BlockItems) + foreach (var customSoundBlockItem in itemBlock.BlockItems.OfType()) { - var customSoundBlockItem = blockItem as CustomSoundBlockItem; - if (customSoundBlockItem != null) + if (!string.IsNullOrWhiteSpace(customSoundBlockItem.Value) && CustomSoundsAvailable.IndexOf(customSoundBlockItem.Value) < 0) { - if (!string.IsNullOrWhiteSpace(customSoundBlockItem.Value) && _customSoundsAvailable.IndexOf(customSoundBlockItem.Value) < 0) - { - CustomSoundsAvailable.Add(customSoundBlockItem.Value); - } + CustomSoundsAvailable.Add(customSoundBlockItem.Value); } } }