/// <summary> /// Form load event - Create the driver /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DriverHostForm_Load(object sender, EventArgs e) { deviceKey = string.Format("{0}/{1}", configuredDevice.Value.DeviceType.ToLowerInvariant(), configuredDevice.Value.DeviceNumber); ServerForm.LogMessage(0, 0, 0, "DriverHostForm", string.Format("Creating driver {0} ({1}) on thread {2}", deviceKey, configuredDevice.Key, Thread.CurrentThread.ManagedThreadId)); restServer.CreateInstance(configuredDevice); // Create the driver on this thread ServerForm.LogMessage(0, 0, 0, "DriverHostForm", string.Format("Created driver {0} ({1}) on thread {2}", deviceKey, configuredDevice.Key, Thread.CurrentThread.ManagedThreadId)); ServerForm.ActiveObjects[deviceKey].DriverHostForm = this; // Save the driver host form reference so that calls can be made to the driver }