private void CommandBinding_ExecuteMoveToBack(object sender, ExecutedRoutedEventArgs e) { Model.Timeline t = sequencer.GetModel(); var toMove = sequencer.SelectedBlocks.Select(bvm => bvm.GetModel()).ToList(); using (sequencer.ActionManager.CreateTransaction()) { for (int i = 0; i < toMove.Count; i++) { sequencer.ActionManager.RecordRemove(t.Blocks, toMove[i]); sequencer.ActionManager.RecordInsert(t.Blocks, i, toMove[i]); } } }
// TODO MoveToBack/Front could be automated by automagically sorting blocks by StartTime // this could probably be done most efficiently by reinserting (.Move!) blocks when they are dragged around private void CommandBinding_ExecuteMoveToFront(object sender, ExecutedRoutedEventArgs e) { Model.Timeline t = sequencer.GetModel(); var toMove = sequencer.SelectedBlocks.Select(bvm => bvm.GetModel()).ToList(); using (sequencer.ActionManager.CreateTransaction()) { foreach (var block in toMove) { sequencer.ActionManager.RecordRemove(t.Blocks, block); sequencer.ActionManager.RecordAdd(t.Blocks, block); } } }