Example #1
0
        private async void LoadContent()
        {
            ImageSource src  = null;
            ImageSource src1 = null;
            AdminIcon   ai   = await DBActions.LoadAdminIcon(DBActions._p(binary.PRODUCT));

            Images img = await DBActions.LoadProductImage(binary.PRODUCT);

            if (ai != null)
            {
                src = App.ByteToImage(ai.Image);
            }
            else
            {
                src = App.GetSource("icon-blank.png");
            }
            if (img != null)
            {
                src1 = App.ByteToImage(img.Image);
            }
            else
            {
                src1 = App.GetSource("noproduct.jpg");
            }
            icon.SetSRC(src);
            product_image.SetSRC(src1);
            content_loading.IsVisible = false;
            animation.Pause();
            LOADING = false;
        }
 private void AnimationButtonOnClicked(object sender, System.EventArgs e)
 {
     if (AnimationView.IsPlaying)
     {
         AnimationView.Pause();
         AnimationButton.Text = "Start Animation";
     }
     else
     {
         AnimationView.Play();
         AnimationButton.Text = "Stop Animation";
     }
 }
Example #3
0
 public void Pause()
 {
     Player?.Pause();
 }
Example #4
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Naviframe navi = new Naviframe(conformant)
            {
                PreserveContentOnPop     = true,
                DefaultBackButtonEnabled = true
            };

            navi.Show();
            conformant.SetContent(navi);

            Layout layout = new Layout(conformant)
            {
                WeightX    = 1,
                WeightY    = 1,
                AlignmentX = -1,
                AlignmentY = -1,
            };

            layout.SetTheme("layout", "application", "default");
            layout.Show();

            Background bg = new Background(layout)
            {
                WeightX    = 1,
                WeightY    = 1,
                AlignmentX = -1,
                AlignmentY = -1,
                Color      = Color.Gray,
            };

            bg.Show();
            layout.SetPartContent("elm.swallow.bg", bg);

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

            box.Show();
            box.SetPadding(5, 5);
            layout.SetPartContent("elm.swallow.content", box);

            Label label = new Label(box)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = 0.5,
                AlignmentY = 0,
            };

            label.Show();
            box.PackEnd(label);

            AnimationView aniview = new AnimationView(box)
            {
                WeightX    = 1,
                WeightY    = 1,
                AlignmentX = -1,
                AlignmentY = -1,
            };

            aniview.SetAnimation(Path.Combine(TestRunner.ResourceDir, "a_mountain.json"));
            aniview.Show();

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

            box1.Show();
            box.PackEnd(box1);

            Label label1 = new Label(box)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = 0.0,
                AlignmentY = 0.5,
                Text       = "Default Size = (" + aniview.DefaultSize.Width + "," + aniview.DefaultSize.Height + ")",
            };

            label1.Show();
            box1.PackEnd(label1);

            Label label2 = new Label(box)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = 1.0,
                AlignmentY = 0.5,
                Text       = "FrameCount : " + (aniview.FrameCount).ToString(),
            };

            label2.Show();
            box1.PackEnd(label2);

            Label label3 = new Label(box)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = 1.0,
                AlignmentY = 0.5,
                Text       = "Duration : " + (Math.Round(Convert.ToDouble(aniview.DurationTime), 2)).ToString(),
            };

            label3.Show();
            box.PackEnd(label3);

            box.PackEnd(aniview);

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

            box2.Show();
            box.PackEnd(box2);

            Check check = new Check(box2)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = -1,
                AlignmentY = -1,
                Text       = "Loop",
            };

            check.Show();
            box2.PackEnd(check);

            check.StateChanged += (s, e) =>
            {
                aniview.AutoRepeat = !aniview.AutoRepeat;
            };

            Check check2 = new Check(box2)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = -1,
                AlignmentY = -1,
                Text       = "Speed: 0.25x",
            };

            check2.Show();
            box2.PackEnd(check2);

            check2.StateChanged += (s, e) =>
            {
                if (check2.IsChecked)
                {
                    aniview.Speed = 0.25;
                }
                else
                {
                    aniview.Speed = 1.0;
                }
            };

            Slider slider = new Slider(box)
            {
                WeightX            = 1,
                WeightY            = 0,
                AlignmentX         = -1,
                AlignmentY         = -1,
                IsIndicatorVisible = true,
                IndicatorFormat    = "%1.1f",
                Minimum            = 0,
                Maximum            = 1,
            };

            slider.Show();
            box.PackEnd(slider);

            slider.ValueChanged += (s, e) =>
            {
                aniview.Progress = slider.Value;
            };

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

            box3.Show();
            box.PackEnd(box3);

            Label label4 = new Label(box)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = 0.0,
                AlignmentY = 0.5,
                Text       = (aniview.MinFrame).ToString() + " / " + (aniview.MaxFrame).ToString(),
            };

            label4.Show();
            box3.PackEnd(label4);

            Label label5 = new Label(box)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = 1.0,
                AlignmentY = 0.5,
                Text       = (aniview.MinProgress).ToString() + " / " + (aniview.MaxProgress).ToString(),
            };

            label5.Show();
            box3.PackEnd(label5);

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

            box4.Show();
            box.PackEnd(box4);

            Button btn1 = new Button(box4)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = -1,
                AlignmentY = -1,
                Text       = "Play",
            };

            btn1.Show();
            box4.PackEnd(btn1);

            btn1.Clicked += (s, e) =>
            {
                aniview.Play();
                UpdateAnimationViewStateLabel(aniview, label);
            };

            Button btn2 = new Button(box4)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = -1,
                AlignmentY = -1,
                Text       = "Reverse",
            };

            btn2.Show();
            box4.PackEnd(btn2);

            btn2.Clicked += (s, e) =>
            {
                aniview.Play(true);
                UpdateAnimationViewStateLabel(aniview, label);
            };

            Button btn3 = new Button(box4)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = -1,
                AlignmentY = -1,
                Text       = "Stop",
            };

            btn3.Show();
            box4.PackEnd(btn3);

            btn3.Clicked += (s, e) =>
            {
                aniview.Stop();
            };

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

            box5.Show();
            box.PackEnd(box5);

            Button btn4 = new Button(box5)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = -1,
                AlignmentY = -1,
                Text       = "Pause",
            };

            btn4.Show();
            box5.PackEnd(btn4);

            btn4.Clicked += (s, e) =>
            {
                aniview.Pause();
            };

            Button btn5 = new Button(box5)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = -1,
                AlignmentY = -1,
                Text       = "Resume",
            };

            btn5.Show();
            box5.PackEnd(btn5);

            btn5.Clicked += (s, e) =>
            {
                aniview.Resume();
            };

            aniview.Started += (s, e) =>
            {
                UpdateAnimationViewStateLabel(aniview, label);
            };

            aniview.Stopped += (s, e) =>
            {
                UpdateAnimationViewStateLabel(aniview, label);
                label4.Text  = "0 / " + (aniview.MaxFrame).ToString();
                label5.Text  = "0 / " + (aniview.MaxProgress).ToString();
                slider.Value = 0;
            };

            aniview.Paused += (s, e) =>
            {
                UpdateAnimationViewStateLabel(aniview, label);
            };

            aniview.Resumed += (s, e) =>
            {
                UpdateAnimationViewStateLabel(aniview, label);
            };

            aniview.Updated += (s, e) =>
            {
                slider.Value = aniview.Progress;
                label4.Text  = (aniview.Frame).ToString() + " / " + (aniview.MaxFrame).ToString();
                label5.Text  = (Math.Round(Convert.ToDouble(aniview.Progress), 2)).ToString() + " / " + (aniview.MaxProgress).ToString();
            };

            UpdateAnimationViewStateLabel(aniview, label);

            navi.Push(layout, "AnimationView Test");
        }
