Ejemplo n.º 1
0
        private void mappedCommandsGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
            {
                try
                {
                    var cell = mappedCommandsGridView.Rows[e.RowIndex].Cells[e.ColumnIndex];
                    if (cell.OwningColumn.Name == "removeColumn")
                    {
                        var row    = mappedCommandsGridView.Rows[e.RowIndex];
                        int dnIdx  = mappedCommandsGridView.Columns["controllerDataGridViewTextBoxColumn"].Index;
                        int cmdIdx = mappedCommandsGridView.Columns["cmdIdDataGridViewTextBoxColumn"].Index;

                        string MidiDeviceName = (string)row.Cells[dnIdx].Value;
                        int    catCmd         = (int)row.Cells[cmdIdx].Value;
                        DB.RemoveMapping(MidiDeviceName, catCmd);
                        DB.SaveChanges(DeviceName);
                        _enumsDb.SetCatCmdInUse((CatCmd)catCmd, false);
                        MappedCommands mappedCommands = new MappedCommands(_enumsDb.ds.Tables["CatCmds"], _db.ds.Tables[DeviceName]);
                        mappedCommandsBindingSource.DataSource = mappedCommands;
                    }
                }
                catch { }
            }
        }
Ejemplo n.º 2
0
 private void tabControl_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (tabControl.SelectedTab == commandsTabPage)
     {
         MappedCommands mappedCommands = new MappedCommands(_enumsDb.ds.Tables["CatCmds"], _db.ds.Tables[DeviceName]);
         mappedCommandsBindingSource.DataSource = mappedCommands;
     }
     else if (tabControl.SelectedTab == mappedControlsTab)
     {
         CatCmdToUse = CatCmd.None;
     }
     else if (tabControl.SelectedTab == debugTab)
     {
         CatCmdToUse = CatCmd.None;
     }
 }