public MainViewModel(int rows, int cols) { _rows = rows; _cols = cols; // make sure you have the event handlers wired up before this. _watcher.EnumerateOutputPorts(); _watcher.OutputPortsEnumerated += OnMidiDevicesEnumerated; Music = new ObservableCollection <MidiMessageBlock>(); Music.Add(new MidiMessageBlock(rows, cols)); CurrentBlockIndex = 0; CurrentBlock = _music[CurrentBlockIndex]; PlayAll = true; }
public void InsertBlock(bool before) { var block = new MidiMessageBlock(_rows, _cols); if (before) { _music.Insert(CurrentBlockIndex, block); } else { if (CurrentBlockIndex == _music.Count) { _music.Add(block); } else { CurrentBlockIndex++; _music.Insert(CurrentBlockIndex, block); } } CurrentBlock = _music[CurrentBlockIndex]; }