예제 #1
0
        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();
            }
        }
예제 #2
0
 private void selectExclusive(RowItemViewModel row)
 {
     if (can_change_selection_automatically())
     {
         SelectedMappings.Clear();
         SelectedMappings.Add(row);
     }
 }
예제 #3
0
        public void selectAll()
        {
            selectNone();

            foreach (var m in Mappings)
            {
                SelectedMappings.Add(m);
            }
        }
예제 #4
0
        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);
        }
예제 #5
0
        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();
        }
예제 #6
0
 private void selectExclusive(RowItemViewModel row)
 {
     SelectedMappings.Clear();
     SelectedMappings.Add(row);
 }