public void Rotate(RotaryEventArgs args)
        {
            if (_rotating)
            {
                return;
            }

            _rotating = true;
            _angle   += args.IsClockwise ? 30 : -30;
            lblMaze.RotateTo(_angle).ContinueWith((b) =>
            {
                _rotating = false;
                //if (_angle == 90 || _angle == - 270)
                //{
                //}
                //else if (_angle == 180 || _angle == -180)
                //{
                //}
                //else if (_angle == 270 || _angle == -90 )
                //{
                //}
                //else
                if (_angle == 360) //_angle == 0 ||
                {
                    //lblMaze.Rotation = 0;
                    _angle = 0;
                }
            });
        }
示例#2
0
        public void Rotate(RotaryEventArgs args)
        {
            var h = (color.Hue + 0.05 * (args.IsClockwise ? 1 : -1)) % 1;

            color = Color.FromHsla(h, color.Saturation, color.Luminosity);
            source.BackgroundColor = color;
        }
示例#3
0
        void EventHandler(RotaryEventArgs args)
        {
            if (args.IsClockwise)
            {
                degrees += 10;
            }
            else
            {
                degrees -= 10;
            }

            if (degrees < 0)
            {
                degrees = 360;
            }
            else if (degrees > 360)
            {
                degrees = 0;
            }

            Rect    r   = rect.Geometry;
            EvasMap map = new EvasMap(4);

            map.PopulatePoints(rect, 0);
            map.Rotate(degrees, r.X + r.Width / 2, r.Y + r.Height / 2);
            rect.EvasMap      = map;
            rect.IsMapEnabled = true;
        }
 public void Rotate(RotaryEventArgs args)
 {
     if (args.IsClockwise)
     {
         VideoPlayer.Seek(VideoPlayer.Position + 2000);
     }
     else
     {
         VideoPlayer.Seek(VideoPlayer.Position - 2000);
     }
 }
示例#5
0
 /// <summary>
 /// IRotaryEventReceiver interface driven bezel rotation handler
 /// Zoom in and out the map every 1 second (to avoid quick zoom in / zoom out)
 /// </summary>
 public void Rotate(RotaryEventArgs args)
 {
     if (DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastZoomMillis > Config.ZOOM_EVERY_X_MILLISECONDS)
     {
         zoomLevel = args.IsClockwise ? zoomLevel * 0.80 : zoomLevel * 1.20;
         map.MoveToRegion(MapSpan.FromCenterAndRadius(map.VisibleRegion.Center, Distance.FromKilometers(zoomLevel)));
         lastZoomMillis = DateTimeOffset.Now.ToUnixTimeMilliseconds();
     }
     else
     {
         Tizen.Log.Debug("MapsViewApp", "To early to start another zoom");
     }
 }
示例#6
0
        public void Rotate(RotaryEventArgs args)
        {
            if (rotating)
            {
                return;
            }

            rotating = true;

            if (currentState == ONGOING_EVENT_STATE.RIGHT_DIRECTION_ROTATE)
            {
                if (rightDirectionRotateCount > 0)
                {
                    rightDirectionRotateCount--;
                    angle += args.IsClockwise ? 30 : -30;
                }
                else
                {
                    angle        = 0;
                    currentState = ONGOING_EVENT_STATE.LEFT_DIRECTION_ROTATE;
                    instruction  = "Rotate the bezel to the left.";
                }
            }
            else if (currentState == ONGOING_EVENT_STATE.LEFT_DIRECTION_ROTATE)
            {
                if (leftDirectionRotateCount > 0)
                {
                    leftDirectionRotateCount--;
                    angle += args.IsClockwise ? 30 : -30;
                }
                else
                {
                    currentState = ONGOING_EVENT_STATE.BACK_BUTTON_PRESS;
                    instruction  = "Press back button.";
                    angle        = 0;
                }
            }

            canvasView.RotateTo(angle).ContinueWith(
                (b) =>
            {
                rotating = false;
                if (angle == 360)
                {
                    canvasView.Rotation = 0;
                    angle = 0;
                }
            });
            canvasView.InvalidateSurface();
        }
示例#7
0
        public void Rotate(RotaryEventArgs args)
        {
            if (_rotating)
            {
                return;
            }

            _rotating = true;
            _angle   += args.IsClockwise ? 30 : -30;
            if (_angle >= 360.0)
            {
                _angle       = 0;
                Cat.Rotation = 0;
            }
            Cat.RotateTo(_angle).ContinueWith(t => _rotating = false);
        }
示例#8
0
        /// <summary>
        /// Handle bezel rotation
        /// </summary>
        /// <param name="args"></param>
        public void Rotate(RotaryEventArgs args)
        {
            var a = this.BindingContext;

            if (_rotating)
            {
                return;
            }
            _rotating = true;
            if (args.IsClockwise)
            {
                ((ViewModels.ForecastViewModel)BindingContext).NextForecastCommand.Execute(null);
                _rotating = false;
            }
            else
            {
                ((ViewModels.ForecastViewModel)BindingContext).PreviousForecastCommand.Execute(null);
                _rotating = false;
            }
        }
