// Disable joystick handling public static void Disable() { // do nothing if already disabled if (directInput == null) { return; } // terminate the monitor threads exitThreadsEvent.Set(); // dispose of joystick instances foreach (var kv in joysticks) { // wait for the monitor thread to exit var js = kv.Value; js.thread.Join(2500); // dispose of the DirectInput object js.js.Dispose(); js.js = null; } // forget the joystick objects joysticks.Clear(); // dispose of our DirectInput object directInput.Dispose(); directInput = null; // forget the UI window win = null; }
public OSDWin(UIWin mainwin) { this.mainwin = mainwin; InitializeComponent(); // set up drawing objects for the label text font = new Font(SystemFonts.CaptionFont.FontFamily, 24.0f); titleFmt = new StringFormat(StringFormatFlags.NoWrap); titleFmt.Alignment = StringAlignment.Center; titleFmt.LineAlignment = StringAlignment.Far; // set the night mode icon transparency nightMode.MakeTransparent(nightMode.GetPixel(0, 0)); }
// Enable joystick handling public static void Enable(UIWin win) { // do nothing if already enable if (directInput != null) { return; } // remember the UI window JoystickDev.win = win; // get our DirectInput object directInput = new DirectInput(); // clear the thread exit event exitThreadsEvent.Reset(); // scan for devices Rescan(); }