Exemplo n.º 1
0
        public override void Run(Window window)
        {
            Layout layout = new Layout(window);

            layout.Show();
            layout.Move(0, 0);
            layout.Resize(360, 360);

            var            surface        = new CircleSurface(layout);
            CircleScroller circleScroller = new CircleScroller(layout, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Invisible,
                HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto,
            };

            ((IRotaryActionWidget)circleScroller).Activate();
            circleScroller.Show();
            circleScroller.Move(0, 0);
            circleScroller.Resize(360, 360);
            circleScroller.Lower();

            Box box = new Box(window)
            {
                AlignmentX   = -1,
                AlignmentY   = -1,
                WeightX      = 1,
                WeightY      = 1,
                IsHorizontal = true,
            };

            box.Show();
            circleScroller.SetContent(box);

            var rnd = new Random();

            for (int i = 0; i < 10; i++)
            {
                int       r        = rnd.Next(255);
                int       g        = rnd.Next(255);
                int       b        = rnd.Next(255);
                Color     color    = Color.FromRgb(r, g, b);
                Rectangle colorBox = new Rectangle(window)
                {
                    AlignmentX   = -1,
                    AlignmentY   = -1,
                    WeightX      = 1,
                    WeightY      = 1,
                    Color        = color,
                    MinimumWidth = window.ScreenSize.Width,
                };
                colorBox.Show();
                box.PackEnd(colorBox);
            }
            circleScroller.Scrolled += (s, e) => Log.Debug(TestName, "Horizental Circle Scroll Scrolled");
        }
Exemplo n.º 2
0
        public override void Run(Window window)
        {
            var surface = new CircleSurface();

            CircleScroller circleScroller = new CircleScroller(window, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Auto,
                HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible,
                VerticalScrollBarColor           = Color.Yellow,
                VerticalScrollBackgroundColor    = Color.Red,
                VerticalScrollBarRadius          = 170,
                VerticalScrollBackgroundRadius   = 170,
            };

            ((IRotaryActionWidget)circleScroller).Activate();
            circleScroller.Show();
            circleScroller.Move(0, 0);
            circleScroller.Resize(360, 360);

            Box box = new Box(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            box.Show();
            circleScroller.SetContent(box);

            var rnd = new Random();

            for (int i = 0; i < 10; i++)
            {
                int       r        = rnd.Next(255);
                int       g        = rnd.Next(255);
                int       b        = rnd.Next(255);
                Color     color    = Color.FromRgb(r, g, b);
                Rectangle colorBox = new Rectangle(window)
                {
                    AlignmentX    = -1,
                    AlignmentY    = -1,
                    WeightX       = 1,
                    WeightY       = 1,
                    Color         = color,
                    MinimumHeight = window.ScreenSize.Height,
                };
                colorBox.Show();
                box.PackEnd(colorBox);
            }
            circleScroller.Scrolled += (s, e) => Log.Debug(TestName, "Horizental Circle Scroll Scrolled");
        }
Exemplo n.º 3
0
        void CreateTestPage(Window window)
        {
            var conformant = new Conformant(window);

            conformant.Show();

            var surface        = new CircleSurface(conformant);
            var circleScroller = new CircleScroller(conformant, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Invisible,
                HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto,
                ScrollBlock = ScrollBlock.Vertical,
                HorizontalPageScrollLimit = 1,
            };

            ((IRotaryActionWidget)circleScroller).Activate();
            circleScroller.SetPageSize(1.0, 1.0);
            conformant.SetContent(circleScroller);
            circleScroller.Show();

            var box = new Box(window)
            {
                AlignmentX    = -1,
                AlignmentY    = -1,
                WeightX       = 1,
                WeightY       = 1,
                IsHorizontal  = true,
                IsHomogeneous = true,
            };

            box.Show();
            box.PackEnd(CreateFirstPage(box));

            foreach (var tc in GetGalleryPage())
            {
                if (tc.ExceptProfile != ProfileType.Wearable)
                {
                    var view = tc.CreateContent(box);
                    if (view != null)
                    {
                        box.PackEnd(view);
                    }
                    else
                    {
                        box.PackEnd(CreateNewWindow(box, tc));
                    }
                }
            }
            circleScroller.SetContent(box);
        }
Exemplo n.º 4
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            var            surface        = new CircleSurface(conformant);
            CircleScroller circleScroller = new CircleScroller(conformant, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Auto,
                HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible,
            };

            ((IRotaryActionWidget)circleScroller).Activate();
            circleScroller.Show();
            conformant.SetContent(circleScroller);
            Box box = new Box(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1
            };

            box.Show();
            circleScroller.SetContent(box);

            var rnd = new Random();

            for (int i = 0; i < 10; i++)
            {
                int       r        = rnd.Next(255);
                int       g        = rnd.Next(255);
                int       b        = rnd.Next(255);
                Color     color    = Color.FromRgb(r, g, b);
                Rectangle colorBox = new Rectangle(window)
                {
                    AlignmentX    = -1,
                    AlignmentY    = -1,
                    WeightX       = 1,
                    WeightY       = 1,
                    Color         = color,
                    MinimumHeight = window.ScreenSize.Height,
                };
                colorBox.Show();
                box.PackEnd(colorBox);
            }
            circleScroller.Scrolled += (s, e) => Log.Debug(TestName, "Circle Scrolled Scrolled");
        }