示例#9
0
        public void Rotate(RotaryEventArgs args)
        {
            if (_rotating)
            {
                return;
            }

            _rotating = true;
            _angle   += args.IsClockwise ? 30 : -30;
            Cat.RotateTo(_angle).ContinueWith(
                (b) =>
            {
                _rotating = false;
                if (_angle == 360)
                {
                    Cat.Rotation = 0;
                    _angle       = 0;
                }
            });
        }
示例#10
0
        public void Rotate(RotaryEventArgs args)
        {
            if (_rotating)
            {
                return;
            }

            _rotating = true;
            _angle   += args.IsClockwise ? 30 : -30;
            lblMaze.RotateTo(_angle).ContinueWith((b) =>
            {
                _rotating = false;
                if (_angle == 90 || _angle == -270)
                {
                    strLeft  = "DOWN";
                    strRight = "UP";
                }
                else if (_angle == 180 || _angle == -180)
                {
                    strLeft  = "RIGHT";
                    strRight = "LEFT";
                }
                else if (_angle == 270 || _angle == -90)
                {
                    strLeft  = "UP";
                    strRight = "DOWN";
                }
                else if (_angle == 0 || _angle == 360)
                {
                    strLeft          = "LEFT";
                    strRight         = "RIGHT";
                    lblMaze.Rotation = 0;
                    _angle           = 0;
                }
            });
        }
 /// <summary>
 /// Rotate
 /// </summary>
 /// <param name="args">RotaryEventArgs</param>
 public void Rotate(RotaryEventArgs args)
 {
     // When rotating (previous rotation is ongoing, do nothing.
     if (rotating)
     {
         return;
     }
     // Set ongoing flag true
     rotating = true;
     // Right rotate handling
     if (currentState == ONGOING_EVENT_STATE.RIGHT_DIRECTION_ROTATE)
     {
         // If at least one rotation performed.
         if (rightDirectionRotateCount > 0)
         {
             // Decrease rotation count
             rightDirectionRotateCount--;
             // Increase the angle to rotate canvas
             angle += args.IsClockwise ? 30 : -30;
         }
         else
         {
             // Finished to rotate right. Set angle to zero for left rotate
             angle = 0;
             // Set the state to rotate left
             currentState = ONGOING_EVENT_STATE.LEFT_DIRECTION_ROTATE;
             // Change the instruction
             instruction = "Rotate the bezel to the left.";
         }
     }
     // Left rotate handling
     else if (currentState == ONGOING_EVENT_STATE.LEFT_DIRECTION_ROTATE)
     {
         // If at least one rotation performed
         if (leftDirectionRotateCount > 0)
         {
             // Decrease rotation count
             leftDirectionRotateCount--;
             // Increase the angle to rotate canvas.
             angle += args.IsClockwise ? 30 : -30;
         }
         else
         {
             // Done rotate left, and move to next state (back button)
             currentState = ONGOING_EVENT_STATE.BACK_BUTTON_PRESS;
             // Change the instruction
             instruction = "Press back button.";
             angle       = 0;
         }
     }
     // Rotate the canvas
     canvasView.RotateTo(angle).ContinueWith(
         (b) =>
     {
         // Set this rotation done.
         rotating = false;
         // Angle should be set to 0 when it reaches 360.
         if (angle == 360)
         {
             canvasView.Rotation = 0;
             angle = 0;
         }
     });
     // Redraw the canvas
     canvasView.InvalidateSurface();
 }
 public void Rotate(RotaryEventArgs args) => _img.RelRotateTo(args.IsClockwise ? 30 : -30);
 private static void OnRotated(object sender, RotaryEventArgs args)
 {
     // Return true if rotated clockwise, otherwise false
     // TODO: Insert code to handle the Rotary rotated.
     Logger.Info($"Rotating clockwise is {args.IsClockwise}");
 }
        public void Rotate(RotaryEventArgs args)
        {
            var viewModel = BindingContext as MainWidgetViewModel;

            viewModel.Rotate(args.IsClockwise);
        }
 /// <summary>
 /// Invokes methods attached to RotationChanged event.
 /// </summary>
 /// <param name="args">Rotary arguments.</param>
 private void OnRotaryChange(RotaryEventArgs args)
 {
     RotationChanged?.Invoke(null, args.IsClockwise);
 }
示例#16
0
 /// <summary>
 /// This function handles RotaryEvent.
 /// </summary>
 /// <param name="args"> Rotary event arguments </param>
 public void Rotate(RotaryEventArgs args)
 {
     BadgeValue = BadgeValue + ((args.IsClockwise) ? 1 : -1);
 }
 protected void OnRotated(RotaryEventArgs args)
 {
     OnRotated(args.IsClockwise);
 }
 public void Rotate(RotaryEventArgs args)
 {
     Console.WriteLine("[RecordListPage]  Rotate() IsClockwise ? " + args.IsClockwise);
     //DataListView.ScrollTo();
 }
示例#19
0
 /// <summary>
 /// Function invoked when bezel is rotated
 /// </summary>
 /// <param name="args">Rotate Event Arguments</param>
 public void Rotate(RotaryEventArgs args)
 {
     _viewModel?.Rotate(args.IsClockwise ? true : false);
 }