Exemple #1
0
        void monitoringMap_MessageReceived(object sender, MIDI.MidiMessage message, int channel, int key, int value)
        {
            if (monitoringMap != null)
            {
                ControlMap map = monitoringMap.FindMap(channel, key);

                if (map != null)
                {
                    MethodInvoker doIt = delegate
                    {
                        foreach (ListViewItem item in MapsView.Items)
                        {
                            ControlBinding cb = item.Tag as ControlBinding;
                            if (cb != null)
                            {
                                if (cb.Parent == map)
                                {
                                    item.Selected = true;
                                    MapsView.EnsureVisible(item.Index);
                                    break;
                                }
                            }
                        }
                    };

                    if (this.InvokeRequired)
                    {
                        try
                        {
                            this.Invoke(doIt);
                        }
                        catch
                        {
                        }
                    }
                    else
                    {
                        doIt();
                    }
                }
            }
        }
Exemple #2
0
        private void NewBinding_Click(object sender, EventArgs e)
        {
            if (DeviceList.SelectedItem != null)
            {
                NewBinding nb = new NewBinding();

                nb.MidiMap    = (MidiMap)DeviceList.SelectedItem;
                nb.ControlMap = new ControlMap();
                if (nb.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    nb.MidiMap.ControlMaps.Add(nb.ControlMap);
                    nb.ControlMap.Owner = nb.MidiMap;
                    LoadControlMaps();
                    SelectControlMap(nb.ControlMap);
                    ((MidiMap)DeviceList.SelectedItem).Dirty          = true;
                    MapsView.Items[MapsView.Items.Count - 1].Selected = true;
                    MapsView.EnsureVisible(MapsView.Items.Count - 1);
                }
            }
        }