Esempio n. 1
0
        public void AnimatedImageViewPlay()
        {
            tlog.Debug(tag, $"AnimatedImageViewPlay START");

            var testingTarget = new AnimatedImageView();

            Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView");
            Assert.IsInstanceOf <AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type.");

            using (PropertyMap map = new PropertyMap())
            {
                map.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
                map.Insert(ImageVisualProperty.URL, new PropertyValue(url));
                map.Insert(ImageVisualProperty.AlphaMaskURL, new PropertyValue(url));
                map.Insert(ImageVisualProperty.AuxiliaryImageURL, new PropertyValue(url));
                map.Insert(ImageVisualProperty.Border, new PropertyValue(new Extents(4, 4, 4, 4)));
                map.Insert(ImageVisualProperty.TotalFrameNumber, new PropertyValue(30));
                map.Insert(ImageVisualProperty.CurrentFrameNumber, new PropertyValue(0));

                testingTarget.Image = map;

                testingTarget.BatchSize    = 2;
                testingTarget.CacheSize    = 2;
                testingTarget.LoopCount    = 3;
                testingTarget.StopBehavior = AnimatedImageView.StopBehaviorType.MinimumFrame;

                try
                {
                    testingTarget.Play();
                }
                catch (Exception e)
                {
                    testingTarget.Dispose();
                    tlog.Debug(tag, e.Message.ToString());
                    tlog.Debug(tag, $"AnimatedImageViewPlay END (OK)");
                    Assert.Pass("Passed!");
                }
            }
            testingTarget?.Dispose();
            tlog.Debug(tag, $"AnimatedImageViewPlay END (OK)");
        }
Esempio n. 2
0
            public Box(Size2D boxSize, string boxTitle, string imageUrl)
            {
                this.Size2D          = boxSize;
                this.Margin          = new Extents(0, 0, 20, 20);
                this.BackgroundColor = Color.Magenta;

                title                 = new TextLabel(boxTitle);
                title.Size2D          = new Size2D(boxSize.Width, GetRatio(20, boxSize.Height));
                title.Position2D      = new Position2D(0, 0);
                title.MultiLine       = true;
                title.BackgroundColor = Color.Blue;
                title.TextColor       = Color.Yellow;
                this.Add(title);

                image             = new AnimatedImageView();
                image.Size2D      = new Size2D(boxSize.Width, GetRatio(50, boxSize.Height));
                image.Position2D  = new Position2D(0, title.Size2D.Height);
                image.ResourceUrl = imageUrl;
                image.Play();
                this.Add(image);

                status                 = new TextLabel("Initialized");
                status.Size2D          = new Size2D(boxSize.Width, GetRatio(20, boxSize.Height));
                status.Position2D      = new Position2D(0, image.Position2D.Y + image.Size2D.Height);
                status.MultiLine       = true;
                status.BackgroundColor = Color.White;
                status.PointSize       = 20;
                this.Add(status);

                ButtonStyle aStyle = new ButtonStyle
                {
                    IsSelectable    = true,
                    BackgroundImage = new Selector <string>
                    {
                        Normal   = CommonResource.GetFHResourcePath() + "3. Button/[Button] App Primary Color/rectangle_toggle_btn_normal_24c447.png",
                        Selected = CommonResource.GetFHResourcePath() + "3. Button/[Button] App Primary Color/rectangle_point_btn_normal_24c447.png",
                    },
                    BackgroundImageBorder = new Selector <Rectangle> {
                        All = new Rectangle(5, 5, 5, 5)
                    },

                    ImageShadow = new ImageShadow(CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png", new Rectangle(5, 5, 5, 5)),

                    Overlay = new ImageViewStyle
                    {
                        ResourceUrl = new Selector <string> {
                            Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = ""
                        },
                        Border = new Selector <Rectangle> {
                            All = new Rectangle(5, 5, 5, 5)
                        },
                    },

                    Text = new TextLabelStyle
                    {
                        PointSize = new Selector <float?> {
                            All = 20
                        },
                        HorizontalAlignment = HorizontalAlignment.Center,
                        VerticalAlignment   = VerticalAlignment.Center,
                        WidthResizePolicy   = ResizePolicyType.FillToParent,
                        HeightResizePolicy  = ResizePolicyType.FillToParent,

                        TextColor = new Selector <Color>
                        {
                            Normal   = new Color(0.141f, 0.769f, 0.278f, 1),
                            Selected = new Color(1, 1, 1, 1),
                        },
                    }
                };

                but1        = new Button(aStyle);
                but1.Size2D = new Size2D(GetRatio(32, boxSize.Width), GetRatio(10, boxSize.Height));
                but1.PositionUsesPivotPoint = true;
                but1.ParentOrigin           = Tizen.NUI.ParentOrigin.BottomLeft;
                but1.PivotPoint             = Tizen.NUI.ParentOrigin.BottomLeft;
                but1.Style.Text.Text        = new Selector <string>
                {
                    Normal   = "Button1 Normal",
                    Selected = "Button1 Selected",
                    Disabled = "Button2 Disabled",
                };
                this.Add(but1);

                but2        = new Button(aStyle);
                but2.Size2D = new Size2D(GetRatio(32, boxSize.Width), GetRatio(10, boxSize.Height));
                but2.PositionUsesPivotPoint = true;
                but2.ParentOrigin           = Tizen.NUI.ParentOrigin.BottomCenter;
                but2.PivotPoint             = Tizen.NUI.ParentOrigin.BottomCenter;
                but2.Style.Text.Text        = new Selector <string>
                {
                    Normal   = "Button2 Normal",
                    Selected = "Button2 Selected",
                    Disabled = "Button2 Disabled",
                };
                this.Add(but2);

                but3        = new Button(aStyle);
                but3.Size2D = new Size2D(GetRatio(32, boxSize.Width), GetRatio(10, boxSize.Height));
                but3.PositionUsesPivotPoint = true;
                but3.ParentOrigin           = Tizen.NUI.ParentOrigin.BottomRight;
                but3.PivotPoint             = Tizen.NUI.ParentOrigin.BottomRight;
                but3.Style.Text.Text        = new Selector <string>
                {
                    Normal   = "Button3 Normal",
                    Selected = "Button3 Selected",
                    Disabled = "Button2 Disabled",
                };
                this.Add(but3);
            }