예제 #1
0
        void GestureRecognizer_OnGestureRecognized(object sender, TouchGestureEventArgs args)
        {
            switch (args.Type)
            {
            case TouchGestureType.Tap:
                //Console.WriteLine("TAP");
                break;

            case TouchGestureType.LongTap:
                //Console.WriteLine("LONGTAP");
                break;

            case TouchGestureType.Pan:
                //Console.WriteLine("PAN");
                try
                {
                    date.AddTicks(-2 * (Int64)args.Data.X * pixeltime);
                }
                catch (OverflowException)
                {
                    if (args.Data.X < 0)
                    {
                        date = TimelineDateTime.MaxValue;
                    }
                    else
                    {
                        date = TimelineDateTime.MinValue;
                    }
                }
                DateStr = date.DateStr(ZoomUnit - 1);
                canvasView.InvalidateSurface();
                break;

            case TouchGestureType.Pinch:
                //Console.WriteLine("PINCH - " + args.Data.ToString());
                Zoom -= Zoom * 0.005 * args.Data.X;
                if (Zoom < 4)
                {
                    Zoom = 4;
                }
                if (Zoom > 2073600)
                {
                    Zoom = 2073600;
                }
                pixeltime = (Int64)(Zoom * TimeSpan.TicksPerSecond);
                //Console.WriteLine("Zoom: " + Zoom.ToString() + "  pixeltime: " + pixeltime.ToString());
                AdjustZoomUnit();
                DateStr = date.DateStr(ZoomUnit - 1);
                canvasView.InvalidateSurface();
                break;

            case TouchGestureType.Swipe:
                //Console.WriteLine("SWIPE");
                break;
            }
        }
예제 #2
0
        public TimelineControl()
        {
            InitializeComponent();
            gestureRecognizer = new TouchGestureRecognizer();
            gestureRecognizer.OnGestureRecognized += GestureRecognizer_OnGestureRecognized;

            date        = new TimelineDateTime(9900);
            unitDate    = new TimelineDateTime();
            subUnitDate = new TimelineDateTime();
            DateStr     = date.DateStr(ZoomUnit);

            pixeltime       = (Int64)(Zoom * TimeSpan.TicksPerSecond);
            showSubUnitText = false;

            initialOrientationCheck = true;

            timelinePaint    = new SKPaint();
            unitMarkPaint    = new SKPaint();
            unitTextPaint    = new SKPaint();
            subUnitMarkPaint = new SKPaint();
            subUnitTextPaint = new SKPaint();
            highlightPaint   = new SKPaint();

            eventPaint             = new SKPaint();
            eventPaint.StrokeWidth = 2;
            eventPaint.Color       = Color.DarkGray.ToSKColor();
            eventPaint.Style       = SKPaintStyle.Fill;

            eventBorderPaint             = new SKPaint();
            eventBorderPaint.Color       = Color.Black.ToSKColor();
            eventBorderPaint.StrokeWidth = 4;
            eventBorderPaint.Style       = SKPaintStyle.Stroke;

            eventTextPaint          = new SKPaint();
            eventTextPaint.Color    = Color.Black.ToSKColor();
            eventTextPaint.TextSize = 16;
        }