/// <summary> /// Publish a new network service on the same port. /// </summary> /// <param name="name">Name to append to the service (device name).</param> public void AddService(string name) { if (Publish(Port, name)) { ResourceSoundPlayer.TryToPlay(Properties.Resources.beep_good); } }
/// <summary> /// Remove the last service that was published. /// </summary> public void RemoveLastService() { // Do not allow removal of primary device if (DeviceNames.Count == 1) { log.Info("Can't remove primary device. Return."); return; } // get last-added device name and remove it string name = DeviceNames.Last(); DeviceNames.Remove(name); DeviceCount = DeviceNames.Count; log.Info("Removed " + name + " from device list."); // unpublish service containing this name Unpublish(name); ResourceSoundPlayer.TryToPlay(Properties.Resources.beep_bad); }
/// <summary> /// Allows XInput devices to be re-plugged and acquired. /// </summary> /// <returns>Returns boolean indicating if a controller was acquired.</returns> public bool AcquireXInputDevice() { bool reacquire = false; if (OutputDevice.Type == OutputDeviceType.vXbox) { OutputDevice.Disconnect(); reacquire = true; } ForceUnplugAllXboxControllers(); XInputDeviceConnected = false; bool xDeviceAcquired = false; XDevice = XMgr.getController(); if (XDevice != null && XDevice.IsConnected) { XInputDeviceConnected = true; ResourceSoundPlayer.TryToPlay(Properties.Resources.beep_good, afterMilliseconds: 1000); xDeviceAcquired = true; InterceptXInputDevice = true; } else { ResourceSoundPlayer.TryToPlay(Properties.Resources.beep_bad); xDeviceAcquired = false; InterceptXInputDevice = true; InterceptXInputDevice = false; } if (reacquire) { OutputDevice.Connect(); } return(xDeviceAcquired); }
public void RelinquishXInputDevice() { InterceptXInputDevice = false; ResourceSoundPlayer.TryToPlay(Properties.Resources.beep_bad); }