Exemplo n.º 1
0
        private void ComboBox_MouseUp(object sender, MouseEventArgs e)
        {
            MultiLevelComboBox m = (MultiLevelComboBox)sender;

            if (e.Button == MouseButtons.Right)
            {
                byte ind = (byte)(int)m.Tag;
                assignDetectedInput(ind, m);
            }
        }
Exemplo n.º 2
0
        private async void assignDetectedInput(byte index, MultiLevelComboBox m)
        {
            this.Enabled = false;
            m.Items[0]   = "Input...";
            byte[] b = await Task.Run(() => DetectInput(index));  //run actual detection asynchronous

            //detectInput returns b[0] = 127 if no input was made
            if (b[0] != 127)
            {
                dev.mapping[b[2] * 2]       = b[0];
                dev.mapping[(b[2] * 2) + 1] = b[1];
                dev.Save();
            }
            m.Items[0]   = GetBindingText(b[2]);
            this.Enabled = true;
        }
Exemplo n.º 3
0
        private void ComboBox_SelectionChangeCommitted(object sender, EventArgs e, MultiLevelComboBox m)
        {
            ToolStripMenuItem i = (ToolStripMenuItem)sender;

            byte[] b = (byte[])i.Tag; // store selection tag in array (b[0] = type, b[1] = number, b[2] = index
            if (b[0] == 254)
            {
                assignDetectedInput(b[2], m);
            }
            else
            {
                // type and subtype are stored at every even number
                dev.mapping[b[2] * 2] = b[0];
                // number of the control is stored at every uneven number above the corresponding even number
                dev.mapping[(b[2] * 2) + 1] = b[1];
                dev.Save();
            }
        }