FSUIPC Client DLL
.NET interface for FSUIPC
UserInputServices Class Reference

Class to easily manage user interaction in your FSUIPC application. Key strokes and Button presses can be registered and then detected when the user presses these keys or buttons in the Flight Sim application. Also Menu items can be added to flight sim and you can detect when the user selects them.
More...

Public Member Functions

void AddKeyPress (string ID, ModifierKeys Modifier, Keys Key, bool PassThroughToFS)
 Adds a key press to be detected. Sink the KeyPressed event to detect then the user pressed this key. More...
 
void AddJoystickButtonPress (string ID, byte JoystickNumber, byte ButtonNumber, StateChange StateChangeToDetect)
 Adds a joystick button press to be detected. Sink the ButtonPressed event to detect then the user pressed this button. More...
 
void AddMenuItem (string ID, string MenuText, bool PauseFSOnSelection)
 Adds a menu item to the Flight Sim menu. Sink the MenuSelected event to detect then the user selects this menu item. More...
 
void AddSubMenuItem (string ID, string ParentMenuID, string MenuText)
 Adds a sub-menu item to the Flight Sim menu. FSX/ESP/P3D and later ONLY. More...
 
void CheckForInput ()
 Call this method regularly to check if the user has pressed any key or button or has selected a menu item. FSUIPC documentation recommends every 200ms. More...
 
void KeepMenuItemsAlive ()
 Call this method to keep the menu items alive. The FSUIPC documentation recommends every 5-10 seconds. All menu items will time-out and be removed after approx. 14 seconds if this is not called. More...
 
void RemoveKeyPress (string ID)
 Cancels and removes a key press More...
 
void RemoveJoystickButtonPress (string ID)
 Cancels and removes a joystick button press More...
 
void RemoveMenuItem (string ID)
 Cancels and removes a menu item More...
 
void RemoveAll ()
 Cancels and removes all key presses, button presses and menu items. It is recommended that you call this method before your application exits. More...
 

Events

EventHandler< UserInputKeyEventArgsKeyPressed
 This event is raised when one of the registered keys is pressed. More...
 
EventHandler< UserInputButtonEventArgsButtonPressed
 This event is raised when one of the registered joystick buttons is pressed. More...
 
EventHandler< UserInputMenuEventArgsMenuSelected
 This event is raised when one of the menu items is selected. More...
 

Detailed Description

Class to easily manage user interaction in your FSUIPC application. Key strokes and Button presses can be registered and then detected when the user presses these keys or buttons in the Flight Sim application. Also Menu items can be added to flight sim and you can detect when the user selects them.

Member Function Documentation

◆ AddJoystickButtonPress()

void AddJoystickButtonPress ( string  ID,
byte  JoystickNumber,
byte  ButtonNumber,
StateChange  StateChangeToDetect 
)
inline

Adds a joystick button press to be detected. Sink the ButtonPressed event to detect then the user pressed this button.

Parameters
IDA string that you will use to identity and detect this button press.
JoystickNumberThe number of the Joystick (0-15) to detect.
ButtonNumberThe number of the Button to detect.
StateChangeToDetectWhich states to detect.

◆ AddKeyPress()

void AddKeyPress ( string  ID,
ModifierKeys  Modifier,
Keys  Key,
bool  PassThroughToFS 
)
inline

Adds a key press to be detected. Sink the KeyPressed event to detect then the user pressed this key.

Parameters
IDA string that you will use to identity and detect this key press.
ModifierAny modifier keys that you want to be held when the main key is pressed. These modifiers can be combined with a bitwise OR.
KeyThe key to be pressed.
PassThroughToFSIf true, the keypress will also be passed to Flight Sim. If false, the keypress will not be passed on to Flight Sim.

◆ AddMenuItem()

void AddMenuItem ( string  ID,
string  MenuText,
bool  PauseFSOnSelection 
)
inline

Adds a menu item to the Flight Sim menu. Sink the MenuSelected event to detect then the user selects this menu item.

Parameters
IDA string that you will use to identity and detect this menu item.


Parameters
MenuTextThe text to display in the Flight Sim menu. A short-cut letter can be marked by prefixing it with an ampersand (&).
PauseFSOnSelectionSet to true if you want Flight Sim to pause after this menu item is selected. You will need to unpause Flight Sim in your application when ready to continue.

◆ AddSubMenuItem()

void AddSubMenuItem ( string  ID,
string  ParentMenuID,
string  MenuText 
)
inline

Adds a sub-menu item to the Flight Sim menu. FSX/ESP/P3D and later ONLY.

Note that the Pause On Selection can be set on the Parent Menu only and applied to all sub menus.

Only one level of sub menus are supported.

Parameters
IDA string that you will use to identity and detect this menu item.


Parameters
ParentMenuIDThe ID of the main menu item that this new menu will be place under.

This cannot be another sub menu.


Parameters
MenuTextThe text to display in the Flight Sim menu. A short-cut letter can be marked by prefixing it with an ampersand (&).

◆ CheckForInput()

void CheckForInput ( )
inline

Call this method regularly to check if the user has pressed any key or button or has selected a menu item. FSUIPC documentation recommends every 200ms.

◆ KeepMenuItemsAlive()

void KeepMenuItemsAlive ( )
inline

Call this method to keep the menu items alive. The FSUIPC documentation recommends every 5-10 seconds. All menu items will time-out and be removed after approx. 14 seconds if this is not called.

◆ RemoveAll()

void RemoveAll ( )
inline

Cancels and removes all key presses, button presses and menu items. It is recommended that you call this method before your application exits.

◆ RemoveJoystickButtonPress()

void RemoveJoystickButtonPress ( string  ID)
inline

Cancels and removes a joystick button press

Parameters
IDThe ID of the button press to cancel/remove

◆ RemoveKeyPress()

void RemoveKeyPress ( string  ID)
inline

Cancels and removes a key press

Parameters
IDThe ID of the key press to cancel/remove

◆ RemoveMenuItem()

void RemoveMenuItem ( string  ID)
inline

Cancels and removes a menu item

Parameters
IDThe ID of the menu item to cancel/remove

Event Documentation

◆ ButtonPressed

EventHandler<UserInputButtonEventArgs> ButtonPressed

This event is raised when one of the registered joystick buttons is pressed.

◆ KeyPressed

EventHandler<UserInputKeyEventArgs> KeyPressed

This event is raised when one of the registered keys is pressed.

◆ MenuSelected

EventHandler<UserInputMenuEventArgs> MenuSelected

This event is raised when one of the menu items is selected.