public DeviceViewModel(Device device) { _device = device; _traktorVersion = _device.TraktorVersion; updatePorts(device); generateAddMappingContextMenus(); loadDefaultMidiDefinitionsAsync(); foreach (var mapping in _device.Mappings) { var mvm = new MappingViewModel(_device, mapping); Mappings.Add(new RowItemViewModel(mvm)); mvm.DirtyStateChanged += (s, e) => updateMapsChanged(); } loadMetadata(); AcceptChanges(); Mappings.CollectionChanged += Mappings_CollectionChanged; // set selection if possible if (Mappings.Any()) { SelectedMappings.Add(Mappings.First()); updateAddMappingContextMenus(); } }
private void selectExclusive(RowItemViewModel row) { if (can_change_selection_automatically()) { SelectedMappings.Clear(); SelectedMappings.Add(row); } }
public void selectAll() { selectNone(); foreach (var m in Mappings) { SelectedMappings.Add(m); } }
private void insertMapping(int index, Mapping rawMapping) { _device.InsertMapping(index, rawMapping); var mvm = new MappingViewModel(_device, rawMapping); var row = new RowItemViewModel(mvm); _mappings.Insert(index, row); SelectedMappings.Add(row); }
private void insertMapping(int index, Mapping rawMapping) { _device.InsertMapping(index, rawMapping); var mvm = new MappingViewModel(_device, rawMapping); var row = new RowItemViewModel(mvm); _mappings.Insert(index, row); if (can_change_selection_automatically()) { SelectedMappings.Add(row); } OnModification(); }
private void selectExclusive(RowItemViewModel row) { SelectedMappings.Clear(); SelectedMappings.Add(row); }