public VersionInfo(DllVersions version) { InitializeComponent(); serviceVersion = (Label)Controls["serviceversion"]; clientVersion = (Label)Controls["clientversion"]; serviceVersion.Text = version.Service.ToString(); clientVersion.Text = version.Client.ToString(); Rectangle r = Screen.PrimaryScreen.WorkingArea; this.StartPosition = FormStartPosition.Manual; this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height); RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\WOW6432Node\\Hardlight VR\\Service", false); if (rk != null) { installPath = (string)rk.GetValue("InstallPath"); } }
public MyCustomApplicationContext() { unsafe { fixed(Interop.HLVR_System **ptr = &_pluginPtr) { if (Interop.FAIL(Interop.HLVR_System_Create(ptr))) { MessageBox.Show("Failed to create the Hardlight plugin! Application will now exit.", "Hardlight Service", MessageBoxButtons.OK, MessageBoxIcon.Error); Exit(); } } } _updaterModulePath = Path.Combine(Application.StartupPath, "updater.exe"); _cachedServiceVersion = new DllVersions(); uint clientVersion = Interop.HLVR_Version_Get(); _cachedServiceVersion.Client.Minor = (int)(clientVersion & 0x00FF0000) >> 16; _cachedServiceVersion.Client.Major = (int)(clientVersion & 0xFF000000) >> 24; _cachedServiceVersion.Client.Patch = (int)(clientVersion & 0x0000FFFF); _cachedDevices = new Dictionary <uint, Interop.HLVR_DeviceInfo>(); _deviceMenuList = new MenuItem("Devices", new MenuItem[] { }); _wirelessDeviceMenu = new MenuItem("Connect", new MenuItem[] { }); _serviceController = new ServiceController(); _serviceController.ServiceName = "Hardlight VR Runtime"; _wirelessAps = new HashSet <string>(); _updateMenu = new MenuItem("Updates", new MenuItem[] { new MenuItem("Options", UpdateConfiguration), new MenuItem("Check now", CheckUpdates), }); _audioMenu = new MenuItem("Audio", new MenuItem[] { new MenuItem("Enable audio to haptics", EnableAudio), new MenuItem("Disable audio to haptics", DisableAudio) }); _wirelessMenu = new MenuItem("Wireless", new MenuItem[] { new MenuItem("Scan", WifiAsync), _wirelessDeviceMenu }); var myMenu = new ContextMenu(new MenuItem[] { new MenuItem("Enable Runtime", StartService), new MenuItem("Disable Runtime", StopService), new MenuItem("Test Everything", TestSuit), _audioMenu, _updateMenu, new MenuItem("Version info", VersionInfo), _deviceMenuList, _wirelessMenu, new MenuItem("Exit", new EventHandler((object o, EventArgs e) => { Exit(); })) }); // Initialize Tray Icon _trayIcon = new NotifyIcon() { Icon = Properties.Resources.TrayIconServiceOff, ContextMenu = myMenu, Visible = true }; _checkStatusTimer = new Timer(); _checkStatusTimer.Interval = 125; _checkStatusTimer.Tick += new EventHandler(CheckStatusSuit); _checkStatusTimer.Start(); _hapticsDelay = new Timer(); _hapticsDelay.Interval = 1000; _hapticsDelay.Tick += DelayWhilePluginInitializes_Tick; RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\WOW6432Node\\Hardlight VR\\Service", false); if (rk != null) { _installPath = (string)rk.GetValue("InstallPath"); } }