private void detectTimer_Tick(object sender, EventArgs e) { try { detectTimer.Enabled = false; var vrSet = new PSVR(Settings.Instance.EnableUDPBroadcast); PSVRController.DeviceConnected(vrSet); vrSet.SensorDataUpdate += VrSet_SensorDataUpdate; vrSet.Removed += VrSet_Removed; Task.Run(() => { PSVRController.HeadsetOn(); PSVRController.EnableVRMode(); Thread.Sleep(1500); PSVRController.EnableCinematicMode(); Thread.Sleep(1500); PSVRController.ApplyCinematicSettings(); }); lblStatus.Text = "VR set found"; grpFunctions.Enabled = true; grpCinematic.Enabled = true; grpLeds.Enabled = true; } catch (Exception ex) { detectTimer.Enabled = true; } }
private void detectTimer_Tick(object sender, EventArgs e) { try { detectTimer.Enabled = false; var vrSet = new PSVR(Settings.Instance.EnableUDPBroadcast); PSVRController.DeviceConnected(vrSet); vrSet.SensorDataUpdate += VrSet_SensorDataUpdate; vrSet.Removed += VrSet_Removed; vrSet.INReport += VrSet_CommandResponse; ThreadPool.QueueUserWorkItem((a) => { PSVRController.RequestDeviceInfo(); PSVRController.HeadsetOn(); PSVRController.EnableVRMode(); Thread.Sleep(1500); PSVRController.EnableCinematicMode(); Thread.Sleep(1500); PSVRController.ApplyCinematicSettings(); }); lblStatus.Text = "VR set found"; grpFunctions.Enabled = true; grpCinematic.Enabled = true; grpLeds.Enabled = true; } catch { detectTimer.Enabled = true; } }