BrailleIO.Interface.IBrailleIOAdapter IBrailleIOAdapterSupplier.GetAdapter(BrailleIO.Interface.IBrailleIOAdapterManager manager)
 {
     if (manager != null && monitor != null)
     {
         adapter = monitor.GetAdapter(manager);
         return(adapter);
     }
     return(null);
 }
 BrailleIO.Interface.IBrailleIOAdapter IBrailleIOAdapterSupplier.GetAdapter(BrailleIO.Interface.IBrailleIOAdapterManager manager)
 {
     if (manager != null && monitor != null)
     {
         adapter = monitor.GetAdapter(manager);
         return adapter;
     }
     return null;
 }
 public BrailleIOExample()
 {
     io = BrailleIOMediator.Instance;
     io.AdapterManager = new ShowOffBrailleIOAdapterManager();
     Monitor           = ((ShowOffBrailleIOAdapterManager)io.AdapterManager).Monitor;
     showOff           = io.AdapterManager.ActiveAdapter as AbstractBrailleIOAdapterBase;
     registerToEvents();
     showExample();
 }
        private void getShowOff()
        {
            if (IO != null)
            {
                // if the current Adapter manager holds an debug dapter, use it
                if (IO.AdapterManager is ShowOffBrailleIOAdapterManager)
                {
                    Monitor = ((ShowOffBrailleIOAdapterManager)IO.AdapterManager).Monitor;
                    foreach (var adapter in IO.AdapterManager.GetAdapters())
                    {
                        if (adapter is BrailleIOAdapter_ShowOff)
                        {
                            showOffAdapter = adapter as AbstractBrailleIOAdapterBase;
                            break;
                        }
                    }
                }

                // if no debug device currently exists, create a new one
                if (showOffAdapter == null)
                {
                    Monitor        = new ShowOff();
                    showOffAdapter = Monitor.GetAdapter(IO.AdapterManager);
                    if (showOffAdapter != null)
                    {
                        IO.AdapterManager.AddAdapter(showOffAdapter);
                    }
                }

                // if a debug adapter could been created, register to its events
                if (showOffAdapter != null)
                {
                    showOffAdapter.Synch = true; // activate that this device receives the pin matrix of the active device, too.

                    #region events

                    showOffAdapter.touchValuesChanged += new EventHandler <BrailleIO_TouchValuesChanged_EventArgs>(_bda_touchValuesChanged);
                    showOffAdapter.keyStateChanged    += new EventHandler <BrailleIO_KeyStateChanged_EventArgs>(_bda_keyStateChanged);

                    #endregion
                }

                if (Monitor != null)
                {
                    Monitor.Disposed += new EventHandler(monitor_Disposed);
                }
            }
        }
        private AbstractBrailleIOAdapterBase createBrailleDis()
        {
            if (IO != null && IO.AdapterManager != null)
            {
                brailleDisAdapter = new BrailleIOBrailleDisAdapter.BrailleIOAdapter_BrailleDisNet(IO.AdapterManager);
                IO.AdapterManager.ActiveAdapter = brailleDisAdapter;

                #region BrailleDis events
                brailleDisAdapter.touchValuesChanged += new EventHandler <BrailleIO_TouchValuesChanged_EventArgs>(_bda_touchValuesChanged);
                brailleDisAdapter.keyStateChanged    += new EventHandler <BrailleIO_KeyStateChanged_EventArgs>(_bda_keyStateChanged);
                #endregion

                return(brailleDisAdapter);
            }
            return(null);
        }
        /// <summary>
        /// gesture recognizer registration for the device
        /// </summary>
        /// <param name="adapter">The adapter.</param>
        /// <returns>A gesture recognizer for recognizing gestures</returns>
        private GestureRecognizer registerGestureRecognizer(AbstractBrailleIOAdapterBase adapter)
        {
            if (adapter != null)
            {
                var blobTracker       = new BlobTracker();
                var gestureRecognizer = new GestureRecognizer(blobTracker);

                var tabClassifier        = new TapClassifier();
                var multitouchClassifier = new MultitouchClassifier();

                // add several classifiers to interpret the tracked blobs
                gestureRecognizer.AddClassifier(tabClassifier);
                gestureRecognizer.AddClassifier(multitouchClassifier);

                // start tracking fo blobs
                blobTracker.InitiateTracking();
                return(gestureRecognizer);
            }

            return(null);
        }