Exemple #1
0
        public void OnUdpmoteChanged(UdpmoteState state)
        {
            bool b = state.ButtonState.B;

            double[] sample = new double[]
            {
                state.AccelState.X,
                state.AccelState.Y,
                state.AccelState.Z
            };

            switch (captureState)
            {
            case CaptureState.Off:
                if (b)
                {
                    gesture = new Gesture();
                    gesture.AddSample(sample);
                    captureState = CaptureState.On;
                }
                break;

            case CaptureState.On:
                if (b)
                {
                    gesture.AddSample(sample);
                }
                else
                {
                    GestureCaptured?.Invoke(gesture);
                    captureState = CaptureState.Off;
                }
                break;
            }
        }
Exemple #2
0
        private void Udpmote_UdpmoteChanged(UdpmoteState obj)
        {
            Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                                   new Action <double>((double y) =>
            {
                y            = Math.Min(Math.Max(0.0, y), 1.0);
                double angle = 90 - 180.0 * Math.Acos(y) / Math.PI;

                L_Degrees.Content = string.Format("{0}º", angle);
            }), obj.AccelState.Y);
        }
Exemple #3
0
        private void Udpmote_UdpmoteChanged(UdpmoteState obj)
        {
            Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                                   new Action <bool, bool>((bool stateA, bool stateB) =>
            {
                A_label.Foreground = stateA ? Brushes.White : Brushes.Black;
                B_label.Foreground = stateB ? Brushes.White : Brushes.Black;

                A_label.Background = stateA ? Brushes.Green : Brushes.Transparent;
                B_label.Background = stateB ? Brushes.Red : Brushes.Transparent;
            }),
                                   obj.ButtonState.A,
                                   obj.ButtonState.B);
        }
 private void Udpmote_UdpmoteChanged(UdpmoteState state)
 {
     Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action <ButtonState>(CheckUdpmoteButtons), state.ButtonState);
 }