Exemple #1
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);
        }
        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();
                }
            };
        }
Exemple #3
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();
                    });
                }
            };
        }