Example #5
0
        private void OnPageStateChanged(object sender, PageStateEventArgs e)
        {
            if (e.State == PredictionPageState.NoModelAvailable)
            {
                heroImage.IsVisible     = true;
                titleLabel.IsVisible    = true;
                messageLabel.IsVisible  = true;
                animationView.IsVisible = false;

                if (cameraIsAvailable)
                {
                    cameraPreview.IsVisible = false;
                    captureButton.IsVisible = false;

                    if (ToolbarItems.Contains(browseMedaToolbarItem))
                    {
                        ToolbarItems.Remove(browseMedaToolbarItem);
                    }

                    if (ToolbarItems.Contains(toggleCameraToolbarItem))
                    {
                        ToolbarItems.Remove(toggleCameraToolbarItem);
                    }
                }
            }

            else if (e.State == PredictionPageState.CameraReady)
            {
                if (animationView.IsPlaying)
                {
                    animationView.Pause();
                }

                if (!ToolbarItems.Contains(browseMedaToolbarItem))
                {
                    ToolbarItems.Add(browseMedaToolbarItem);
                }
                browseMedaToolbarItem.IsEnabled = true;

                if (!ToolbarItems.Contains(toggleCameraToolbarItem))
                {
                    ToolbarItems.Add(toggleCameraToolbarItem);
                }
                toggleCameraToolbarItem.IsEnabled = true;

                heroImage.IsVisible     = false;
                titleLabel.IsVisible    = false;
                messageLabel.IsVisible  = false;
                animationView.IsVisible = false;
                cameraPreview.IsVisible = true;
                captureButton.IsVisible = true;

                StartCamera();
            }

            else if (e.State == PredictionPageState.NoCameraReady)
            {
                if (animationView.IsPlaying)
                {
                    animationView.Pause();
                }

                if (!ToolbarItems.Contains(browseMedaToolbarItem))
                {
                    ToolbarItems.Add(browseMedaToolbarItem);
                    browseMedaToolbarItem.IsEnabled = true;
                }

                heroImage.IsVisible     = true;
                titleLabel.IsVisible    = true;
                messageLabel.IsVisible  = true;
                animationView.IsVisible = false;
                if (cameraIsAvailable)
                {
                    cameraPreview.IsVisible = false;
                    captureButton.IsVisible = false;
                }
            }

            else if (e.State == PredictionPageState.Uploading)
            {
                if (browseMedaToolbarItem != null)
                {
                    browseMedaToolbarItem.IsEnabled = false;
                }
                if (toggleCameraToolbarItem != null)
                {
                    toggleCameraToolbarItem.IsEnabled = false;
                }

                heroImage.IsVisible     = true;
                titleLabel.IsVisible    = true;
                messageLabel.IsVisible  = true;
                animationView.IsVisible = true;

                if (cameraIsAvailable)
                {
                    cameraPreview.IsVisible = false;
                    captureButton.IsVisible = false;
                    StopCamera();
                }

                animationView.Play();
                animationView.Loop = true;
            }

            else if (e.State == PredictionPageState.None)
            {
                heroImage.IsVisible     = false;
                titleLabel.IsVisible    = false;
                messageLabel.IsVisible  = false;
                animationView.IsVisible = false;

                if (cameraIsAvailable)
                {
                    cameraPreview.IsVisible = false;
                    captureButton.IsVisible = false;
                    StopCamera();
                }
            }
        }