void AdapterManager_NewAdapterRegistered(object sender, BrailleIO.Interface.IBrailleIOAdapterEventArgs e) { if (e != null && e.Adapter != null && e.Adapter.Device != null) { InteractionManager.AddNewDevice(e.Adapter); // TODO: monitor new adapter! } }
BrailleIO.Interface.IBrailleIOAdapter IBrailleIOAdapterSupplier.GetAdapter(BrailleIO.Interface.IBrailleIOAdapterManager manager) { if (manager != null && monitor != null) { adapter = monitor.GetAdapter(manager); return adapter; } return null; }
void AdapterManager_ActiveAdapterChanged(object sender, BrailleIO.Interface.IBrailleIOAdapterEventArgs e) { //CleanScreen(); //BuildScreens(); UpdateScreens(); }
/// <summary> /// Initializes a new instance of the <see cref="ButtonReleasedEventArgs"/> class. /// </summary> /// <param name="device">The sending device.</param> /// <param name="pressedGeneralKeys">The pressed general keys.</param> /// <param name="pressedGenericKeys">The interpreted pressed generic keys.</param> /// <param name="releasedGeneralKeys">The released general keys.</param> /// <param name="releasedGenericKeys">The interpreted released generic keys.</param> public ButtonReleasedEventArgs(BrailleIO.BrailleIODevice device, List<BrailleIO_DeviceButton> pressedGeneralKeys, List<String> pressedGenericKeys, List<BrailleIO_DeviceButton> releasedGeneralKeys, List<String> releasedGenericKeys) : base(device, pressedGeneralKeys, pressedGenericKeys) { ReleasedGeneralKeys = releasedGeneralKeys; ReleasedGenericKeys = releasedGenericKeys; }
/// <summary> /// Initializes a new instance of the <see cref="BrailleIOInteractionEventArgs"/> class. /// </summary> /// <param name="timestamp">The timestamp the interaction occured.</param> /// <param name="device">The device.</param> /// <param name="pressedGeneralKeys">The pressed general keys.</param> /// <param name="pressedGenericKeys">The interpreted pressed generic keys.</param> public BrailleIOInteractionEventArgs(DateTime timestamp, BrailleIO.BrailleIODevice device, List<BrailleIO_DeviceButton> pressedGeneralKeys, List<String> pressedGenericKeys) { Timestamp = timestamp; Device = device; PressedGeneralKeys = pressedGeneralKeys; PressedGenericKeys = pressedGenericKeys; }
/// <summary> /// Initializes a new instance of the <see cref="BrailleIOInteractionEventArgs"/> class. /// </summary> /// <param name="device">The sending device.</param> /// <param name="pressedGeneralKeys">The pressed general keys.</param> /// <param name="pressedGenericKeys">The interpreted pressed generic keys.</param> public BrailleIOInteractionEventArgs(BrailleIO.BrailleIODevice device, List<BrailleIO_DeviceButton> pressedGeneralKeys, List<String> pressedGenericKeys) : this(DateTime.Now, device, pressedGeneralKeys, pressedGenericKeys) { }
/// <summary> /// Initializes a new instance of the <see cref="GestureEventArgs"/> class. /// </summary> /// <param name="device">The sending device.</param> /// <param name="pressedGeneralKeys">The pressed general keys.</param> /// <param name="pressedGenericKeys">The interpreted pressed generic keys.</param> /// <param name="releasedGeneralKeys">The released general keys.</param> /// <param name="releasedGenericKeys">The interpreted released generic keys.</param> /// <param name="gesture">The gesture classification result.</param> public GestureEventArgs(BrailleIO.BrailleIODevice device, List<BrailleIO_DeviceButton> pressedGeneralKeys, List<String> pressedGenericKeys, List<BrailleIO_DeviceButton> releasedGeneralKeys, List<String> releasedGenericKeys, Gestures.Recognition.Interfaces.IClassificationResult gesture) : base(device, pressedGeneralKeys, pressedGenericKeys, releasedGeneralKeys, releasedGenericKeys) { this.Gesture = gesture; }
bool IBrailleIOAdapterSupplier.StartMonitoringAdapter(BrailleIO.Interface.IBrailleIOAdapter adapter) { if (adapter != null) { #region BrailleDis events ((IBrailleIOAdapterSupplier)this).StopMonitoringAdapter(adapter); adapter.touchValuesChanged += new EventHandler<BrailleIO_TouchValuesChanged_EventArgs>(_bda_touchValuesChanged); #endregion } return true; }
void _bda_touchValuesChanged(object sender, BrailleIO.Interface.BrailleIO_TouchValuesChanged_EventArgs e) { if (monitor != null) monitor.PaintTouchMatrix(e.touches); }
protected bool fireButtonPressedEvent(BrailleIO.BrailleIODevice device, List<BrailleIO_DeviceButton> pressedGeneralKeys, List<String> pressedGenericKeys) { var args = new ButtonPressedEventArgs(device, pressedGeneralKeys, pressedGenericKeys); Logger.Instance.Log(LogPriority.OFTEN, this, "Button pressed: " + String.Join(",", args.PressedGenericKeys)); bool cancel = base.fireButtonPressedEvent(args); if (cancel) { System.Diagnostics.Debug.WriteLine("InteractionManager Event canceled"); } return cancel; }
protected bool fireGestureEvent(BrailleIO.BrailleIODevice device, List<BrailleIO_DeviceButton> releasedGeneralKeys, List<String> releasedGenericKeys, List<BrailleIO_DeviceButton> pressedGeneralKeys, List<String> pressedGenericKeys, Gestures.Recognition.Interfaces.IClassificationResult gesture) { var args = new GestureEventArgs(device, pressedGeneralKeys, pressedGenericKeys, releasedGeneralKeys, releasedGenericKeys, gesture); Logger.Instance.Log(LogPriority.OFTEN, this, "Gesture performed: " + args.Gesture.ToString()); bool cancel = base.fireGestureEvent(args); if (cancel) { System.Diagnostics.Debug.WriteLine("InteractionManager Event canceled"); } return cancel; }
void adapter_errorOccured(object sender, BrailleIO.Interface.BrailleIO_ErrorOccured_EventArgs e) { enqueueInteractionQueuItem(InteractionQueueObjectType.Error, e, sender); }
void adapter_inputChanged(object sender, BrailleIO.Interface.BrailleIO_InputChanged_EventArgs e) { enqueueInteractionQueuItem(TimeStampUtils.UnixTimeStampToDateTime((double)e.timestamp), InteractionQueueObjectType.InputChanged, e, sender); }
void adapter_keyPressed(object sender, BrailleIO.Interface.BrailleIO_KeyPressed_EventArgs e) { enqueueInteractionQueuItem(InteractionQueueObjectType.KeyPressed, e, sender); }
void adapter_initialized(object sender, BrailleIO.Interface.BrailleIO_Initialized_EventArgs e) { if (e != null && e.device != null && sender != null && sender is AbstractBrailleIOAdapterBase) { if (devices.ContainsKey(e.device.Name)) { var oldDevice = devices[e.device.Name]; unregisterForEvents(oldDevice); devices.Remove(e.device.Name); } devices.Add(e.device.Name, sender as AbstractBrailleIOAdapterBase); unregisterForEvents(sender as AbstractBrailleIOAdapterBase); registerForEvents(sender as AbstractBrailleIOAdapterBase); // gesture recognizer registration for the device try { initalizeGestureRecognition(e.device); } catch (Exception ex) { AudioRenderer.Instance.PlaySound(LL.GetTrans("tangram.interaction_manager.error.gesture_recognizer")); Logger.Instance.Log(LogPriority.DEBUG, this, "gesture recognizer initialization error", ex); } } }
/// <summary> /// Removes a device from this interaction manager - so no more inputs will be interpreted. /// </summary> /// <param name="device">The device to remove.</param> /// <returns><c>true</c> if the device was successfully removed.</returns> public bool RemoveDevice(BrailleIO.AbstractBrailleIOAdapterBase device) { if (device != null) { unregisterForEvents(device); // gesture recognizer registration for the device unregisterGestureRecognition(device.Device); if (device.Connected) { devices.Remove(device.Device.Name); } } return true; }