示例#1
0
        public void OnGestureEvent(INuimoController controller, NuimoGestureEvent nuimoGestureEvent)
        {
            if (!IsInitialized)
            {
                controller.DisplayLedMatrixAsync(Icons.Cross);
                return;
            }

            switch (nuimoGestureEvent.Gesture)
            {
            case NuimoGesture.ButtonPress:
                var newState = SwitchGroupOnOff();
                var matrix   = GetPowerMatrix(newState);
                controller.DisplayLedMatrixAsync(matrix);
                break;

            case NuimoGesture.Rotate:
                var newBrightness    = ChangeBrightness(nuimoGestureEvent.Value) / 255.0;
                var brightnessMatrix = ProgressBars.VerticalBar(newBrightness);
                controller.DisplayLedMatrixAsync(brightnessMatrix);
                break;

            case NuimoGesture.SwipeLeft:
            case NuimoGesture.SwipeRight:
                var newRoom       = SwitchRoom(nuimoGestureEvent.Gesture);
                var matrixForRoom = MatrixForRoomClass(newRoom);
                controller.DisplayLedMatrixAsync(matrixForRoom);
                break;

            default:
                break;
            }
        }
示例#2
0
        private void OnNuimoGestureEvent(INuimoController nuimoController, NuimoGestureEvent nuimoGestureEvent)
        {
            Debug.WriteLine("Event: " + nuimoGestureEvent.Gesture + ", " + nuimoGestureEvent.Value);

            if (nuimoGestureEvent.Gesture == NuimoGesture.SwipeDown)
            {
                NextApp(nuimoController);
            }
        }
 private void OnNuimoGestureEvent(NuimoGestureEvent nuimoGestureEvent)
 {
     OutputTextBox.Text = new StringBuilder(OutputTextBox.Text)
                          .Append("NuimoGesture: ")
                          .Append(nuimoGestureEvent.Gesture)
                          .Append(" value: ")
                          .Append(nuimoGestureEvent.Value + "\n")
                          .ToString();
     OutputTextBox.ScrollToBottom();
 }
示例#4
0
        public void OnGestureEvent(INuimoController sender, NuimoGestureEvent nuimoGestureEvent)
        {
            switch (nuimoGestureEvent.Gesture)
            {
            case NuimoGesture.Rotate:
                ChangeTime(nuimoGestureEvent.Value);
                ShowTime(sender);
                break;

            case NuimoGesture.ButtonPress:
                SetUnset(sender);
                break;
            }
        }
示例#5
0
        public void OnGestureEvent(INuimoController sender, NuimoGestureEvent nuimoGestureEvent)
        {
            switch (nuimoGestureEvent.Gesture)
            {
            case NuimoGesture.ButtonPress:
                PlayPause();
                break;

            case NuimoGesture.Rotate:
                ChangeVolume(nuimoGestureEvent.Value);
                break;

            case NuimoGesture.SwipeLeft:
                Previous();
                break;

            case NuimoGesture.SwipeRight:
                Next();
                break;
            }
        }
示例#6
0
 public void OnGestureEvent(INuimoController sender, NuimoGestureEvent nuimoGestureEvent)
 {
     if (nuimoGestureEvent.Gesture == NuimoGesture.Rotate)
     {
         if (nuimoGestureEvent.Value > 0)
         {
             TestValue += 0.1;
         }
         else if (nuimoGestureEvent.Value < 0)
         {
             TestValue -= 0.1;
         }
         var progressMatrix = ProgressBars.VerticalBar(TestValue);
         sender.DisplayLedMatrixAsync(progressMatrix, 2,
                                      NuimoLedMatrixWriteOptions.WithFadeTransition | NuimoLedMatrixWriteOptions.WithoutWriteResponse);
     }
     if (nuimoGestureEvent.Gesture == NuimoGesture.ButtonPress)
     {
         sender.DisplayLedMatrixAsync(NuimoBuiltinLedMatrix.Busy);
     }
     Debug.WriteLine(nuimoGestureEvent.Gesture);
 }
示例#7
0
        private void OnNuimoGestureEventAsync(NuimoGestureEvent nuimoGestureEvent)
        {
            OutputTextBox.Text = new StringBuilder(OutputTextBox.Text)
                                 .Append("NuimoGesture: ")
                                 .Append(nuimoGestureEvent.Gesture)
                                 .Append(" value: ")
                                 .Append(nuimoGestureEvent.Value + "\n")
                                 .ToString();

            try
            {
                if (nuimoGestureEvent.Gesture == NuimoGesture.ButtonPress)
                {
                    TriggerApp(_profile.ButtonPress);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.ButtonRelease)
                {
                    TriggerApp(_profile.ButtonRelease);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.SwipeUp)
                {
                    TriggerApp(_profile.SwipeUp);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.SwipeDown)
                {
                    TriggerApp(_profile.SwipeDown);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.SwipeLeft)
                {
                    TriggerApp(_profile.SwipeLeft);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.SwipeRight)
                {
                    TriggerApp(_profile.SwipeRight);
                }

                if (nuimoGestureEvent.Gesture == NuimoGesture.Rotate && nuimoGestureEvent.Value > _settings.rotateThreshold)
                {
                    TriggerApp(_profile.RotateRight);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.Rotate && nuimoGestureEvent.Value < (-1 * _settings.rotateThreshold))
                {
                    TriggerApp(_profile.RotateLeft);
                }

                if (nuimoGestureEvent.Gesture == NuimoGesture.FlyUpDown && nuimoGestureEvent.Value >= 135)
                {
                    TriggerApp(_profile.FlyUp);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.FlyUpDown && nuimoGestureEvent.Value <= 115 && nuimoGestureEvent.Value > 1)
                {
                    TriggerApp(_profile.FlyDown);
                }

                if (nuimoGestureEvent.Gesture == NuimoGesture.FlyLeft)
                {
                    TriggerApp(_profile.FlyLeft);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.FlyRight)
                {
                    TriggerApp(_profile.FlyRight);
                }

                if (ProfileTextBox != null)
                {
                    ProfileTextBox.ScrollToBottom();
                }
                if (OutputTextBox != null)
                {
                    OutputTextBox.ScrollToBottom();
                }
            }
            catch (Exception ex)
            {
                OutputTextBox.Text = new StringBuilder(OutputTextBox.Text)
                                     .Append("Exception : ")
                                     .Append(ex.Message)
                                     .Append("\n")
                                     .Append(ex.StackTrace)
                                     .Append("\n")
                                     .ToString();
            }
        }
示例#8
0
 private void Controller_GestureEventOccurred(INuimoController arg1, NuimoGestureEvent arg2)
 {
     NuimoHub.AllClients.ConnectionStateChanged(arg1.Identifier, arg2);
 }