static void OnMyoConnected(object sender, MyoEventArgs e) { _myos.Add(e.Myo); e.Myo.AccelerometerDataAcquired += OnAccelerationDataAcquired; e.Myo.OrientationDataAcquired += OnOrientationDataAcquired; var args = new MyoRoutedEventArgs(MyoDevice.ConnectedEvent, sender, e.Myo, e.TimeStamp); RaiseEvent(MyoDevice.ConnectedEvent, args); }
static void RaiseEvent(RoutedEvent ev, MyoRoutedEventArgs args) { if (Application.Current == null) { return; } Application.Current.Dispatcher.Invoke(new Action(() => { foreach (var elem in _elements[ev]) { elem.RaiseEvent(args); } })); }
static void RaiseEvent(RoutedEvent ev, MyoRoutedEventArgs args) { if (Application.Current == null) return; Application.Current.Dispatcher.Invoke(new Action(( ) => { foreach (var elem in _elements[ev]) elem.RaiseEvent(args); })); }