Exemplo n.º 5
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Naviframe naviframe = new Naviframe(window);

            naviframe.Show();
            conformant.SetContent(naviframe);

            var            surface        = new CircleSurface(conformant);
            CircleScroller circleScroller = new CircleScroller(naviframe, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                VerticalScrollBarVisiblePolicy      = ScrollBarVisiblePolicy.Invisible,
                HorizontalScrollBarVisiblePolicy    = ScrollBarVisiblePolicy.Auto,
                HorizontalScrollBarColor            = new Color(255, 0, 0, 50),
                HorizontalScrollBackgroundColor     = Color.Orange,
                HorizontalScrollBarLineWidth        = 15,
                HorizontalScrollBackgroundLineWidth = 15,
            };

            ((IRotaryActionWidget)circleScroller).Activate();
            circleScroller.Show();
            naviframe.Push(circleScroller, null, "empty");


            Box box = new Box(window)
            {
                AlignmentX   = -1,
                AlignmentY   = -1,
                WeightX      = 1,
                WeightY      = 1,
                IsHorizontal = true,
            };

            box.Show();
            circleScroller.SetContent(box);

            var rnd = new Random();

            for (int i = 0; i < 10; i++)
            {
                int       r        = rnd.Next(255);
                int       g        = rnd.Next(255);
                int       b        = rnd.Next(255);
                Color     color    = Color.FromRgb(r, g, b);
                Rectangle colorBox = new Rectangle(window)
                {
                    AlignmentX   = -1,
                    AlignmentY   = -1,
                    WeightX      = 1,
                    WeightY      = 1,
                    Color        = color,
                    MinimumWidth = window.ScreenSize.Width,
                };
                colorBox.Show();
                box.PackEnd(colorBox);
            }
            circleScroller.Scrolled += (s, e) => Log.Debug(TestName, "Horizental Circle Scroll Scrolled");
        }
        void CreateGalleryPage(Window window)
        {
            var conformant = new Conformant(window);

            conformant.Show();

            var surface        = new CircleSurface(conformant);
            var circleScroller = new CircleScroller(conformant, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Invisible,
                HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto,
                ScrollBlock = ScrollBlock.Vertical,
                HorizontalPageScrollLimit = 1,
            };

            ((IRotaryActionWidget)circleScroller).Activate();
            circleScroller.SetPageSize(1.0, 1.0);
            conformant.SetContent(circleScroller);
            circleScroller.Show();

            var box = new Box(window)
            {
                AlignmentX    = -1,
                AlignmentY    = -1,
                WeightX       = 1,
                WeightY       = 1,
                IsHorizontal  = true,
                IsHomogeneous = true,
            };

            box.Show();
            box.PackEnd(CreateFirstPage(box));
            box.PackEnd(CreateThemePage(box));

            foreach (var tc in GetGalleryPage())
            {
                tc.CircleSurface = surface;
                if (tc is FloatingActionButtonPage fabPage)
                {
                    box.PackEnd(CreateNewWindow(box, tc));
                }
                else
                {
                    var view = tc.CreateContent(box);
                    box.PackEnd(view);
                }
            }
            circleScroller.SetContent(box);

            var animationView = new LottieAnimationView(window)
            {
                AutoPlay   = true,
                AutoRepeat = true,
            };
            var path = Path.Combine(DirectoryInfo.Resource, "material_wave_loading.json");

            animationView.SetAnimation(path);
            animationView.Move(50, 200);
            animationView.Resize(250, 250);
            animationView.Show();


            animationView.Finished += (s, e) =>
            {
                if (_animationloopCount == 10)
                {
                    _animationloopCount      = 0;
                    animationView.AutoRepeat = false;
                    animationView.Stop();
                    return;
                }
                _animationloopCount++;
            };

            _pageIndex = -1;
            circleScroller.Scrolled += (s, e) =>
            {
                if (_pageIndex == circleScroller.HorizontalPageIndex)
                {
                    return;
                }
                _pageIndex = circleScroller.HorizontalPageIndex;
                if (_pageIndex == 0)
                {
                    animationView.AutoRepeat = true;
                    animationView.Show();
                    animationView.Play();
                }
                else
                {
                    _animationloopCount      = 0;
                    animationView.AutoRepeat = false;
                    animationView.Hide();
                    animationView.Stop();
                }
            };
        }
