public void MoveBlockToBottom(IItemFilterBlockViewModel targetBlockViewModel) { var currentIndex = ItemFilterBlockViewModels.IndexOf(targetBlockViewModel); if (currentIndex < ItemFilterBlockViewModels.Count - 1) { var block = targetBlockViewModel.Block; Script.ItemFilterBlocks.Remove(block); Script.ItemFilterBlocks.Add(block); ItemFilterBlockViewModels.Move(currentIndex, ItemFilterBlockViewModels.Count - 1); IsDirty = true; RaisePropertyChanged("ItemFilterSectionViewModels"); } }
public void MoveBlockToTop(IItemFilterBlockViewModel targetBlockViewModel) { var currentIndex = ItemFilterBlockViewModels.IndexOf(targetBlockViewModel); if (currentIndex > 0) { var block = targetBlockViewModel.Block; Script.ItemFilterBlocks.Remove(block); Script.ItemFilterBlocks.Insert(0, block); ItemFilterBlockViewModels.Move(currentIndex, 0); IsDirty = true; RaisePropertyChanged("ItemFilterSectionViewModels"); } }
public void MoveBlockDown(IItemFilterBlockViewModel targetBlockViewModel) { var currentIndex = ItemFilterBlockViewModels.IndexOf(targetBlockViewModel); if (currentIndex < ItemFilterBlockViewModels.Count - 1) { var block = targetBlockViewModel.Block; var blockPos = Script.ItemFilterBlocks.IndexOf(block); Script.ItemFilterBlocks.RemoveAt(blockPos); Script.ItemFilterBlocks.Insert(blockPos + 1, block); ItemFilterBlockViewModels.Move(currentIndex, currentIndex + 1); IsDirty = true; RaisePropertyChanged("ItemFilterSectionViewModels"); } }
public void MoveBlockUp(IItemFilterBlockViewModel targetBlockViewModel) { var currentIndex = ItemFilterBlockViewModels.IndexOf(targetBlockViewModel); if (currentIndex > 0) { var block = targetBlockViewModel.Block; var blockPos = Script.ItemFilterBlocks.IndexOf(block); Script.ItemFilterBlocks.RemoveAt(blockPos); Script.ItemFilterBlocks.Insert(blockPos - 1, block); ItemFilterBlockViewModels.Move(currentIndex, currentIndex - 1); IsDirty = true; RaisePropertyChanged(nameof(ItemFilterSectionViewModels)); } }