private void updateEditor(IList selection) { // do not call on CollectionChanged of SelectedMappings! // otherwise it's called too often because e.g. "select all" builds collection of selected items incrementally // should be called when selection is complete and not changing anymore. // therefore it's better to use an EventTrigger on DataGrid's SelectionChanged var selectedMappingViewModels = _selectedMappings.Select(m => m.Item as MappingViewModel); MappingEditorViewModel = new MappingEditorViewModel(this, selectedMappingViewModels); updateAddMappingContextMenus(); }
/* * this command duplicates a Selection for all 4 channels: * * input: * CMD1 -> ch01.Note.C0 -> deck A * * generated: * CMD2 -> ch02.Note.C0 -> deck B * CMD3 -> ch03.Note.C0 -> deck C * CMD4 -> ch04.Note.C0 -> deck D */ public void QuadruplicateCommand() { for (int i = 1; i < 4; i++) { // todo: check if commands are chanell1/DeckA ? // Filter on: // we manipulate the current selection over and over. Thats why we use step 1. // end result is decreasing order // // Filter off: // we manipulate the copies // end result is increasing order duplicate(); MappingEditorViewModel.MidiBindingEditor.IncDecChannel(1); MappingEditorViewModel.rotateAssignment(1); MappingEditorViewModel.CommentEditor.sedCommentsReplaceDeck(i); } }