Esempio n. 1
0
        public override View Run()
        {
            var scrollView = new ScrollView();

            scrollView.UpdateBackgroundColor(Color.FromHex("#618833"));
            scrollView.ContentContainer.Layout = new LinearLayout
            {
                LinearOrientation = LinearLayout.Orientation.Vertical
            };

            List <CustomRenderingView> viewList = new List <CustomRenderingView>();

            for (int i = 0; i < 5; i++)
            {
                var canvas = new SKCanvasView()
                {
                    Margin     = new Extents(5, 5, 5, 5),
                    SizeWidth  = 300,
                    SizeHeight = 300,
                };
                var hlayout = new View
                {
                    SizeHeight = 310,
                    Layout     = new LinearLayout
                    {
                        LinearOrientation = LinearLayout.Orientation.Horizontal,
                        LinearAlignment   = LinearLayout.Alignment.Center,
                    }
                };

                canvas.PaintSurface += Draw;

                hlayout.Add(canvas);
                viewList.Add(canvas);
                scrollView.Add(hlayout);
            }

            timer = new Timer(10);

            timer.Tick += (s, e) =>
            {
                startx += 10;
                starty += 1;
                if (startx + 100 >= 300)
                {
                    startx = 0;
                }
                if (starty + 100 >= 300)
                {
                    starty = 0;
                }

                foreach (var view in viewList)
                {
                    view.Invalidate();
                }

                return(true);
            };

            scrollView.RemovedFromWindow += (s, e) =>
            {
                timer.Stop();
            };
            timer.Start();

            return(scrollView);
        }