Example #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;
            }
        }
Example #2
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);
 }