Esempio n. 1
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;
        }
Esempio n. 2
0
        /// <summary>
        /// Changes the rotation of the given hand image.
        /// </summary>
        /// <param name="img">The image to be modified.</param>
        /// <param name="time">The time value used to calculate the angle.</param>
        /// <param name="maxTime">The maximal value the <code>time</code>
        /// parameter (12 for hours, 60 for minutes and seconds).</param>
        private void _updateHand(Image img, int time, int maxTime)
        {
            double rotation = time / (float)maxTime * 360.0;

            EvasMap map = new EvasMap(4);

            map.PopulatePoints(img, 0);
            map.Rotate(rotation, 180, 180);
            img.EvasMap      = map;
            img.IsMapEnabled = true;
        }
Esempio n. 3
0
        public override void Run(Window window)
        {
            Log.Debug("window id is " + window.Handle.ToString());
            Rect square = window.GetInnerSquare();

            Log.Debug(square.ToString());

            Rectangle redSquare = new Rectangle(window)
            {
                Color    = Color.Red,
                Geometry = square
            };

            redSquare.Show();

            double degrees = 0;

            RotaryEventHandler handler = (args) =>
            {
                if (args.IsClockwise)
                {
                    degrees += 10;
                }
                else
                {
                    degrees -= 10;
                }

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

                Rect    rect = redSquare.Geometry;
                EvasMap map  = new EvasMap(4);
                map.PopulatePoints(redSquare, 0);
                map.Rotate(degrees, rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
                redSquare.EvasMap      = map;
                redSquare.IsMapEnabled = true;
            };

            RotaryEventManager.Rotated += handler;

            window.BackButtonPressed += (s, e) =>
            {
                RotaryEventManager.Rotated -= handler;
                Log.Debug("handler is Removed!!!!!!!");
            };
        }