コード例 #1
0
        private void GetTouchDeviceStatus()
        {
            // By default
            deskbandControl.deviceIsEnabled = true;
            Device touchDevice = null;

            while (true)
            {
                try
                {
                    string deviceHardwareId = TTService.GetSelectedHardwareID();
                    if (deviceHardwareId == null)
                    {
                        deskbandControl.UpdateUIImage(inoperableOverride: true, UserControl1.EnableDisableButtonToolTips.DeviceNotSelected);
                        return;
                    }
                    // Get the device info
                    touchDevice = TTService.GetTouchDevice();
                    break;
                }
                catch (CommunicationException)
                {
                    if (!ServiceCommunicationFailure(false))
                    {
                        return;
                    }
                }
            }

            if (touchDevice != null)
            {
                // If the device is found (connected) update the UI with the device status
                deskbandControl.deviceIsEnabled = touchDevice.Enabled;
                deskbandControl.UpdateUIImage();
            }
            else
            {
                deskbandControl.UpdateUIImage(inoperableOverride: true, UserControl1.EnableDisableButtonToolTips.DeviceNotConnected);
            }
        }