Esempio n. 1
0
 private void unregisterEventListener(BrailleDisNet BrailleDis)
 {
     if (BrailleDis != null)
     {
         BrailleDis.ErrorOccured            -= new BrailleDisNet.ErrorOccuredHandler(BrailleDis_ErrorOccured);
         BrailleDis.inputChangedEvent       -= new BrailleDisNet.InputChangedEventHandler(BrailleDis_inputChangedEvent);
         BrailleDis.keyStateChangedEvent    -= new BrailleDisNet.KeyStateChangedEventHandler(BrailleDis_keyStateChangedEvent);
         BrailleDis.pinStateChangedEvent    -= new BrailleDisNet.PinStateChangeEventHandler(BrailleDis_pinStateChangedEvent);
         BrailleDis.touchValuesChangedEvent -= new BrailleDisNet.TouchValuesChangedEventHandler(BrailleDis_touchValuesChangedEvent);
         BrailleDis.NewDeviceAttached       -= new Action <BrailleDisNet, DeviceInformation_T>(BrailleDis_NewDeviceAttached);
     }
 }
Esempio n. 2
0
 private void closeBrailleDis(BrailleDisNet _bdn)
 {
     if (_bdn != null)
     {
         unregisterEventListener(_bdn);
         try
         {
             _bdn.StopTouchEvaluation();
             _bdn.Close();
         }
         catch (Exception)
         { }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Tries to create and connect the BrailleDis.
        /// Should be started in separate thread because this takes some time.
        /// </summary>
        private void tryConnectBrailleDis()
        {
            int       trys = 0;
            const int max  = 30;

            if (BrailleDis == null)
            {
                try
                {
                    BrailleDis = new BrailleDisNet();
                }
                catch
                {
                    BrailleDis = null;
                    return;
                }
            }

            while (_run && (BrailleDis == null || !BrailleDis.DeviceIsInitialized || BrailleDis.UsedDevice == null))
            {
                if (!_run)
                {
                    return;
                }
                if (trys++ >= max || BrailleDis == null)
                {
                    BrailleDis = null;
                    return;
                }
                if (BrailleDis != null && BrailleDis.UsedDevice != null)
                {
                    BrailleDis.UsedDevice.OpenDevice();
                }
            }

            Connect();
            Synchronize(LastMatrix);
            Thread.CurrentThread.Abort();
        }
Esempio n. 4
0
 void BrailleDis_NewDeviceAttached(BrailleDisNet arg1, DeviceInformation_T arg2)
 {
     Thread.Sleep(200);
     fireInitialized(new BrailleIO_Initialized_EventArgs(Device));
     System.Diagnostics.Debug.WriteLine("new Device attached");
 }