Exemplo n.º 7
0
        void Initialize()
        {
            Window window = new Window("ElottieSharpGallery")
            {
                AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270 | DisplayRotation.Degree_90
            };

            window.BackButtonPressed += (s, e) =>
            {
                Exit();
            };
            window.Show();

            var conformant = new Conformant(window);

            conformant.Show();

            var            surface        = new CircleSurface(conformant);
            CircleScroller circleScroller = new CircleScroller(conformant, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Invisible,
                HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto,
                ScrollBlock = ScrollBlock.Vertical,
                HorizontalPageScrollLimit = 1,
            };

            ((IRotaryActionWidget)circleScroller).Activate();
            circleScroller.SetPageSize(1.0, 1.0);
            circleScroller.Show();
            conformant.SetContent(circleScroller);

            var box = new Box(window)
            {
                AlignmentX   = -1,
                AlignmentY   = -1,
                WeightX      = 1,
                WeightY      = 1,
                IsHorizontal = true,
            };

            box.Show();
            circleScroller.SetContent(box);

            for (int i = 0; i < 10; i++)
            {
                _views[i] = new LottieAnimationView(window)
                {
                    AlignmentX = -1,
                    AlignmentY = -1,
                    WeightX    = 1,
                    WeightY    = 1,
                    AutoRepeat = true,
                };
                _views[i].Show();

                var path = Path.Combine(DirectoryInfo.Resource, _files[i]);
                _views[i].SetAnimation(path);

                if (i == 0)
                {
                    _views[i].Play();
                }

                box.PackEnd(_views[i]);
            }

            circleScroller.Scrolled += (s, e) =>
            {
                if (_currentIndex != circleScroller.HorizontalPageIndex)
                {
                    int oldIndex = _currentIndex;
                    _currentIndex = circleScroller.HorizontalPageIndex;
                    EcoreMainloop.Post(() =>
                    {
                        if (_views[oldIndex].IsPlaying)
                        {
                            _views[oldIndex].Stop();
                        }
                        _views[_currentIndex].Play();
                    });
                }
            };
        }