Ejemplo n.º 1
0
        private void btJsReassign_Click( object sender, EventArgs e )
        {
            // have to stop polling while the Reassign window is open
              timer1.Enabled = false;
              if ( m_Joystick.ShowReassign( ) != System.Windows.Forms.DialogResult.Cancel ) {
            // copy the action tree while reassigning the jsN mappings from OLD to NEW
            ActionTree newTree = m_AT.ReassignJsN( m_Joystick.JsReassingList );

            // we have still the old assignment in the ActionMap - change it here (map does not know about the devices)
            JoystickCls j = null;
            // for all supported jsN devices
            for ( int i=0; i < JoystickCls.JSnum_MAX; i++ ) {
              j = m_Joystick.Find_jsN( i + 1 );
              if ( j != null ) {
            newTree.ActionMaps.jsN[i] = j.DevName; newTree.ActionMaps.jsNGUID[i] = j.DevInstanceGUID;
              }
              else {
            newTree.ActionMaps.jsN[i] = ""; newTree.ActionMaps.jsNGUID[i] = "";
              }
            }

            m_AT = newTree; // make it the valid one
            m_AT.DefineShowOptions( cbxShowJoystick.Checked, cbxShowGamepad.Checked, cbxShowKeyboard.Checked, cbxShowMappedOnly.Checked );
            m_AT.ReloadTreeView( );
            if ( m_AT.Dirty ) btDump.BackColor = MyColors.DirtyColor;
              }

              timer1.Enabled = true;
        }