示例#1
0
        void simconnect_OnRecvOpen(SimConnect sender, SIMCONNECT_RECV_OPEN data)
        {
            button_Connect.Text = "Disconnect";
            displayText("Connected to FSX");


            simconnect.MapClientEventToSimEvent(EVENT_ID.EVENT_TOGGLE_MASTER_ALTERNATOR, "TOGGLE_ALTERNATOR1");
            simconnect.MapClientEventToSimEvent(EVENT_ID.EVENT_TOGGLE_MASTER_BATTERY, "TOGGLE_MASTER_BATTERY");
            simconnect.MapClientEventToSimEvent(EVENT_ID.EVENT_FUEL_PUMP, "FUEL_PUMP");
            simconnect.MapClientEventToSimEvent(EVENT_ID.EVENT_TOGGLE_BEACON_LIGHTS, "TOGGLE_BEACON_LIGHTS");
            simconnect.MapClientEventToSimEvent(EVENT_ID.EVENT_LANDING_LIGHTS_TOGGLE, "LANDING_LIGHTS_TOGGLE");
            simconnect.MapClientEventToSimEvent(EVENT_ID.EVENT_TOGGLE_TAXI_LIGHTS, "TOGGLE_TAXI_LIGHTS");
            simconnect.MapClientEventToSimEvent(EVENT_ID.EVENT_TOGGLE_NAV_LIGHTS, "TOGGLE_NAV_LIGHTS");
            simconnect.MapClientEventToSimEvent(EVENT_ID.EVENT_STROBES_TOGGLE, "STROBES_TOGGLE");
            simconnect.MapClientEventToSimEvent(EVENT_ID.EVENT_PITOT_TOGGLE, "PITOT_HEAT_TOGGLE");
            simconnect.MapClientEventToSimEvent(EVENT_ID.EVENT_TOGGLE_AVIONICS_MASTER, "TOGGLE_AVIONICS_MASTER");



            simconnect.AddClientEventToNotificationGroup(GROUP_ID.GROUP0, EVENT_ID.EVENT_TOGGLE_MASTER_ALTERNATOR, false);
            simconnect.AddClientEventToNotificationGroup(GROUP_ID.GROUP0, EVENT_ID.EVENT_TOGGLE_MASTER_BATTERY, false);
            simconnect.AddClientEventToNotificationGroup(GROUP_ID.GROUP0, EVENT_ID.EVENT_FUEL_PUMP, false);
            simconnect.AddClientEventToNotificationGroup(GROUP_ID.GROUP0, EVENT_ID.EVENT_TOGGLE_BEACON_LIGHTS, false);
            simconnect.AddClientEventToNotificationGroup(GROUP_ID.GROUP0, EVENT_ID.EVENT_LANDING_LIGHTS_TOGGLE, false);
            simconnect.AddClientEventToNotificationGroup(GROUP_ID.GROUP0, EVENT_ID.EVENT_TOGGLE_TAXI_LIGHTS, false);
            simconnect.AddClientEventToNotificationGroup(GROUP_ID.GROUP0, EVENT_ID.EVENT_TOGGLE_NAV_LIGHTS, false);
            simconnect.AddClientEventToNotificationGroup(GROUP_ID.GROUP0, EVENT_ID.EVENT_STROBES_TOGGLE, false);
            simconnect.AddClientEventToNotificationGroup(GROUP_ID.GROUP0, EVENT_ID.EVENT_PITOT_TOGGLE, false);
            simconnect.AddClientEventToNotificationGroup(GROUP_ID.GROUP0, EVENT_ID.EVENT_TOGGLE_AVIONICS_MASTER, false);


            simconnect.MapInputEventToClientEvent(GROUP_ID.GROUP0, "joystick:1:button:0", EVENT_ID.EVENT_TOGGLE_MASTER_ALTERNATOR, 0, null, 0, false);
            simconnect.MapInputEventToClientEvent(GROUP_ID.GROUP0, "joystick:1:button:1", EVENT_ID.EVENT_TOGGLE_MASTER_BATTERY, 0, null, 0, false);
            simconnect.MapInputEventToClientEvent(GROUP_ID.GROUP0, "joystick:1:button:8", EVENT_ID.EVENT_FUEL_PUMP, 0, null, 0, true);
            simconnect.MapInputEventToClientEvent(GROUP_ID.GROUP0, "joystick:1:button:9", EVENT_ID.EVENT_TOGGLE_BEACON_LIGHTS, 0, null, 0, false);

            simconnect.MapInputEventToClientEvent(GROUP_ID.GROUP0, "joystick:1:button:10", EVENT_ID.EVENT_LANDING_LIGHTS_TOGGLE, 0, null, 0, false);

            simconnect.MapInputEventToClientEvent(GROUP_ID.GROUP0, "joystick:1:button:11", EVENT_ID.EVENT_TOGGLE_TAXI_LIGHTS, 0, null, 0, false);
            simconnect.MapInputEventToClientEvent(GROUP_ID.GROUP0, "joystick:1:button:12", EVENT_ID.EVENT_TOGGLE_NAV_LIGHTS, 0, null, 0, false);

            simconnect.MapInputEventToClientEvent(GROUP_ID.GROUP0, "joystick:1:button:13", EVENT_ID.EVENT_STROBES_TOGGLE, 0, null, 0, false);
            simconnect.MapInputEventToClientEvent(GROUP_ID.GROUP0, "joystick:1:button:14", EVENT_ID.EVENT_PITOT_TOGGLE, 0, null, 0, false);

            simconnect.MapInputEventToClientEvent(GROUP_ID.GROUP0, "joystick:1:button:15", EVENT_ID.EVENT_TOGGLE_AVIONICS_MASTER, 0, null, 0, false);



            simconnect.SetInputGroupState(GROUP_ID.GROUP0, 1);
        }