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

            foreach (var m in Mappings)
            {
                SelectedMappings.Add(m);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 6
0
 private void selectExclusive(RowItemViewModel row)
 {
     SelectedMappings.Clear();
     SelectedMappings.Add(row);
 }