Example #1
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            root = new View()
            {
                Size            = new Size(1920, 1080),
                BackgroundColor = new Color(0.7f, 0.9f, 0.8f, 1.0f),
            };
            window.Add(root);

            parent1 = new View()
            {
                Size = new Size(1920, 1080),
            };
            parent1.Layout = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Horizontal,
                LinearAlignment   = LinearLayout.Alignment.Center,
                CellPadding       = new Size(50, 50)
            };

            parent2 = new View()
            {
                Size = new Size(1032, 980),
            };
            parent2.Layout = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Vertical,
                LinearAlignment   = LinearLayout.Alignment.CenterHorizontal,
                CellPadding       = new Size(400, 400)
            };

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            createText[0]      = new TextLabel();
            createText[0].Text = "Create Popup just by properties";
            createText[0].WidthSpecification  = 500;
            createText[0].HeightSpecification = 100;
            parent2.Add(createText[0]);

            popup             = new Popup();
            popup.MinimumSize = new Size(1032, 184);
            popup.Size        = new Size(1032, 400);
            popup.Position    = new Position(150, 100);

            // Title
            popup.Title.PointSize = 25;
            popup.Title.Size      = new Size(0, 68);
            popup.Title.PositionUsesPivotPoint = true;
            popup.Title.ParentOrigin           = Tizen.NUI.ParentOrigin.TopLeft;
            popup.Title.PivotPoint             = Tizen.NUI.PivotPoint.TopLeft;
            popup.Title.HorizontalAlignment    = HorizontalAlignment.Begin;
            popup.Title.VerticalAlignment      = VerticalAlignment.Bottom;
            popup.Title.Position = new Position(64, 52);
            popup.Title.Text     = "Popup Title";
            popup.Title.Padding  = 0;

            // Shadow
            popup.ImageShadow = new ImageShadow(CommonResource.GetFHResourcePath() + "11. Popup/popup_background_shadow.png", new Rectangle(24, 24, 24, 24), extents: new Vector2(48, 48));

            // Background
            popup.BackgroundImage       = CommonResource.GetFHResourcePath() + "11. Popup/popup_background.png";
            popup.BackgroundImageBorder = new Rectangle(0, 0, 81, 81);

            // Buttons
            popup.AddButton("Yes");
            popup.AddButton("Exit");
            popup.ButtonBackground       = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png";
            popup.ButtonBackgroundBorder = new Rectangle(5, 5, 5, 5);
            popup.ButtonOverLayBackgroundColorSelector = new Selector <Color>
            {
                Normal  = new Color(1.0f, 1.0f, 1.0f, 0.5f),
                Pressed = new Color(0.0f, 0.0f, 0.0f, 0.5f)
            };
            popup.ButtonImageShadow       = new ImageShadow(CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png", new Rectangle(5, 5, 5, 5));
            popup.ButtonTextColor         = color[0];
            popup.ButtonHeight            = 132;
            popup.PopupButtonClickEvent  += PopupButtonClickedEvent;
            popup.LayoutDirectionChanged += PopupLayoutDirectionChanged;
            popup.Post(window);

            contentText                     = new TextLabel();
            contentText.Size                = new Size(1032, 100);
            contentText.PointSize           = 20;
            contentText.HorizontalAlignment = HorizontalAlignment.Begin;
            contentText.VerticalAlignment   = VerticalAlignment.Center;
            contentText.Text                = "Popup ButtonStyle is " + buttonStyles[index];
            contentText.TextColor           = new Color(0, 0, 222, 1);
            popup.AddContentText(contentText);

            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            createText[1]      = new TextLabel();
            createText[1].Text = "Create Popup just by Attributes";
            createText[1].WidthSpecification  = 500;
            createText[1].HeightSpecification = 100;
            parent2.Add(createText[1]);

            PopupStyle attrs = new PopupStyle
            {
                MinimumSize     = new Size(1032, 184),
                BackgroundImage = new Selector <string> {
                    All = CommonResource.GetFHResourcePath() + "11. Popup/popup_background.png"
                },
                BackgroundImageBorder = new Selector <Rectangle> {
                    All = new Rectangle(0, 0, 81, 81)
                },
                ImageShadow = new ImageShadow(CommonResource.GetFHResourcePath() + "11. Popup/popup_background_shadow.png", new Rectangle(24, 24, 24, 24), extents: new Vector2(48, 48)),
                Title       = new TextLabelStyle
                {
                    PointSize = new Selector <float?> {
                        All = 25
                    },
                    TextColor = new Selector <Color> {
                        All = Color.Black
                    },
                    Size = new Size(0, 68),
                    PositionUsesPivotPoint = true,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.TopLeft,
                    PivotPoint             = Tizen.NUI.PivotPoint.TopLeft,
                    HorizontalAlignment    = HorizontalAlignment.Begin,
                    VerticalAlignment      = VerticalAlignment.Bottom,
                    Position = new Position(64, 52),
                    Text     = new Selector <string> {
                        All = "Popup Title"
                    },
                },
                Buttons = new ButtonStyle
                {
                    PositionUsesPivotPoint = true,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.BottomLeft,
                    PivotPoint             = Tizen.NUI.PivotPoint.BottomLeft,
                    BackgroundImage        = new Selector <string> {
                        All = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.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
                    {
                        PositionUsesPivotPoint = true,
                        ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                        PivotPoint             = Tizen.NUI.PivotPoint.Center,
                        WidthResizePolicy      = ResizePolicyType.FillToParent,
                        HeightResizePolicy     = ResizePolicyType.FillToParent,
                        BackgroundColor        = new Selector <Color>
                        {
                            Normal  = new Color(1.0f, 1.0f, 1.0f, 0.5f),
                            Pressed = new Color(0.0f, 0.0f, 0.0f, 0.5f),
                        }
                    },
                    Text = new TextLabelStyle
                    {
                        PositionUsesPivotPoint = true,
                        ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                        PivotPoint             = Tizen.NUI.PivotPoint.Center,
                        HorizontalAlignment    = HorizontalAlignment.Center,
                        VerticalAlignment      = VerticalAlignment.Center,
                        TextColor = new Selector <Color> {
                            All = color[index2]
                        }
                    },
                },
            };

            popup2          = new Popup(attrs);
            popup2.Size     = new Size(1032, 400);
            popup2.Position = new Position(150, 600);
            popup2.AddButton("Yes");
            popup2.AddButton("Exit");
            popup2.ButtonHeight            = 132;
            popup2.PopupButtonClickEvent  += PopupButtonClickedEvent;
            popup2.LayoutDirectionChanged += Popup2LayoutDirectionChanged;
            popup2.Post(window);

            contentText2                     = new TextLabel();
            contentText2.Size                = new Size(1032, 100);
            contentText2.PointSize           = 20;
            contentText2.HorizontalAlignment = HorizontalAlignment.Begin;
            contentText2.VerticalAlignment   = VerticalAlignment.Center;
            contentText2.Text                = "Popup2 ButtonStyle is " + buttonStyles[index];
            popup2.ContentView.Add(contentText2);

            button = new Button();
            button.BackgroundImage       = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            button.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
            button.WidthSpecification    = 580;
            button.HeightSpecification   = 80;
            button.TextLabel.Text        = "LayoutDirection is left to right";
            button.Clicked += ButtonClicked;

            parent1.Add(parent2);
            parent1.Add(button);
            root.Add(parent1);
        }
Example #2
0
        public void Activate()
        {
            Window window = Window.Instance;

            root = new View()
            {
                Size2D          = new Size2D(1920, 1080),
                BackgroundColor = Color.White,
            };
            window.Add(root);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            createText[0]            = new TextLabel();
            createText[0].Text       = "Create CheckBox just by properties";
            createText[0].TextColor  = Color.White;
            createText[0].Size2D     = new Size2D(500, 100);
            createText[0].Position2D = new Position2D(400, 100);
            root.Add(createText[0]);

            int num = 4;

            for (int i = 0; i < num; i++)
            {
                group[i]               = new CheckBoxGroup();
                modeText[i]            = new TextLabel();
                modeText[i].Text       = mode[i];
                modeText[i].Size2D     = new Size2D(200, 48);
                modeText[i].Position2D = new Position2D(300 + 200 * i, 200);
                root.Add(modeText[i]);
            }

            for (int i = 0; i < num; i++)
            {
                utilityCheckBox[i]                           = new CheckBox();
                utilityCheckBox[i].Size2D                    = new Size2D(150, 48);
                utilityCheckBox[i].Position2D                = new Position2D(300, 300 + i * 100);
                utilityCheckBox[i].Style.Icon.Size           = new Size(48, 48);
                utilityCheckBox[i].Style.Icon.Padding.Start  = 0;
                utilityCheckBox[i].Style.Icon.Padding.End    = 0;
                utilityCheckBox[i].Style.Icon.Padding.Top    = 0;
                utilityCheckBox[i].Style.Icon.Padding.Bottom = 0;
                utilityCheckBox[i].Style.Icon.Opacity        = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                utilityCheckBox[i].Style.Icon.BackgroundImage = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_on.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_on.png",
                };
                utilityCheckBox[i].Style.Icon.ResourceUrl = new Selector <string>
                {
                    Normal           = "",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check.png",
                    Disabled         = "",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check.png",
                };
                utilityCheckBox[i].Style.Icon.ImageShadow = new Selector <ImageShadow>
                {
                    Normal           = "",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_shadow.png",
                    Disabled         = "",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_shadow.png",
                };

                //utilityCheckBox[i].Text = "Check" + i;
                //utilityCheckBox[i].TextAlignment = HorizontalAlignment.Begin;
                //utilityCheckBox[i].PointSize = 12;
                //utilityCheckBox[i].TextPaddingLeft = 70;

                group[0].Add(utilityCheckBox[i]);
                //////
                familyCheckBox[i]                           = new CheckBox();
                familyCheckBox[i].Size2D                    = new Size2D(48, 48);
                familyCheckBox[i].Position2D                = new Position2D(500, 300 + i * 100);
                familyCheckBox[i].Style.Icon.Size           = new Size(48, 48);
                familyCheckBox[i].Style.Icon.Padding.Start  = 0;
                familyCheckBox[i].Style.Icon.Padding.End    = 0;
                familyCheckBox[i].Style.Icon.Padding.Top    = 0;
                familyCheckBox[i].Style.Icon.Padding.Bottom = 0;
                familyCheckBox[i].Style.Icon.Opacity        = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                familyCheckBox[i].Style.Icon.ResourceUrl = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_24c447.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_24c447.png",
                };

                group[1].Add(familyCheckBox[i]);
                /////////
                foodCheckBox[i]                           = new CheckBox();
                foodCheckBox[i].Size2D                    = new Size2D(48, 48);
                foodCheckBox[i].Position2D                = new Position2D(700, 300 + i * 100);
                foodCheckBox[i].Style.Icon.Size           = new Size(48, 48);
                foodCheckBox[i].Style.Icon.Padding.Start  = 0;
                foodCheckBox[i].Style.Icon.Padding.End    = 0;
                foodCheckBox[i].Style.Icon.Padding.Top    = 0;
                foodCheckBox[i].Style.Icon.Padding.Bottom = 0;
                foodCheckBox[i].Style.Icon.Opacity        = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                foodCheckBox[i].Style.Icon.ResourceUrl = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_ec7510.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_ec7510.png",
                };

                group[2].Add(foodCheckBox[i]);
                ////////
                kitchenCheckBox[i]                           = new CheckBox();
                kitchenCheckBox[i].Size2D                    = new Size2D(48, 48);
                kitchenCheckBox[i].Position2D                = new Position2D(900, 300 + i * 100);
                kitchenCheckBox[i].Style.Icon.Size           = new Size(48, 48);
                kitchenCheckBox[i].Style.Icon.Padding.Start  = 0;
                kitchenCheckBox[i].Style.Icon.Padding.End    = 0;
                kitchenCheckBox[i].Style.Icon.Padding.Top    = 0;
                kitchenCheckBox[i].Style.Icon.Padding.Bottom = 0;

                kitchenCheckBox[i].Style.Icon.Opacity = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                kitchenCheckBox[i].Style.Icon.ResourceUrl = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_9762d9.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_9762d9.png",
                };

                group[3].Add(kitchenCheckBox[i]);

                root.Add(utilityCheckBox[i]);
                root.Add(familyCheckBox[i]);
                root.Add(foodCheckBox[i]);
                root.Add(kitchenCheckBox[i]);
            }
            /////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            createText[1]            = new TextLabel();
            createText[1].Text       = "Create CheckBox just by Attributes";
            createText[1].TextColor  = Color.White;
            createText[1].Size2D     = new Size2D(500, 100);
            createText[1].Position2D = new Position2D(1200, 100);
            root.Add(createText[1]);

            for (int i = 0; i < num; i++)
            {
                group2[i]               = new CheckBoxGroup();
                modeText2[i]            = new TextLabel();
                modeText2[i].Text       = mode[i];
                modeText2[i].Size2D     = new Size2D(200, 48);
                modeText2[i].Position2D = new Position2D(1100 + 200 * i, 200);
                root.Add(modeText2[i]);
            }

            ButtonStyle utilityAttrs = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size    = new Size(48, 48),
                    Opacity = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    BackgroundImage = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_on.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_on.png",
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = "",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check.png",
                        Disabled         = "",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check.png",
                    },
                    ImageShadow = new Selector <ImageShadow>
                    {
                        Normal           = "",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_shadow.png",
                        Disabled         = "",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_shadow.png",
                    },
                }
            };
            ButtonStyle familyAttrs = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size    = new Size(48, 48),
                    Opacity = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_24c447.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_24c447.png",
                    },
                }
            };
            ButtonStyle foodAttrs = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size     = new Size(48, 48),
                    Position = new Position(0, 0),
                    Opacity  = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_ec7510.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_ec7510.png",
                    },
                },
            };
            ButtonStyle kitchenAttrs = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size     = new Size(48, 48),
                    Position = new Position(0, 0),
                    Opacity  = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_9762d9.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_9762d9.png",
                    },
                },
            };

            for (int i = 0; i < num; i++)
            {
                utilityCheckBox2[i]            = new CheckBox(utilityAttrs);
                utilityCheckBox2[i].Size2D     = new Size2D(48, 48);
                utilityCheckBox2[i].Position2D = new Position2D(1100, 300 + i * 100);
                group2[0].Add(utilityCheckBox2[i]);

                familyCheckBox2[i]            = new CheckBox(familyAttrs);
                familyCheckBox2[i].Size2D     = new Size2D(48, 48);
                familyCheckBox2[i].Position2D = new Position2D(1300, 300 + i * 100);
                group2[1].Add(familyCheckBox2[i]);

                foodCheckBox2[i]            = new CheckBox(foodAttrs);
                foodCheckBox2[i].Size2D     = new Size2D(48, 48);
                foodCheckBox2[i].Position2D = new Position2D(1500, 300 + i * 100);
                group2[2].Add(foodCheckBox2[i]);

                kitchenCheckBox2[i]            = new CheckBox(kitchenAttrs);
                kitchenCheckBox2[i].Size2D     = new Size2D(48, 48);
                kitchenCheckBox2[i].Position2D = new Position2D(1700, 300 + i * 100);
                group2[3].Add(kitchenCheckBox2[i]);

                root.Add(utilityCheckBox2[i]);
                root.Add(familyCheckBox2[i]);
                root.Add(foodCheckBox2[i]);
                root.Add(kitchenCheckBox2[i]);
            }

            utilityCheckBox[2].IsEnabled = false;
            familyCheckBox[2].IsEnabled  = false;
            foodCheckBox[2].IsEnabled    = false;
            kitchenCheckBox[2].IsEnabled = false;

            utilityCheckBox2[2].IsEnabled = false;
            familyCheckBox2[2].IsEnabled  = false;
            foodCheckBox2[2].IsEnabled    = false;
            kitchenCheckBox2[2].IsEnabled = false;

            utilityCheckBox[3].IsEnabled  = false;
            familyCheckBox[3].IsEnabled   = false;
            foodCheckBox[3].IsEnabled     = false;
            kitchenCheckBox[3].IsEnabled  = false;
            utilityCheckBox[3].IsSelected = true;
            familyCheckBox[3].IsSelected  = true;
            foodCheckBox[3].IsSelected    = true;
            kitchenCheckBox[3].IsSelected = true;

            utilityCheckBox2[3].IsEnabled  = false;
            familyCheckBox2[3].IsEnabled   = false;
            foodCheckBox2[3].IsEnabled     = false;
            kitchenCheckBox2[3].IsEnabled  = false;
            utilityCheckBox2[3].IsSelected = true;
            familyCheckBox2[3].IsSelected  = true;
            foodCheckBox2[3].IsSelected    = true;
            kitchenCheckBox2[3].IsSelected = true;
        }
Example #3
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            root = new View()
            {
                Size2D          = new Size2D(1920, 1080),
                BackgroundColor = Color.White,
            };
            window.Add(root);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            createText[0]            = new TextLabel();
            createText[0].Text       = "Create DropDown just by properties";
            createText[0].Size2D     = new Size2D(450, 100);
            createText[0].Position2D = new Position2D(200, 100);
            createText[0].MultiLine  = true;
            root.Add(createText[0]);

            #region CreateByProperty
            dropDown                                       = new DropDown();
            dropDown.Size2D                                = new Size2D(900, 108);
            dropDown.Position2D                            = new Position2D(50, 300);
            dropDown.Style.HeaderText.Text                 = "TitleArea";
            dropDown.Style.HeaderText.TextColor            = new Color(0, 0, 0, 1);
            dropDown.Style.HeaderText.PointSize            = 28;
            dropDown.Style.HeaderText.FontFamily           = "SamsungOneUI 500C";
            dropDown.Style.Button.Text.Text                = "DropDown Text";
            dropDown.Style.Button.Text.TextColor           = new Color(0, 0, 0, 1);
            dropDown.Style.Button.Text.PointSize           = 20;
            dropDown.Style.Button.Text.FontFamily          = "SamsungOneUI 500";
            dropDown.Style.Button.Icon.ResourceUrl         = CommonResource.GetFHResourcePath() + "6. List/list_ic_dropdown.png";
            dropDown.Style.Button.Icon.Size                = new Size(48, 48);
            dropDown.Style.Button.IconRelativeOrientation  = Button.IconOrientation.Right;
            dropDown.Style.Button.PositionX                = 56;
            dropDown.SpaceBetweenButtonTextAndIcon         = 8;
            dropDown.Style.ListBackgroundImage.ResourceUrl = CommonResource.GetFHResourcePath() + "10. Drop Down/dropdown_bg.png";
            dropDown.Style.ListBackgroundImage.Border      = new Rectangle(51, 51, 51, 51);
            dropDown.Style.ListBackgroundImage.Size        = new Size(360, 500);
            dropDown.ListMargin.Start                      = 20;
            dropDown.ListMargin.Top                        = 20;
            dropDown.ListPadding                           = new Extents(4, 4, 4, 4);
            root.Add(dropDown);

            for (int i = 0; i < 8; i++)
            {
                DropDown.DropDownDataItem item = new DropDown.DropDownDataItem();
                item.Size            = new Size(360, 96);
                item.BackgroundColor = new Selector <Color>
                {
                    Pressed = new Color(0, 0, 0, 0.4f),
                    Other   = new Color(1, 1, 1, 0),
                };
                item.Text                    = "Normal list " + i;
                item.PointSize               = 18;
                item.FontFamily              = "SamsungOne 500";
                item.TextPosition            = new Position(28, 0);
                item.CheckImageSize          = new Size(40, 40);
                item.CheckImageResourceUrl   = CommonResource.GetFHResourcePath() + "10. Drop Down/dropdown_checkbox_on.png";
                item.CheckImageGapToBoundary = 16;
                dropDown.AddItem(item);
            }

            dropDown.SelectedItemIndex = 3;
            //dropDown.DeleteItem(1);

            //DropDown.DropDownItemData insertItem = new DropDown.DropDownItemData();
            //insertItem.Size2D = new Size2D(360, 96);
            //insertItem.BackgroundColorSelector = new Selector<Color>
            //{
            //    Pressed = new Color(0, 0, 0, 0.4f),
            //    Other = new Color(1, 1, 1, 0),
            //};
            //insertItem.Text = "Insert Normal list ";
            //insertItem.PointSize = 18;
            //insertItem.FontFamily = "SamsungOne 500";
            //insertItem.TextPosition2D = new Position2D(28, 0);
            //insertItem.CheckImageSize = new Size2D(40, 40);
            //insertItem.CheckImageResourceUrl = CommonReosurce.GetFHResourcePath() + "10. Drop Down/dropdown_checkbox_on.png";
            //insertItem.CheckImageRightSpace = 16;
            //dropDown.InsertItem(insertItem, 1);
            ////////Attach scrollbar///////////
            scrollBar            = new ScrollBar();
            scrollBar.Direction  = ScrollBar.DirectionType.Vertical;
            scrollBar.Position2D = new Position2D(394, 2);
            scrollBar.Size2D     = new Size2D(4, 446);
            scrollBar.Style.Track.BackgroundColor = Color.Green;
            scrollBar.Style.Thumb.Size            = new Size(4, 30);
            scrollBar.Style.Thumb.BackgroundColor = Color.Yellow;
            scrollBar.Style.Track.ResourceUrl     = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png";
            dropDown.AttachScrollBar(scrollBar);

            #endregion
            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            createText[1]            = new TextLabel();
            createText[1].Text       = "Create DropDown just by Attributes";
            createText[1].Size2D     = new Size2D(450, 100);
            createText[1].Position2D = new Position2D(1000, 100);
            createText[1].MultiLine  = true;
            root.Add(createText[1]);

            #region CreateByAttributes

            DropDownStyle attrs = new DropDownStyle
            {
                HeaderText = new TextLabelStyle
                {
                    Text = new Selector <string> {
                        All = "TitleArea"
                    },
                    PointSize = new Selector <float?> {
                        All = 28
                    },
                    TextColor = new Selector <Color> {
                        All = new Color(0, 0, 0, 1)
                    },
                    FontFamily = "SamsungOneUI 500C",
                },

                Button = new ButtonStyle
                {
                    Text = new TextLabelStyle
                    {
                        Text = new Selector <string> {
                            All = "DropDown Text"
                        },
                        PointSize = new Selector <float?> {
                            All = 20
                        },
                        TextColor = new Selector <Color> {
                            All = new Color(0, 0, 0, 1)
                        },
                        FontFamily = "SamsungOneUI 500",
                    },
                    Icon = new ImageViewStyle
                    {
                        Size        = new Size(48, 48),
                        ResourceUrl = new Selector <string> {
                            All = CommonResource.GetFHResourcePath() + "6. List/list_ic_dropdown.png"
                        },
                    },
                    IconRelativeOrientation = Button.IconOrientation.Right,
                    PositionX = 56,
                },
                ListBackgroundImage = new ImageViewStyle
                {
                    ResourceUrl = new Selector <string> {
                        All = CommonResource.GetFHResourcePath() + "10. Drop Down/dropdown_bg.png"
                    },
                    Border = new Selector <Rectangle> {
                        All = new Rectangle(51, 51, 51, 51)
                    },
                    Size = new Size(360, 500),
                },
                SpaceBetweenButtonTextAndIcon = 8,
                ListMargin      = new Extents(20, 0, 20, 0),
                BackgroundColor = new Selector <Color> {
                    All = new Color(1, 1, 1, 1)
                },
                ListPadding = new Extents(4, 4, 4, 4),
            };

            dropDown2            = new DropDown(attrs);
            dropDown2.Size2D     = new Size2D(900, 108);
            dropDown2.Position2D = new Position2D(1000, 300);
            root.Add(dropDown2);

            DropDownItemStyle itemAttrs = new DropDownItemStyle
            {
                BackgroundColor = new Selector <Color>
                {
                    Pressed = new Color(0, 0, 0, 0.4f),
                    Other   = new Color(1, 1, 1, 0),
                },
                Text = new TextLabelStyle
                {
                    PointSize = new Selector <float?> {
                        All = 18
                    },
                    FontFamily = "SamsungOne 500",
                    Position   = new Position(28, 0),
                },
                CheckImage = new ImageViewStyle
                {
                    Size        = new Size(40, 40),
                    ResourceUrl = new Selector <string> {
                        All = CommonResource.GetFHResourcePath() + "10. Drop Down/dropdown_checkbox_on.png"
                    },
                },
                CheckImageGapToBoundary = 16,
            };

            for (int i = 0; i < 8; i++)
            {
                DropDown.DropDownDataItem item = new DropDown.DropDownDataItem(itemAttrs);
                item.Size = new Size(360, 96);
                item.Text = "Normal list " + i;
                dropDown2.AddItem(item);
            }
            dropDown2.SelectedItemIndex = 0;

            ////////Attach scrollbar///////////
            scrollBar2            = new ScrollBar();
            scrollBar2.Direction  = ScrollBar.DirectionType.Vertical;
            scrollBar2.Position2D = new Position2D(394, 2);
            scrollBar2.Size2D     = new Size2D(4, 446);
            scrollBar2.Style.Track.BackgroundColor = Color.Green;
            scrollBar2.Style.Thumb.Size            = new Size(4, 30);
            scrollBar2.Style.Thumb.BackgroundColor = Color.Yellow;
            scrollBar2.Style.Track.ResourceUrl     = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png";
            dropDown2.AttachScrollBar(scrollBar2);

            #endregion
        }
Example #4
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            root = new View()
            {
                Size            = new Size(1920, 1080),
                BackgroundColor = new Color(0.7f, 0.9f, 0.8f, 1.0f),
                Padding         = new Extents(40, 40, 40, 40),
                Layout          = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Horizontal,
                    CellPadding       = new Size(40, 40),
                    LinearAlignment   = LinearLayout.Alignment.Center,
                }
            };
            window.Add(root);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            left = new View()
            {
                Size   = new Size(920, 800),
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                },
            };

            //Create description text.
            createText[0]           = new TextLabel();
            createText[0].Text      = "Create CheckBox just by properties";
            createText[0].TextColor = Color.White;
            createText[0].Size      = new Size(800, 100);
            left.Add(createText[0]);

            leftbody        = new View();
            leftbody.Layout = new GridLayout()
            {
                Columns = 4
            };
            int num = 4;

            for (int i = 0; i < num; i++)
            {
                group[i]         = new CheckBoxGroup();
                modeText[i]      = new TextLabel();
                modeText[i].Text = mode[i];
                modeText[i].Size = new Size(200, 48);
                modeText[i].HorizontalAlignment = HorizontalAlignment.Center;
                modeText[i].VerticalAlignment   = VerticalAlignment.Center;
                leftbody.Add(modeText[i]);
            }

            for (int i = 0; i < num; i++)
            {
                int index = i + 1;

                //Create utility radio button.
                utilityCheckBox[i] = new CheckBox();
                utilityCheckBox[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
                {
                    global::System.Console.WriteLine($"Left {index}th Utility CheckBox's IsSelected is changed to {args.IsSelected}.");
                };
                var utilityStyle = utilityCheckBox[i].Style;
                utilityStyle.Icon.Opacity = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                utilityStyle.Icon.BackgroundImage = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_on.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_on.png",
                };
                utilityStyle.Icon.ResourceUrl = new Selector <string>
                {
                    Normal           = "",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check.png",
                    Disabled         = "",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check.png",
                };
                utilityStyle.Icon.ImageShadow = new Selector <ImageShadow>
                {
                    Normal           = "",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_shadow.png",
                    Disabled         = "",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_shadow.png",
                };
                utilityCheckBox[i].ApplyStyle(utilityStyle);

                utilityCheckBox[i].Size      = new Size(48, 48);
                utilityCheckBox[i].Margin    = new Extents(76, 76, 25, 25);
                utilityCheckBox[i].Icon.Size = new Size(48, 48);

                group[0].Add(utilityCheckBox[i]);
                //Create family radio button.
                familyCheckBox[i] = new CheckBox();
                familyCheckBox[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
                {
                    global::System.Console.WriteLine($"Left {index}th Family CheckBox's IsSelected is changed to {args.IsSelected}.");
                };
                var familyStyle = familyCheckBox[i].Style;
                familyStyle.Icon.Opacity = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                familyStyle.Icon.BackgroundImage = "";
                familyStyle.Icon.ResourceUrl     = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_24c447.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_24c447.png",
                };
                familyCheckBox[i].ApplyStyle(familyStyle);

                familyCheckBox[i].Size      = new Size(48, 48);
                familyCheckBox[i].Margin    = new Extents(76, 76, 25, 25);
                familyCheckBox[i].Icon.Size = new Size(48, 48);
                group[1].Add(familyCheckBox[i]);
                //Create food radio button.
                foodCheckBox[i] = new CheckBox();
                foodCheckBox[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
                {
                    global::System.Console.WriteLine($"Left {index}th Food CheckBox's IsSelected is changed to {args.IsSelected}.");
                };
                var foodStyle = foodCheckBox[i].Style;
                foodStyle.Icon.Opacity = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                foodStyle.Icon.BackgroundImage = "";
                foodStyle.Icon.ResourceUrl     = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_ec7510.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_ec7510.png",
                };
                foodCheckBox[i].ApplyStyle(foodStyle);
                foodCheckBox[i].Size      = new Size(48, 48);
                familyCheckBox[i].Margin  = new Extents(76, 76, 25, 25);
                foodCheckBox[i].Icon.Size = new Size(48, 48);

                group[2].Add(foodCheckBox[i]);
                //Create kitchen radio button.
                kitchenCheckBox[i] = new CheckBox();
                kitchenCheckBox[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
                {
                    global::System.Console.WriteLine($"Left {index}th Kitchen CheckBox's IsSelected is changed to {args.IsSelected}.");
                };
                var kitchenStyle = kitchenCheckBox[i].Style;
                kitchenStyle.Icon.Opacity = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                kitchenStyle.Icon.BackgroundImage = "";
                kitchenStyle.Icon.ResourceUrl     = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_9762d9.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_9762d9.png",
                };
                kitchenCheckBox[i].ApplyStyle(kitchenStyle);
                kitchenCheckBox[i].WidthSpecification  = 48;
                kitchenCheckBox[i].HeightSpecification = 48;
                kitchenCheckBox[i].Margin    = new Extents(76, 76, 25, 25);
                kitchenCheckBox[i].Icon.Size = new Size(48, 48);

                group[3].Add(kitchenCheckBox[i]);

                leftbody.Add(utilityCheckBox[i]);
                leftbody.Add(familyCheckBox[i]);
                leftbody.Add(foodCheckBox[i]);
                leftbody.Add(kitchenCheckBox[i]);
            }
            /////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            right = new View()
            {
                Size   = new Size(920, 800),
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                }
            };

            rightbody        = new View();
            rightbody.Layout = new GridLayout()
            {
                Columns = 4
            };

            //Create description text.
            createText[1]           = new TextLabel();
            createText[1].Text      = "Create CheckBox just by styles";
            createText[1].TextColor = Color.White;
            createText[1].Size      = new Size(800, 100);
            right.Add(createText[1]);

            for (int i = 0; i < num; i++)
            {
                group2[i]         = new CheckBoxGroup();
                modeText2[i]      = new TextLabel();
                modeText2[i].Text = mode[i];
                modeText2[i].Size = new Size(200, 48);
                modeText2[i].HorizontalAlignment = HorizontalAlignment.Center;
                modeText2[i].VerticalAlignment   = VerticalAlignment.Center;
                rightbody.Add(modeText2[i]);
            }
            //Create utility style of radio button.
            ButtonStyle utilityStyle2 = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size    = new Size(48, 48),
                    Opacity = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    BackgroundImage = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_on.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_on.png",
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = "",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check.png",
                        Disabled         = "",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check.png",
                    },
                    ImageShadow = new Selector <ImageShadow>
                    {
                        Normal           = "",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_shadow.png",
                        Disabled         = "",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_shadow.png",
                    },
                }
            };
            //Create family style of radio button.
            ButtonStyle familyStyle2 = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size    = new Size(48, 48),
                    Opacity = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_24c447.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_24c447.png",
                    },
                }
            };
            //Create food style of radio button.
            ButtonStyle foodStyle2 = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size     = new Size(48, 48),
                    Position = new Position(0, 0),
                    Opacity  = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_ec7510.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_ec7510.png",
                    },
                },
            };
            //Create kitchen style of radio button.
            ButtonStyle kitchenStyle2 = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size     = new Size(48, 48),
                    Position = new Position(0, 0),
                    Opacity  = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_9762d9.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_9762d9.png",
                    },
                },
            };

            for (int i = 0; i < num; i++)
            {
                int index = i + 1;

                utilityCheckBox2[i] = new CheckBox(utilityStyle2);
                utilityCheckBox2[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
                {
                    global::System.Console.WriteLine($"Right {index}th Utility CheckBox's IsSelected is changed to {args.IsSelected}.");
                };
                utilityCheckBox2[i].Size   = new Size(48, 48);
                utilityCheckBox2[i].Margin = new Extents(76, 76, 25, 25);
                group2[0].Add(utilityCheckBox2[i]);

                familyCheckBox2[i] = new CheckBox(familyStyle2);
                familyCheckBox2[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
                {
                    global::System.Console.WriteLine($"Right {index}th Family CheckBox's IsSelected is changed to {args.IsSelected}.");
                };
                familyCheckBox2[i].Size   = new Size(48, 48);
                familyCheckBox2[i].Margin = new Extents(76, 76, 25, 25);
                group2[1].Add(familyCheckBox2[i]);

                foodCheckBox2[i] = new CheckBox(foodStyle2);
                foodCheckBox2[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
                {
                    global::System.Console.WriteLine($"Right {index}th Food CheckBox's IsSelected is changed to {args.IsSelected}.");
                };
                foodCheckBox2[i].Size   = new Size(48, 48);
                foodCheckBox2[i].Margin = new Extents(76, 76, 25, 25);
                group2[2].Add(foodCheckBox2[i]);

                kitchenCheckBox2[i] = new CheckBox(kitchenStyle2);
                kitchenCheckBox2[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
                {
                    global::System.Console.WriteLine($"Right {index}th Kitchen CheckBox's IsSelected is changed to {args.IsSelected}.");
                };
                kitchenCheckBox2[i].Size   = new Size(48, 48);
                kitchenCheckBox2[i].Margin = new Extents(76, 76, 25, 25);
                group2[3].Add(kitchenCheckBox2[i]);

                rightbody.Add(utilityCheckBox2[i]);
                rightbody.Add(familyCheckBox2[i]);
                rightbody.Add(foodCheckBox2[i]);
                rightbody.Add(kitchenCheckBox2[i]);
            }

            root.Add(left);
            root.Add(right);
            left.Add(leftbody);
            right.Add(rightbody);

            utilityCheckBox[2].IsEnabled = false;
            familyCheckBox[2].IsEnabled  = false;
            foodCheckBox[2].IsEnabled    = false;
            kitchenCheckBox[2].IsEnabled = false;

            utilityCheckBox2[2].IsEnabled = false;
            familyCheckBox2[2].IsEnabled  = false;
            foodCheckBox2[2].IsEnabled    = false;
            kitchenCheckBox2[2].IsEnabled = false;

            utilityCheckBox[3].IsEnabled  = false;
            familyCheckBox[3].IsEnabled   = false;
            foodCheckBox[3].IsEnabled     = false;
            kitchenCheckBox[3].IsEnabled  = false;
            utilityCheckBox[3].IsSelected = true;
            familyCheckBox[3].IsSelected  = true;
            foodCheckBox[3].IsSelected    = true;
            kitchenCheckBox[3].IsSelected = true;

            utilityCheckBox2[3].IsEnabled  = false;
            familyCheckBox2[3].IsEnabled   = false;
            foodCheckBox2[3].IsEnabled     = false;
            kitchenCheckBox2[3].IsEnabled  = false;
            utilityCheckBox2[3].IsSelected = true;
            familyCheckBox2[3].IsSelected  = true;
            foodCheckBox2[3].IsSelected    = true;
            kitchenCheckBox2[3].IsSelected = true;
        }
Example #5
0
        public void Activate()
        {
            Window window = Window.Instance;

            root = new View()
            {
                Size2D = new Size2D(1920, 1080),
            };
            window.Add(root);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            createText[0]            = new TextLabel();
            createText[0].Text       = "Create Switch just by properties";
            createText[0].Size2D     = new Size2D(500, 100);
            createText[0].Position2D = new Position2D(400, 100);
            root.Add(createText[0]);

            int num = 4;

            for (int i = 0; i < num; i++)
            {
                modeText[i]            = new TextLabel();
                modeText[i].Text       = mode[i];
                modeText[i].Size2D     = new Size2D(200, 48);
                modeText[i].Position2D = new Position2D(300 + 200 * i, 200);
                root.Add(modeText[i]);
            }

            for (int i = 0; i < num; i++)
            {
                utilitySwitch[i]                         = new Switch();
                utilitySwitch[i].Size2D                  = new Size2D(96, 60);
                utilitySwitch[i].Position2D              = new Position2D(300, 300 + i * 100);
                utilitySwitch[i].Style.Thumb.Size        = new Size(60, 60);
                utilitySwitch[i].Style.Track.ResourceUrl = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_on.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off_dim.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_on_dim.png",
                };
                utilitySwitch[i].Style.Thumb.ResourceUrl = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                };

                ////////
                familySwitch[i]                         = new Switch();
                familySwitch[i].Size2D                  = new Size2D(96, 60);
                familySwitch[i].Position2D              = new Position2D(500, 300 + i * 100);
                familySwitch[i].Style.Thumb.Size        = new Size(60, 60);
                familySwitch[i].Style.Track.ResourceUrl = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_24c447.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_dim_24c447.png",
                };
                familySwitch[i].Style.Thumb.ResourceUrl = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                };
                /////////
                foodSwitch[i]                         = new Switch();
                foodSwitch[i].Size2D                  = new Size2D(96, 60);
                foodSwitch[i].Position2D              = new Position2D(700, 300 + i * 100);
                foodSwitch[i].Style.Thumb.Size        = new Size(60, 60);
                foodSwitch[i].Style.Track.ResourceUrl = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_ec7510.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_dim_ec7510.png",
                };
                foodSwitch[i].Style.Thumb.ResourceUrl = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                };

                ////////
                kitchenSwitch[i]                         = new Switch();
                kitchenSwitch[i].Size2D                  = new Size2D(96, 60);
                kitchenSwitch[i].Position2D              = new Position2D(900, 300 + i * 100);
                kitchenSwitch[i].Style.Thumb.Size        = new Size(60, 60);
                kitchenSwitch[i].Style.Track.ResourceUrl = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_9762d9.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_dim_9762d9.png",
                };
                kitchenSwitch[i].Style.Thumb.ResourceUrl = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                };

                root.Add(utilitySwitch[i]);
                root.Add(familySwitch[i]);
                root.Add(foodSwitch[i]);
                root.Add(kitchenSwitch[i]);
            }

            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            createText[1]            = new TextLabel();
            createText[1].Text       = "Create Switch just by Attributes";
            createText[1].Size2D     = new Size2D(500, 100);
            createText[1].Position2D = new Position2D(1200, 100);
            root.Add(createText[1]);

            for (int i = 0; i < num; i++)
            {
                modeText2[i]            = new TextLabel();
                modeText2[i].Text       = mode[i];
                modeText2[i].Size2D     = new Size2D(200, 48);
                modeText2[i].Position2D = new Position2D(1100 + 200 * i, 200);
                root.Add(modeText2[i]);
            }

            SwitchStyle utilityAttrs = new SwitchStyle
            {
                IsSelectable = true,
                Track        = new ImageViewStyle
                {
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_on.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_on_dim.png",
                    },
                },
                Thumb = new ImageViewStyle
                {
                    Size        = new Size(60, 60),
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                    },
                },
            };
            SwitchStyle familyAttrs = new SwitchStyle
            {
                IsSelectable = true,
                Track        = new ImageViewStyle
                {
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_24c447.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_dim_24c447.png",
                    },
                },
                Thumb = new ImageViewStyle
                {
                    Size        = new Size(60, 60),
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                    },
                },
            };
            SwitchStyle foodAttrs = new SwitchStyle
            {
                IsSelectable = true,
                Track        = new ImageViewStyle
                {
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_ec7510.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_dim_ec7510.png",
                    },
                },
                Thumb = new ImageViewStyle
                {
                    Size        = new Size(60, 60),
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                    },
                },
            };
            SwitchStyle kitchenAttrs = new SwitchStyle
            {
                IsSelectable = true,
                Track        = new ImageViewStyle
                {
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_9762d9.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_dim_9762d9.png",
                    },
                },
                Thumb = new ImageViewStyle
                {
                    Size        = new Size(60, 60),
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                    },
                },
            };

            for (int i = 0; i < num; i++)
            {
                utilitySwitch2[i]            = new Switch(utilityAttrs);
                utilitySwitch2[i].Size2D     = new Size2D(96, 60);
                utilitySwitch2[i].Position2D = new Position2D(1100, 300 + i * 100);

                familySwitch2[i]            = new Switch(familyAttrs);
                familySwitch2[i].Size2D     = new Size2D(96, 60);
                familySwitch2[i].Position2D = new Position2D(1300, 300 + i * 100);

                foodSwitch2[i]            = new Switch(foodAttrs);
                foodSwitch2[i].Size2D     = new Size2D(96, 60);
                foodSwitch2[i].Position2D = new Position2D(1500, 300 + i * 100);

                kitchenSwitch2[i]            = new Switch(kitchenAttrs);
                kitchenSwitch2[i].Size2D     = new Size2D(96, 60);
                kitchenSwitch2[i].Position2D = new Position2D(1700, 300 + i * 100);

                root.Add(utilitySwitch2[i]);
                root.Add(familySwitch2[i]);
                root.Add(foodSwitch2[i]);
                root.Add(kitchenSwitch2[i]);
            }

            utilitySwitch[2].IsEnabled = false;
            familySwitch[2].IsEnabled  = false;
            foodSwitch[2].IsEnabled    = false;
            kitchenSwitch[2].IsEnabled = false;

            utilitySwitch2[2].IsEnabled = false;
            familySwitch2[2].IsEnabled  = false;
            foodSwitch2[2].IsEnabled    = false;
            kitchenSwitch2[2].IsEnabled = false;

            utilitySwitch[3].IsEnabled  = false;
            familySwitch[3].IsEnabled   = false;
            foodSwitch[3].IsEnabled     = false;
            kitchenSwitch[3].IsEnabled  = false;
            utilitySwitch[3].IsSelected = true;
            familySwitch[3].IsSelected  = true;
            foodSwitch[3].IsSelected    = true;
            kitchenSwitch[3].IsSelected = true;

            utilitySwitch2[3].IsEnabled  = false;
            familySwitch2[3].IsEnabled   = false;
            foodSwitch2[3].IsEnabled     = false;
            kitchenSwitch2[3].IsEnabled  = false;
            utilitySwitch2[3].IsSelected = true;
            familySwitch2[3].IsSelected  = true;
            foodSwitch2[3].IsSelected    = true;
            kitchenSwitch2[3].IsSelected = true;
        }
Example #6
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            // Root layout.
            layout[0] = new View()
            {
                Size            = new Size(1920, 1080),
                BackgroundColor = new Color(0.7f, 0.9f, 0.8f, 1.0f),
            };
            layout[0].Layout = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Vertical,
                LinearAlignment   = LinearLayout.Alignment.Center,
                CellPadding       = new Size(20, 50)
            };
            window.Add(layout[0]);
            window.KeyEvent += Window_KeyEvent;

            // A pagination sample created by properties will be added to this layout.
            layout[1] = new View()
            {
                Size   = new Size(700, 70),
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Horizontal,
                    LinearAlignment   = LinearLayout.Alignment.Center,
                    CellPadding       = new Size(20, 50)
                }
            };
            layout[0].Add(layout[1]);

            // A pagination sample created by attributes will be added to this layout.
            layout[2] = new View()
            {
                Size   = new Size(700, 70),
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Horizontal,
                    LinearAlignment   = LinearLayout.Alignment.Center,
                    CellPadding       = new Size(20, 50)
                }
            };
            layout[0].Add(layout[2]);

            createBorads();

            ///////////////////////////////////////////////Create by Properties//////////////////////////////////////////////////////////
            pagination[0] = new Pagination();
            var indicatorImageUrlStyle = new PaginationStyle()
            {
                IndicatorSize     = new Size(26, 26),
                IndicatorSpacing  = 8,
                IndicatorImageUrl = new Selector <string>
                {
                    Normal   = CommonResource.GetFHResourcePath() + "9. Controller/pagination_ic_nor.png",
                    Selected = CommonResource.GetFHResourcePath() + "9. Controller/pagination_ic_sel.png"
                }
            };

            pagination[0].ApplyStyle(indicatorImageUrlStyle);
            pagination[0].Name            = "Pagination1";
            pagination[0].Size            = new Size(300, 50);
            pagination[0].BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f);
            pagination[0].IndicatorCount  = PAGE_COUNT;
            pagination[0].SelectedIndex   = 0;
            layout[1].Add(pagination[0]);

            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            PaginationStyle style = new PaginationStyle()
            {
                IndicatorSize     = new Size(15, 15),
                IndicatorSpacing  = 20,
                IndicatorImageUrl = new Selector <string>
                {
                    Normal   = CommonResource.GetFHResourcePath() + "9. Controller/pagination_ic_nor.png",
                    Selected = CommonResource.GetFHResourcePath() + "9. Controller/pagination_ic_sel.png"
                }
            };

            pagination[1]                 = new Pagination(style);
            pagination[1].Name            = "Pagination2";
            pagination[1].Size            = new Size(300, 50);
            pagination[1].BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f);
            pagination[1].IndicatorCount  = PAGE_COUNT;
            pagination[1].SelectedIndex   = 0;
            layout[2].Add(pagination[1]);
        }
Example #7
0
        public View NewItemView(uint itemId)
        {
            // Create an image view for this item
            string imagePath = CommonResource.GetDaliResourcePath() + "ItemViewDemo/gallery/gallery-medium-";
            uint   id        = itemId % 53;

            imagePath += id.ToString();
            imagePath += ".jpg";
            PropertyMap propertyMap = new PropertyMap();

            propertyMap.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
            propertyMap.Insert(ImageVisualProperty.URL, new PropertyValue(imagePath));
            propertyMap.Insert(ImageVisualProperty.FittingMode, new PropertyValue((int)VisualFittingModeType.FitKeepAspectRatio));
            ImageView actor = new ImageView();

            actor.Image = propertyMap;

            // Add a border image child actor
            ImageView borderActor = new ImageView();

            borderActor.ParentOrigin           = ParentOrigin.Center;
            borderActor.PivotPoint             = PivotPoint.Center;
            borderActor.PositionUsesPivotPoint = true;
            borderActor.HeightResizePolicy     = ResizePolicyType.SizeFixedOffsetFromParent;
            borderActor.WidthResizePolicy      = ResizePolicyType.SizeFixedOffsetFromParent;
            borderActor.SetSizeModeFactor(new Vector3(2.0f * ITEM_BORDER_SIZE, 2.0f * ITEM_BORDER_SIZE, 0.0f));
            borderActor.SetColorMode(ColorMode.UseParentColor);

            PropertyMap borderProperty = new PropertyMap();

            borderProperty.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
            borderProperty.Insert(BorderVisualProperty.Color, new PropertyValue(Color.White));
            borderProperty.Insert(BorderVisualProperty.Size, new PropertyValue(ITEM_BORDER_SIZE));
            borderProperty.Insert(BorderVisualProperty.AntiAliasing, new PropertyValue(true));
            borderActor.Image = borderProperty;

            actor.Add(borderActor);

            Size spiralItemSize = new Size(30, 30, 0);
            // Add a checkbox child actor; invisible until edit-mode is enabled
            ImageView checkBox = new ImageView();

            checkBox.Name = "CheckBox";
            checkBox.SetColorMode(ColorMode.UseParentColor);
            checkBox.ParentOrigin = ParentOrigin.TopRight;
            checkBox.PivotPoint   = PivotPoint.TopRight;
            checkBox.Size         = spiralItemSize;
            checkBox.PositionZ    = 0.1f;

            PropertyMap solidColorProperty = new PropertyMap();

            solidColorProperty.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
            solidColorProperty.Insert(ColorVisualProperty.MixColor, new PropertyValue(new Color(0.0f, 0.0f, 0.0f, 0.6f)));
            checkBox.Image = solidColorProperty;

            if (Mode.MODE_REMOVE_MANY != mMode &&
                Mode.MODE_INSERT_MANY != mMode &&
                Mode.MODE_REPLACE_MANY != mMode)
            {
                checkBox.Hide();
            }
            borderActor.Add(checkBox);

            ImageView tick = new ImageView(SELECTED_IMAGE);

            tick.Name         = "Tick";
            tick.ParentOrigin = ParentOrigin.TopRight;
            tick.PivotPoint   = PivotPoint.TopRight;
            tick.Size         = spiralItemSize;
            tick.Hide();
            checkBox.Add(tick);

            if (mTapDetector)
            {
                mTapDetector.Attach(actor);
            }
            return(actor);
        }
Example #8
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            root = new View()
            {
                Size            = new Size(1920, 1080),
                BackgroundColor = new Color(0.7f, 0.9f, 0.8f, 1.0f),
                Layout          = new LinearLayout()
                {
                    LinearAlignment   = LinearLayout.Alignment.Center,
                    LinearOrientation = LinearLayout.Orientation.Horizontal,
                    CellPadding       = new Size(50, 50),
                }
            };
            window.Add(root);
            window.KeyEvent += Window_KeyEvent;

            parent1 = new View()
            {
                Size   = new Size(300, 900),
                Layout = new LinearLayout()
                {
                    LinearAlignment   = LinearLayout.Alignment.Top,
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                    CellPadding       = new Size(50, 50),
                }
            };

            parent2 = new View()
            {
                Size   = new Size(300, 900),
                Layout = new LinearLayout()
                {
                    LinearAlignment   = LinearLayout.Alignment.Top,
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                    CellPadding       = new Size(50, 50),
                }
            };

            // Only show a text button.
            textButton = new Button();
            textButton.BackgroundImage       = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            textButton.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
            textButton.Size           = new Size(300, 80);
            textButton.TextLabel.Text = "Button";
            parent1.Add(textButton);

            //Only show an icon button.
            iconButton                       = new Button();
            iconButton.Text                  = "";
            iconButton.Name                  = "IconButton";
            iconButton.BackgroundImage       = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            iconButton.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
            iconButton.Size                  = new Size(80, 80);
            iconButton.Icon.ResourceUrl      = CommonResource.GetTVResourcePath() + "component/c_radiobutton/c_radiobutton_white_check.png";
            parent2.Add(iconButton);
            iconButton.Clicked += (ojb, e) => {
                var    btn  = iconButton.Icon.GetParent() as Button;
                string name = btn.Name;
            };

            parent3 = new View()
            {
                Size   = new Size(600, 400),
                Layout = new LinearLayout()
                {
                    LinearAlignment   = LinearLayout.Alignment.Top,
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                    CellPadding       = new Size(50, 50),
                }
            };

            //Show a button with icon and text.
            iconTextButton                         = new Button();
            iconTextButton.Text                    = "IconTextButton";
            iconTextButton.BackgroundImage         = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            iconTextButton.BackgroundImageBorder   = new Rectangle(4, 4, 5, 5);
            iconTextButton.IconRelativeOrientation = Button.IconOrientation.Left;
            iconTextButton.Icon.ResourceUrl        = CommonResource.GetTVResourcePath() + "component/c_radiobutton/c_radiobutton_white_check.png";
            iconTextButton.IconPadding             = new Extents(20, 20, 20, 20);
            iconTextButton.TextPadding             = new Extents(20, 50, 20, 20);
            iconTextButton.Size                    = new Size(500, 300);
            parent3.Add(iconTextButton);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            //Create utility basic style of button.
            var utilityBasicButtonStyle = new ButtonStyle()
            {
                Overlay = new ImageViewStyle()
                {
                    ResourceUrl = new Selector <string>
                    {
                        Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png",
                        Other   = ""
                    },
                    Border = new Rectangle(5, 5, 5, 5)
                },
                Text = new TextLabelStyle()
                {
                    TextColor = new Selector <Color>
                    {
                        Normal   = new Color(0, 0, 0, 1),
                        Pressed  = new Color(0, 0, 0, 0.7f),
                        Selected = new Color(0.058f, 0.631f, 0.92f, 1),
                        Disabled = new Color(0, 0, 0, 0.4f)
                    },
                    Text      = "UtilityBasicButton",
                    PointSize = 20,
                },
                BackgroundImage       = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png",
                BackgroundImageBorder = new Rectangle(5, 5, 5, 5),
            };

            utilityBasicButton = new Button();
            utilityBasicButton.ApplyStyle(utilityBasicButtonStyle);
            utilityBasicButton.IsSelectable = true;
            utilityBasicButton.ImageShadow  = new ImageShadow(CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png", new Rectangle(5, 5, 5, 5));
            utilityBasicButton.Size         = new Size(300, 80);
            utilityBasicButton.IsEnabled    = false;
            parent1.Add(utilityBasicButton);

            //Create utility service style of button.
            var utilityServiceButtonStyle = new ButtonStyle()
            {
                Overlay = new ImageViewStyle()
                {
                    ResourceUrl = new Selector <string>
                    {
                        Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png",
                        Other   = ""
                    },
                    Border = new Rectangle(5, 5, 5, 5)
                },
                Text = new TextLabelStyle()
                {
                    TextColor = new Selector <Color>
                    {
                        Normal   = new Color(1, 1, 1, 1),
                        Pressed  = new Color(1, 1, 1, 0.7f),
                        Disabled = new Color(1, 1, 1, 0.4f)
                    },
                    Text      = "ServiceBasicButton",
                    PointSize = 20,
                },
                BackgroundImage       = CommonResource.GetFHResourcePath() + "3. Button/rectangle_point_btn_normal.png",
                BackgroundImageBorder = new Rectangle(5, 5, 5, 5)
            };

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

            utilityServiceButton.Size = new Size(300, 80);
            parent1.Add(utilityServiceButton);

            //Create utility toggle style of button.
            var utilityToggleButtonStyle = new ButtonStyle()
            {
                BackgroundImage = new Selector <string>
                {
                    Normal   = CommonResource.GetFHResourcePath() + "3. Button/rectangle_toggle_btn_normal.png",
                    Selected = CommonResource.GetFHResourcePath() + "3. Button/rectangle_point_btn_normal.png",
                },
                Overlay = new ImageViewStyle()
                {
                    ResourceUrl = new Selector <string>
                    {
                        Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png",
                        Other   = ""
                    }
                },
                Text = new TextLabelStyle()
                {
                    TextColor = new Selector <Color>
                    {
                        Normal   = new Color(0.058f, 0.631f, 0.92f, 1),
                        Selected = new Color(1, 1, 1, 1),
                    },
                    Text = new Selector <string>
                    {
                        Normal   = "Toggle Off",
                        Selected = "Toggle On"
                    },
                    PointSize = 20
                },
                BackgroundColor = new Selector <Color>()
            };

            utilityToggleButton = new Button();
            utilityToggleButton.ApplyStyle(utilityToggleButtonStyle);
            utilityToggleButton.IsSelectable          = true;
            utilityToggleButton.BackgroundImageBorder = new Rectangle(5, 5, 5, 5);
            utilityToggleButton.ImageShadow           = new ImageShadow(CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png", new Rectangle(5, 5, 5, 5));
            utilityToggleButton.OverlayImage.Border   = new Rectangle(5, 5, 5, 5);

            utilityToggleButton.Size = new Size(300, 80);
            parent1.Add(utilityToggleButton);

            //Create utility oval style of button.
            var utilityOvalButtonStyle = new ButtonStyle()
            {
                BackgroundImage = new Selector <string>
                {
                    Normal   = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_normal.png",
                    Selected = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_select.png",
                },
                Overlay = new ImageViewStyle()
                {
                    ResourceUrl = new Selector <string>
                    {
                        Pressed = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_press_overlay.png",
                        Other   = ""
                    }
                },
                Text = new TextLabelStyle()
                {
                    Text = "",
                },
                BackgroundColor = new Selector <Color>(),
            };

            utilityOvalButton = new Button();
            utilityOvalButton.ApplyStyle(utilityOvalButtonStyle);
            utilityOvalButton.IsSelectable          = true;
            utilityOvalButton.BackgroundImageBorder = new Rectangle(5, 5, 5, 5);
            utilityOvalButton.ImageShadow           = new ImageShadow(CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_shadow.png", new Rectangle(5, 5, 5, 5));
            utilityOvalButton.OverlayImage.Border   = new Rectangle(5, 5, 5, 5);

            utilityOvalButton.Size = new Size(104, 104);
            utilityOvalButton.TextLabel.PointSize = 20;
            parent1.Add(utilityOvalButton);

            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            //Create family basic style of Button.
            ButtonStyle familyBasicButtonStyle = new ButtonStyle
            {
                IsSelectable    = true,
                BackgroundImage = new Selector <string> {
                    All = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.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, 0, 0, 1),
                        Pressed  = new Color(0, 0, 0, 0.7f),
                        Selected = new Color(0.141f, 0.769f, 0.278f, 1),
                        Disabled = new Color(0, 0, 0, 0.4f),
                    },
                    Text = "FamilyBasicButton",
                }
            };

            familyBasicButton      = new Button(familyBasicButtonStyle);
            familyBasicButton.Size = new Size(300, 80);
            parent2.Add(familyBasicButton);

            //Create family service style of button.
            ButtonStyle familyServiceButtonStyle = new ButtonStyle
            {
                IsSelectable    = false,
                BackgroundImage = new Selector <string> {
                    All = 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(1, 1, 1, 1),
                        Pressed  = new Color(1, 1, 1, 0.7f),
                        Disabled = new Color(1, 1, 1, 0.4f),
                    },
                    Text = "FamilySeviceButton"
                }
            };

            familyServiceButton      = new Button(familyServiceButtonStyle);
            familyServiceButton.Size = new Size(300, 80);
            parent2.Add(familyServiceButton);

            //Create family toggle style of button.
            ButtonStyle familyToggleButtonStyle = 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),
                    },
                    Text = new Selector <string>
                    {
                        Normal   = "Toggle Off",
                        Selected = "Toggle On"
                    }
                }
            };

            familyToggleButton      = new Button(familyToggleButtonStyle);
            familyToggleButton.Size = new Size(300, 80);
            parent2.Add(familyToggleButton);

            //Create family oval style of button.
            ButtonStyle familyOvalButtonStyle = new ButtonStyle
            {
                IsSelectable    = true,
                BackgroundImage = new Selector <string>
                {
                    Normal   = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_normal.png",
                    Selected = CommonResource.GetFHResourcePath() + "3. Button/[Button] App Primary Color/oval_toggle_btn_select_24c447.png",
                },
                BackgroundImageBorder = new Selector <Rectangle> {
                    All = new Rectangle(5, 5, 5, 5)
                },

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

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

            familyOvalButton      = new Button(familyOvalButtonStyle);
            familyOvalButton.Size = new Size(104, 104);
            parent2.Add(familyOvalButton);

            // Add three layout into root
            root.Add(parent1);
            root.Add(parent2);
            root.Add(parent3);
        }
Example #9
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            root = new View()
            {
                Size            = new Size(1920, 1080),
                BackgroundColor = new Color(0.7f, 0.9f, 0.8f, 1.0f),
            };
            window.Add(root);

            parent = new View()
            {
                Position = new Position(300, 300),
                Size     = new Size(1150, 450)
            };
            parent.Layout = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Horizontal,
                LinearAlignment   = LinearLayout.Alignment.Bottom,
                CellPadding       = new Size(50, 50)
            };
            root.Add(parent);

            // Create vertical flexibleView
            flexibleView1      = new FlexibleView();
            flexibleView1.Name = "RecyclerView1";
            flexibleView1.WidthSpecification  = 400;
            flexibleView1.HeightSpecification = 450;
            flexibleView1.Padding             = new Extents(10, 10, 10, 10);
            flexibleView1.BackgroundColor     = new Color(0.0f, 0.0f, 0.0f, 0.4f);

            List <ListItemData> dataList = new List <ListItemData>();

            for (int i = 0; i < 131; ++i)
            {
                dataList.Add(new ListItemData(i));
            }
            adapter = new ListBridge(dataList);
            flexibleView1.SetAdapter(adapter);

            LinearLayoutManager layoutManager1 = new LinearLayoutManager(LinearLayoutManager.VERTICAL);

            flexibleView1.SetLayoutManager(layoutManager1);

            flexibleView1.FocusedItemIndex = 0;

            parent.Add(flexibleView1);

            flexibleView1.Focusable = true;

            flexibleView1.KeyEvent    += RecyclerView_KeyEvent;
            flexibleView1.FocusGained += FlexibleView_FocusGained;
            flexibleView1.FocusLost   += FlexibleView_FocusLost;

            scrollBar1                     = new ScrollBar();
            scrollBar1.Direction           = ScrollBar.DirectionType.Vertical;
            scrollBar1.Position            = new Position(394, 2);
            scrollBar1.WidthSpecification  = 4;
            scrollBar1.HeightSpecification = 446;
            scrollBar1.TrackColor          = Color.Green;
            scrollBar1.ThumbSize           = new Size(4, 30);
            scrollBar1.ThumbColor          = Color.Yellow;
            scrollBar1.TrackImageURL       = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png";
            flexibleView1.AttachScrollBar(scrollBar1);

            // Create horizontal flexibleView
            flexibleView2      = new FlexibleView();
            flexibleView2.Name = "RecyclerView2";
            flexibleView2.WidthSpecification  = 700;
            flexibleView2.HeightSpecification = 200;
            flexibleView2.Padding             = new Extents(10, 10, 10, 10);
            flexibleView2.BackgroundColor     = new Color(0.0f, 0.0f, 0.0f, 0.4f);

            flexibleView2.SetAdapter(adapter);

            GridLayoutManager layoutManager2 = new GridLayoutManager(3, LinearLayoutManager.HORIZONTAL);

            flexibleView2.SetLayoutManager(layoutManager2);

            flexibleView2.FocusedItemIndex = 0;

            parent.Add(flexibleView2);

            flexibleView2.Focusable = true;

            flexibleView2.KeyEvent    += RecyclerView_KeyEvent;
            flexibleView2.FocusGained += FlexibleView_FocusGained;
            flexibleView2.FocusLost   += FlexibleView_FocusLost;

            scrollBar2                     = new ScrollBar();
            scrollBar2.Direction           = ScrollBar.DirectionType.Horizontal;
            scrollBar2.Position            = new Position(2, 194);
            scrollBar2.WidthSpecification  = 696;
            scrollBar2.HeightSpecification = 4;
            scrollBar2.TrackColor          = Color.Green;
            scrollBar2.ThumbSize           = new Size(30, 4);
            scrollBar2.ThumbColor          = Color.Yellow;
            scrollBar2.TrackImageURL       = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png";
            flexibleView2.AttachScrollBar(scrollBar2);

            FocusManager.Instance.SetCurrentFocusView(flexibleView1);
            FocusManager.Instance.PreFocusChange += onPreFocusChange;
        }
Example #10
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            // Create root view.
            root = new View()
            {
                Size            = new Size(1920, 1080),
                BackgroundColor = new Color(0.7f, 0.9f, 0.8f, 1.0f),
                Padding         = new Extents(40, 40, 40, 40),
                Layout          = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Horizontal,
                    CellPadding       = new Size(40, 40),
                    LinearAlignment   = LinearLayout.Alignment.Center,
                }
            };
            window.Add(root);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            left = new View()
            {
                Size   = new Size(920, 800),
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical
                }
            };

            //Create left description text.
            createText[0]           = new TextLabel();
            createText[0].Text      = "Create RadioButton just by properties";
            createText[0].TextColor = Color.White;
            createText[0].Size      = new Size(800, 100);
            left.Add(createText[0]);

            leftbody        = new View();
            leftbody.Layout = new GridLayout()
            {
                Columns = 4
            };
            int num = 4;

            for (int i = 0; i < num; i++)
            {
                group[i]         = new RadioButtonGroup();
                modeText[i]      = new TextLabel();
                modeText[i].Text = mode[i];
                modeText[i].Size = new Size(200, 48);
                modeText[i].HorizontalAlignment = HorizontalAlignment.Center;
                modeText[i].VerticalAlignment   = VerticalAlignment.Center;
                leftbody.Add(modeText[i]);
            }

            for (int i = 0; i < num; i++)
            {
                // create utility radio button.
                utilityRadioButton[i] = new RadioButton();
                var utilityStyle = utilityRadioButton[i].Style;
                utilityStyle.Icon.Opacity = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                utilityStyle.Icon.BackgroundImage = "";
                utilityStyle.Icon.ResourceUrl     = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png",
                };
                utilityRadioButton[i].ApplyStyle(utilityStyle);
                utilityRadioButton[i].Size      = new Size(48, 48);
                utilityRadioButton[i].Icon.Size = new Size(48, 48);
                group[0].Add(utilityRadioButton[i]);

                // create family radio button.
                familyRadioButton[i] = new RadioButton();
                var familyStyle = familyRadioButton[i].Style;
                familyStyle.Icon.Opacity = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                familyStyle.Icon.BackgroundImage = "";
                familyStyle.Icon.ResourceUrl     = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
                };
                familyRadioButton[i].ApplyStyle(familyStyle);
                familyRadioButton[i].Size      = new Size(48, 48);
                familyRadioButton[i].Icon.Size = new Size(48, 48);

                group[1].Add(familyRadioButton[i]);

                // create food radio button.
                foodRadioButton[i] = new RadioButton();
                var foodStyle = foodRadioButton[i].Style;
                foodStyle.Icon.Opacity = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                foodStyle.Icon.BackgroundImage = "";
                foodStyle.Icon.ResourceUrl     = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
                };
                foodRadioButton[i].ApplyStyle(foodStyle);
                foodRadioButton[i].Size      = new Size(150, 48);
                foodRadioButton[i].Icon.Size = new Size(48, 48);

                group[2].Add(foodRadioButton[i]);

                // create kitchen radio button.
                kitchenRadioButton[i] = new RadioButton();
                var kitchenStyle = kitchenRadioButton[i].Style;
                kitchenStyle.Icon.Opacity = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                kitchenStyle.Icon.BackgroundImage = "";
                kitchenStyle.Icon.ResourceUrl     = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
                };
                kitchenRadioButton[i].ApplyStyle(kitchenStyle);
                kitchenRadioButton[i].Size      = new Size(48, 48);
                kitchenRadioButton[i].Icon.Size = new Size(48, 48);

                group[3].Add(kitchenRadioButton[i]);

                leftbody.Add(utilityRadioButton[i]);
                leftbody.Add(familyRadioButton[i]);
                leftbody.Add(foodRadioButton[i]);
                leftbody.Add(kitchenRadioButton[i]);
            }

            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            right = new View()
            {
                Size   = new Size(920, 800),
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                }
            };

            rightbody        = new View();
            rightbody.Layout = new GridLayout()
            {
                Columns = 4
            };
            createText[1]           = new TextLabel();
            createText[1].Text      = "Create RadioButton just by styles";
            createText[1].TextColor = Color.White;
            createText[1].Size      = new Size(800, 100);
            right.Add(createText[1]);

            for (int i = 0; i < num; i++)
            {
                group2[i]         = new RadioButtonGroup();
                modeText2[i]      = new TextLabel();
                modeText2[i].Text = mode[i];
                modeText2[i].Size = new Size(200, 48);
                modeText2[i].HorizontalAlignment = HorizontalAlignment.Center;
                modeText2[i].VerticalAlignment   = VerticalAlignment.Center;
                rightbody.Add(modeText2[i]);
            }

            //Create utility style of radio button.
            ButtonStyle utilityStyle2 = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size    = new Size(48, 48),
                    Opacity = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png",
                    },
                },
            };
            //Create family style of radio button.
            ButtonStyle familyStyle2 = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size    = new Size(48, 48),
                    Opacity = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
                    },
                },
            };
            //Create food style of radio button.
            ButtonStyle foodStyle2 = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size    = new Size(48, 48),
                    Opacity = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
                    },
                },
            };
            //Create kitchen style of radio button.
            ButtonStyle kitchenStyle2 = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size    = new Size(48, 48),
                    Opacity = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
                    },
                },
            };

            for (int i = 0; i < num; i++)
            {
                utilityRadioButton2[i]      = new RadioButton(utilityStyle2);
                utilityRadioButton2[i].Size = new Size(48, 48);
                group2[0].Add(utilityRadioButton2[i]);

                familyRadioButton2[i]      = new RadioButton(familyStyle2);
                familyRadioButton2[i].Size = new Size(48, 48);
                group2[1].Add(familyRadioButton2[i]);

                foodRadioButton2[i]      = new RadioButton(foodStyle2);
                foodRadioButton2[i].Size = new Size(48, 48);
                group2[2].Add(foodRadioButton2[i]);

                kitchenRadioButton2[i]      = new RadioButton(kitchenStyle2);
                kitchenRadioButton2[i].Size = new Size(48, 48);
                group2[3].Add(kitchenRadioButton2[i]);

                rightbody.Add(utilityRadioButton2[i]);
                rightbody.Add(familyRadioButton2[i]);
                rightbody.Add(foodRadioButton2[i]);
                rightbody.Add(kitchenRadioButton2[i]);
            }

            root.Add(left);
            root.Add(right);
            left.Add(leftbody);
            right.Add(rightbody);

            utilityRadioButton[2].IsEnabled = false;
            familyRadioButton[2].IsEnabled  = false;
            foodRadioButton[2].IsEnabled    = false;
            kitchenRadioButton[2].IsEnabled = false;

            utilityRadioButton2[2].IsEnabled = false;
            familyRadioButton2[2].IsEnabled  = false;
            foodRadioButton2[2].IsEnabled    = false;
            kitchenRadioButton2[2].IsEnabled = false;

            utilityRadioButton[3].IsEnabled  = false;
            familyRadioButton[3].IsEnabled   = false;
            foodRadioButton[3].IsEnabled     = false;
            kitchenRadioButton[3].IsEnabled  = false;
            utilityRadioButton[3].IsSelected = true;
            familyRadioButton[3].IsSelected  = true;
            foodRadioButton[3].IsSelected    = true;
            kitchenRadioButton[3].IsSelected = true;

            utilityRadioButton2[3].IsEnabled  = false;
            familyRadioButton2[3].IsEnabled   = false;
            foodRadioButton2[3].IsEnabled     = false;
            kitchenRadioButton2[3].IsEnabled  = false;
            utilityRadioButton2[3].IsSelected = true;
            familyRadioButton2[3].IsSelected  = true;
            foodRadioButton2[3].IsSelected    = true;
            kitchenRadioButton2[3].IsSelected = true;
        }
Example #11
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            root = new View()
            {
                Size2D = new Size2D(1920, 1080),
            };

            CreateBoardAndButtons();

            scrollBar1_1            = new ScrollBar();
            scrollBar1_1.Position2D = new Position2D(50, 300);
            scrollBar1_1.Size2D     = new Size2D(300, 4);
            scrollBar1_1.Style.Track.BackgroundColor = Color.Green;
            scrollBar1_1.MaxValue                    = (int)scrollBar1_1.SizeWidth / 10;
            scrollBar1_1.MinValue                    = 0;
            scrollBar1_1.Style.Thumb.Size            = new Size(30, 4);
            scrollBar1_1.CurrentValue                = 0; //set after thumbsize
            scrollBar1_1.Style.Thumb.BackgroundColor = Color.Black;
            root.Add(scrollBar1_1);

            scrollBar1_2            = new ScrollBar();
            scrollBar1_2.Position2D = new Position2D(50, 400);
            scrollBar1_2.Size2D     = new Size2D(300, 4);
            scrollBar1_2.Style.Track.BackgroundColor = Color.Green;
            scrollBar1_2.MaxValue                    = (int)scrollBar1_2.SizeWidth / 10;
            scrollBar1_2.MinValue                    = 0;
            scrollBar1_2.Style.Thumb.Size            = new Size(30, 4);
            scrollBar1_2.CurrentValue                = 0;//set after thumbsize
            scrollBar1_2.Style.Thumb.BackgroundColor = Color.Yellow;
            scrollBar1_2.Style.Track.ResourceUrl     = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png";

            root.Add(scrollBar1_2);

            ScrollBarStyle attr = new ScrollBarStyle
            {
                Track = new ImageViewStyle
                {
                    BackgroundColor = new Selector <Color>
                    {
                        All = new Color(0.43f, 0.43f, 0.43f, 0.1f),
                    }
                },
                Thumb = new ImageViewStyle
                {
                    BackgroundColor = new Selector <Color>
                    {
                        All = new Color(1.0f, 0.0f, 0.0f, 0.2f),
                    }
                },
            };

            scrollBar2_1                  = new ScrollBar(attr);
            scrollBar2_1.Position2D       = new Position2D(500, 300);
            scrollBar2_1.Size2D           = new Size2D(300, 4);
            scrollBar2_1.MaxValue         = (int)scrollBar2_1.SizeWidth / 10;
            scrollBar2_1.MinValue         = 0;
            scrollBar2_1.Style.Thumb.Size = new Size(30, 4);
            scrollBar2_1.CurrentValue     = 0; //set after thumbsize
            root.Add(scrollBar2_1);

            board.UpFocusableView = button1;

            window.Add(root);

            FocusManager.Instance.SetCurrentFocusView(button1);
        }
Example #12
0
        public void Activate()
        {
            Window window = Window.Instance;

            root = new View()
            {
                Size2D          = new Size2D(1920, 1080),
                BackgroundColor = Color.White,
            };
            window.Add(root);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            createText[0]            = new TextLabel();
            createText[0].Text       = "Create Popup just by properties";
            createText[0].Size2D     = new Size2D(500, 100);
            createText[0].Position2D = new Position2D(500, 50);
            root.Add(createText[0]);

            popup             = new Popup();
            popup.MinimumSize = new Size2D(1032, 184);
            popup.Size        = new Size(1032, 400);
            popup.Position    = new Position(200, 100);

            // Title
            popup.Style.Title.PointSize           = 25;
            popup.Style.Title.SizeHeight          = 68;
            popup.Style.Title.HorizontalAlignment = HorizontalAlignment.Begin;
            popup.Style.Title.Position            = new Position(64, 52);
            popup.Style.Title.Text = "Popup Title";

            // Shadow
            popup.Style.ImageShadow = new ImageShadow
            {
                Url    = CommonResource.GetFHResourcePath() + "11. Popup/popup_background_shadow.png",
                Border = new Rectangle(24, 24, 24, 24),
                Offset = new Vector2(-24, -24),
                // TODO We do not have shadow extents now, so replace it to scale value
                Scale = new Vector2(1080f / 1032f, 448f / 400f),
            };

            // Background
            popup.BackgroundImage       = CommonResource.GetFHResourcePath() + "11. Popup/popup_background.png";
            popup.BackgroundImageBorder = new Rectangle(0, 0, 81, 81);

            // Buttons
            popup.AddButton("Yes");
            popup.AddButton("Exit");
            popup.ButtonBackground       = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png";
            popup.ButtonBackgroundBorder = new Rectangle(5, 5, 5, 5);
            popup.ButtonOverLayBackgroundColorSelector = new Selector <Color>
            {
                Normal   = new Color(1.0f, 1.0f, 1.0f, 1.0f),
                Pressed  = new Color(0.0f, 0.0f, 0.0f, 0.1f),
                Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f),
            };
            popup.ButtonImageShadow = new ImageShadow
            {
                Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                Border = new Rectangle(5, 5, 5, 5)
            };
            popup.ButtonTextColor         = color[0];
            popup.ButtonHeight            = 132;
            popup.PopupButtonClickEvent  += PopupButtonClickedEvent;
            popup.LayoutDirectionChanged += PopupLayoutDirectionChanged;
            popup.Post(window);

            contentText                     = new TextLabel();
            contentText.Size2D              = new Size2D(904, 100);
            contentText.PointSize           = 20;
            contentText.HorizontalAlignment = HorizontalAlignment.Begin;
            contentText.VerticalAlignment   = VerticalAlignment.Center;
            contentText.Text                = "Popup ButtonStyle is " + buttonStyles[index];
            contentText.TextColor           = new Color(0, 0, 222, 1);
            popup.AddContentText(contentText);

            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            createText[1]            = new TextLabel();
            createText[1].Text       = "Create Popup just by Attributes";
            createText[1].Size2D     = new Size2D(500, 100);
            createText[1].Position2D = new Position2D(500, 550);
            root.Add(createText[1]);

            PopupStyle attrs = new PopupStyle
            {
                MinimumSize     = new Size2D(1032, 184),
                BackgroundImage = new Selector <string> {
                    All = CommonResource.GetFHResourcePath() + "11. Popup/popup_background.png"
                },
                BackgroundImageBorder = new Selector <Rectangle> {
                    All = new Rectangle(0, 0, 81, 81)
                },
                ImageShadow = new ImageShadow
                {
                    Url    = CommonResource.GetFHResourcePath() + "11. Popup/popup_background_shadow.png",
                    Border = new Rectangle(24, 24, 24, 24),
                    Offset = new Vector2(-24, -24),
                    // TODO We do not have shadow extents now, so replace it to scale value
                    Scale = new Vector2(1080f / 1032f, 448f / 400f),
                },
                Title = new TextLabelStyle
                {
                    PointSize = new Selector <float?> {
                        All = 25
                    },
                    TextColor = new Selector <Color> {
                        All = Color.Black
                    },
                    Size = new Size(0, 68),
                    PositionUsesPivotPoint = true,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.TopLeft,
                    PivotPoint             = Tizen.NUI.PivotPoint.TopLeft,
                    HorizontalAlignment    = HorizontalAlignment.Begin,
                    VerticalAlignment      = VerticalAlignment.Bottom,
                    Position = new Position(64, 52),
                    Text     = new Selector <string> {
                        All = "Popup Title"
                    },
                },
                Buttons = new ButtonStyle
                {
                    PositionUsesPivotPoint = true,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.BottomLeft,
                    PivotPoint             = Tizen.NUI.PivotPoint.BottomLeft,
                    BackgroundImage        = new Selector <string> {
                        All = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png"
                    },
                    BackgroundImageBorder = new Selector <Rectangle> {
                        All = new Rectangle(5, 5, 5, 5)
                    },
                    ImageShadow = new ImageShadow
                    {
                        Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                        Border = new Rectangle(5, 5, 5, 5),
                    },
                    Overlay = new ImageViewStyle
                    {
                        PositionUsesPivotPoint = true,
                        ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                        PivotPoint             = Tizen.NUI.PivotPoint.Center,
                        WidthResizePolicy      = ResizePolicyType.FillToParent,
                        HeightResizePolicy     = ResizePolicyType.FillToParent,
                        BackgroundColor        = new Selector <Color>
                        {
                            Normal   = new Color(1.0f, 1.0f, 1.0f, 1.0f),
                            Pressed  = new Color(0.0f, 0.0f, 0.0f, 0.1f),
                            Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f),
                        }
                    },
                    Text = new TextLabelStyle
                    {
                        PositionUsesPivotPoint = true,
                        ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                        PivotPoint             = Tizen.NUI.PivotPoint.Center,
                        HorizontalAlignment    = HorizontalAlignment.Center,
                        VerticalAlignment      = VerticalAlignment.Center,
                        TextColor = new Selector <Color> {
                            All = color[index2]
                        },
                    },
                },
            };

            popup2          = new Popup(attrs);
            popup2.Size     = new Size(1032, 400);
            popup2.Position = new Position(200, 600);
            popup2.AddButton("Yes");
            popup2.AddButton("Exit");
            popup2.ButtonHeight            = 132;
            popup2.PopupButtonClickEvent  += PopupButtonClickedEvent;
            popup2.LayoutDirectionChanged += Popup2LayoutDirectionChanged;
            popup2.Post(window);

            contentText2                     = new TextLabel();
            contentText2.Size2D              = new Size2D(904, 100);
            contentText2.PointSize           = 20;
            contentText2.HorizontalAlignment = HorizontalAlignment.Begin;
            contentText2.VerticalAlignment   = VerticalAlignment.Center;
            contentText2.Text                = "Popup2 ButtonStyle is " + buttonStyles[index];
            popup2.ContentView.Add(contentText2);

            button = new Button();
            button.Style.BackgroundImage       = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            button.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
            button.Size2D          = new Size2D(580, 80);
            button.Position2D      = new Position2D(1300, 500);
            button.Style.Text.Text = "LayoutDirection is left to right";
            button.ClickEvent     += ButtonClickEvent;
            root.Add(button);
        }
Example #13
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            root = new View()
            {
                Size2D          = new Size2D(1920, 1080),
                BackgroundColor = Color.White,
            };
            window.Add(root);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            createText[0]            = new TextLabel();
            createText[0].Text       = "Create RadioButton just by properties";
            createText[0].TextColor  = Color.White;
            createText[0].Size2D     = new Size2D(500, 100);
            createText[0].Position2D = new Position2D(400, 100);
            root.Add(createText[0]);

            int num = 4;

            for (int i = 0; i < num; i++)
            {
                group[i]               = new RadioButtonGroup();
                modeText[i]            = new TextLabel();
                modeText[i].Text       = mode[i];
                modeText[i].Size2D     = new Size2D(200, 48);
                modeText[i].Position2D = new Position2D(300 + 200 * i, 200);
                root.Add(modeText[i]);
            }

            for (int i = 0; i < num; i++)
            {
                utilityRadioButton[i]                          = new RadioButton();
                utilityRadioButton[i].Size2D                   = new Size2D(48, 48);
                utilityRadioButton[i].Position2D               = new Position2D(300, 300 + i * 100);
                utilityRadioButton[i].Style.Icon.Size          = new Size(48, 48);
                utilityRadioButton[i].Style.Icon.Padding.Start = 5;
                utilityRadioButton[i].Style.Icon.Padding.End   = 5;
                utilityRadioButton[i].Style.Icon.Opacity       = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                utilityRadioButton[i].Style.Icon.ResourceUrl = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png",
                };

                group[0].Add(utilityRadioButton[i]);
                ////////
                familyRadioButton[i]                          = new RadioButton();
                familyRadioButton[i].Size2D                   = new Size2D(48, 48);
                familyRadioButton[i].Position2D               = new Position2D(500, 300 + i * 100);
                familyRadioButton[i].Style.Icon.Size          = new Size(48, 48);
                familyRadioButton[i].Style.Icon.Padding.Start = 5;
                familyRadioButton[i].Style.Icon.Padding.End   = 5;
                familyRadioButton[i].Style.Icon.Opacity       = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                familyRadioButton[i].Style.Icon.ResourceUrl = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
                };

                group[1].Add(familyRadioButton[i]);
                /////////
                foodRadioButton[i]                          = new RadioButton();
                foodRadioButton[i].Size2D                   = new Size2D(150, 48);
                foodRadioButton[i].Position2D               = new Position2D(700, 300 + i * 100);
                foodRadioButton[i].Style.Icon.Size          = new Size(48, 48);
                foodRadioButton[i].Style.Icon.Padding.Start = 5;
                foodRadioButton[i].Style.Icon.Padding.End   = 5;
                foodRadioButton[i].Style.Icon.Opacity       = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                foodRadioButton[i].Style.Icon.ResourceUrl = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
                };

                //foodRadioButton[i].Text = "Radio" + i;
                //foodRadioButton[i].TextAlignment = HorizontalAlignment.Begin;
                //foodRadioButton[i].PointSize = 12;
                //foodRadioButton[i].TextPaddingLeft = 70;

                group[2].Add(foodRadioButton[i]);
                ////////
                kitchenRadioButton[i]                          = new RadioButton();
                kitchenRadioButton[i].Size2D                   = new Size2D(48, 48);
                kitchenRadioButton[i].Position2D               = new Position2D(900, 300 + i * 100);
                kitchenRadioButton[i].Style.Icon.Size          = new Size(48, 48);
                kitchenRadioButton[i].Style.Icon.Padding.Start = 5;
                kitchenRadioButton[i].Style.Icon.Padding.End   = 5;
                kitchenRadioButton[i].Style.Icon.Opacity       = new Selector <float?>
                {
                    Normal           = 1.0f,
                    Selected         = 1.0f,
                    Disabled         = 0.4f,
                    DisabledSelected = 0.4f
                };
                kitchenRadioButton[i].Style.Icon.ResourceUrl = new Selector <string>
                {
                    Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
                    Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                    DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
                };

                group[3].Add(kitchenRadioButton[i]);

                root.Add(utilityRadioButton[i]);
                root.Add(familyRadioButton[i]);
                root.Add(foodRadioButton[i]);
                root.Add(kitchenRadioButton[i]);
            }
            //foodRadioButton[0].LayoutDirection = ViewLayoutDirectionType.RTL;
            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            createText[1]            = new TextLabel();
            createText[1].Text       = "Create RadioButton just by Attributes";
            createText[1].TextColor  = Color.White;
            createText[1].Size2D     = new Size2D(500, 100);
            createText[1].Position2D = new Position2D(1200, 100);
            root.Add(createText[1]);

            for (int i = 0; i < num; i++)
            {
                group2[i]               = new RadioButtonGroup();
                modeText2[i]            = new TextLabel();
                modeText2[i].Text       = mode[i];
                modeText2[i].Size2D     = new Size2D(200, 48);
                modeText2[i].Position2D = new Position2D(1100 + 200 * i, 200);
                root.Add(modeText2[i]);
            }

            ButtonStyle utilityAttrs = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size    = new Size(48, 48),
                    Opacity = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png",
                    },
                },
            };
            ButtonStyle familyAttrs = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size    = new Size(48, 48),
                    Opacity = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
                    },
                },
            };
            ButtonStyle foodAttrs = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size    = new Size(48, 48),
                    Opacity = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
                    },
                },
            };
            ButtonStyle kitchenAttrs = new ButtonStyle
            {
                Icon = new ImageViewStyle
                {
                    Size    = new Size(48, 48),
                    Opacity = new Selector <float?>
                    {
                        Normal           = 1.0f,
                        Selected         = 1.0f,
                        Disabled         = 0.4f,
                        DisabledSelected = 0.4f
                    },
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
                    },
                },
            };

            for (int i = 0; i < num; i++)
            {
                utilityRadioButton2[i]            = new RadioButton(utilityAttrs);
                utilityRadioButton2[i].Size2D     = new Size2D(48, 48);
                utilityRadioButton2[i].Position2D = new Position2D(1100, 300 + i * 100);
                group2[0].Add(utilityRadioButton2[i]);

                familyRadioButton2[i]            = new RadioButton(familyAttrs);
                familyRadioButton2[i].Size2D     = new Size2D(48, 48);
                familyRadioButton2[i].Position2D = new Position2D(1300, 300 + i * 100);
                group2[1].Add(familyRadioButton2[i]);

                foodRadioButton2[i]            = new RadioButton(foodAttrs);
                foodRadioButton2[i].Size2D     = new Size2D(48, 48);
                foodRadioButton2[i].Position2D = new Position2D(1500, 300 + i * 100);
                group2[2].Add(foodRadioButton2[i]);

                kitchenRadioButton2[i]            = new RadioButton(kitchenAttrs);
                kitchenRadioButton2[i].Size2D     = new Size2D(48, 48);
                kitchenRadioButton2[i].Position2D = new Position2D(1700, 300 + i * 100);
                group2[3].Add(kitchenRadioButton2[i]);

                root.Add(utilityRadioButton2[i]);
                root.Add(familyRadioButton2[i]);
                root.Add(foodRadioButton2[i]);
                root.Add(kitchenRadioButton2[i]);
            }

            utilityRadioButton[2].IsEnabled = false;
            familyRadioButton[2].IsEnabled  = false;
            foodRadioButton[2].IsEnabled    = false;
            kitchenRadioButton[2].IsEnabled = false;

            utilityRadioButton2[2].IsEnabled = false;
            familyRadioButton2[2].IsEnabled  = false;
            foodRadioButton2[2].IsEnabled    = false;
            kitchenRadioButton2[2].IsEnabled = false;

            utilityRadioButton[3].IsEnabled  = false;
            familyRadioButton[3].IsEnabled   = false;
            foodRadioButton[3].IsEnabled     = false;
            kitchenRadioButton[3].IsEnabled  = false;
            utilityRadioButton[3].IsSelected = true;
            familyRadioButton[3].IsSelected  = true;
            foodRadioButton[3].IsSelected    = true;
            kitchenRadioButton[3].IsSelected = true;

            utilityRadioButton2[3].IsEnabled  = false;
            familyRadioButton2[3].IsEnabled   = false;
            foodRadioButton2[3].IsEnabled     = false;
            kitchenRadioButton2[3].IsEnabled  = false;
            utilityRadioButton2[3].IsSelected = true;
            familyRadioButton2[3].IsSelected  = true;
            foodRadioButton2[3].IsSelected    = true;
            kitchenRadioButton2[3].IsSelected = true;
        }
Example #14
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            root = new View()
            {
                Size2D = new Size2D(1920, 1080),
            };
            window.Add(root);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            createText[0]            = new TextLabel();
            createText[0].Text       = "Create Tab just by properties";
            createText[0].Size2D     = new Size2D(450, 100);
            createText[0].Position2D = new Position2D(200, 100);
            createText[0].MultiLine  = true;
            root.Add(createText[0]);

            tab                 = new Tab();
            tab.Size2D          = new Size2D(700, 108);
            tab.Position2D      = new Position2D(100, 300);
            tab.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.5f);
            //tab.IsNatureTextWidth = true;
            //tab.ItemGap = 40;
            //tab.LeftSpace = 56;
            //tab.RightSpace = 56;
            //tab.TopSpace = 1;
            //tab.BottomSpace = 0;
            tab.Style.UnderLine.Size            = new Size(1, 3);
            tab.Style.UnderLine.BackgroundColor = color[0];
            tab.Style.Text.PointSize            = 25;
            tab.Style.Text.TextColor            = new Selector <Color>
            {
                Normal   = Color.Black,
                Selected = color[0],
            };
            tab.ItemChangedEvent += TabItemChangedEvent;
            root.Add(tab);

            for (int i = 0; i < 3; i++)
            {
                Tab.TabItemData item = new Tab.TabItemData();
                item.Text = "Tab " + i;
                if (i == 1)
                {
                    item.Text = "Long Tab " + i;
                }
                tab.AddItem(item);
            }
            tab.SelectedItemIndex = 0;

            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            createText[1]            = new TextLabel();
            createText[1].Text       = "Create Tab just by Attributes";
            createText[1].Size2D     = new Size2D(450, 100);
            createText[1].Position2D = new Position2D(1000, 100);
            createText[1].MultiLine  = true;
            root.Add(createText[1]);

            TabStyle attrs = new TabStyle
            {
                //IsNatureTextWidth = false,
                ItemPadding = new Extents(56, 56, 1, 0),
                UnderLine   = new ViewStyle
                {
                    Size = new Size(1, 3),
                    PositionUsesPivotPoint = true,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.BottomLeft,
                    PivotPoint             = Tizen.NUI.PivotPoint.BottomLeft,
                    BackgroundColor        = new Selector <Color> {
                        All = color[0]
                    },
                },
                Text = new TextLabelStyle
                {
                    PointSize = new Selector <float?> {
                        All = 25
                    },
                    TextColor = new Selector <Color>
                    {
                        Normal   = Color.Black,
                        Selected = color[0],
                    },
                },
            };

            tab2                   = new Tab(attrs);
            tab2.Size2D            = new Size2D(500, 108);
            tab2.Position2D        = new Position2D(900, 300);
            tab2.BackgroundColor   = new Color(1.0f, 1.0f, 1.0f, 0.5f);
            tab2.ItemChangedEvent += Tab2ItemChangedEvent;
            root.Add(tab2);

            for (int i = 0; i < 3; i++)
            {
                Tab.TabItemData item = new Tab.TabItemData();
                item.Text = "Tab " + i;
                tab2.AddItem(item);
            }
            tab2.SelectedItemIndex = 0;

            button = new Button();
            button.Style.BackgroundImage       = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            button.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
            button.Size2D          = new Size2D(280, 80);
            button.Position2D      = new Position2D(400, 700);
            button.Style.Text.Text = mode[index];
            button.ClickEvent     += ButtonClickEvent;
            root.Add(button);

            button2 = new Button();
            button2.Style.BackgroundImage       = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            button2.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
            button2.Size2D          = new Size2D(580, 80);
            button2.Position2D      = new Position2D(250, 500);
            button2.Style.Text.Text = "LayoutDirection is left to right";
            button2.ClickEvent     += ButtonClickEvent2;
            root.Add(button2);
        }
Example #15
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            root = new View()
            {
                Size = window.Size,
                ParentOrigin = ParentOrigin.Center,
                PivotPoint = PivotPoint.Center,
                PositionUsesPivotPoint = true,
            };
            window.Add(root);

            canvasView = new CanvasView(window.Size)
            {
                Size = window.Size,
                ParentOrigin = ParentOrigin.Center,
                PivotPoint = PivotPoint.Center,
                PositionUsesPivotPoint = true,
            };

            RadialGradient roundedRectFillRadialGradient = new RadialGradient()
            {
                ColorStops = new List<ColorStop>()
                {
                    new ColorStop(0.0f, new Color(1.0f,0.0f,0.0f,1.0f)),
                    new ColorStop(0.5f, new Color(0.0f,1.0f,0.0f,1.0f)),
                    new ColorStop(1.0f, new Color(0.0f,0.0f,1.0f,1.0f))
                }.AsReadOnly(),
                Spread = SpreadType.Reflect,
            };
            roundedRectFillRadialGradient.SetBounds(new Position2D(0, 0), 30);

            roundedRectShape = new Shape()
            {
                FillColor = new Color(0.5f, 1.0f, 0.0f, 1.0f),
                StrokeColor = new Color(0.5f, 0.0f, 0.0f, 0.5f),
                StrokeWidth = 10.0f,
                FillGradient = roundedRectFillRadialGradient,
            };
            roundedRectShape.Translate(100.0f, 100.0f);
            roundedRectShape.Scale(1.2f);
            roundedRectShape.Rotate(45.0f);
            roundedRectShape.AddRect(-50.0f, -50.0f, 100.0f, 100.0f, 0.0f, 0.0f);

            Shape circleMask = new Shape()
            {
                FillColor = new Color(1.0f, 1.0f, 1.0f, 1.0f),
            };
            circleMask.AddRect(-50.0f, -50.0f, 100.0f, 100.0f, 0.0f, 0.0f);
            circleMask.Translate(350.0f, 100.0f);

            circleShape = new Shape()
            {
                Opacity = 0.5f,
                FillColor = new Color(0.0f, 0.0f, 1.0f, 1.0f),
                StrokeColor = new Color(1.0f, 1.0f, 0.0f, 1.0f),
                StrokeWidth = 10.0f,
                StrokeDash = new List<float>() { 15.0f, 30.0f }.AsReadOnly(),
            };
            circleShape.AddCircle(0.0f, 0.0f, 150.0f, 100.0f);
            circleShape.Transform(new float[] { 0.6f, 0.0f, 350.0f, 0.0f, 0.6f, 100.0f, 0.0f, 0.0f, 1.0f });

            circleShape.Mask(circleMask, MaskType.Alpha);

            arcShape = new Shape()
            {
                StrokeColor = new Color(0.0f, 0.5f, 0.0f, 0.5f),
                StrokeWidth = 10.0f,
                StrokeJoin = StrokeJoinType.Round,
            };
            arcShape.AddArc(0.0f, 0.0f, 80.0f, 0.0f, 0.0f, true);
            arcShape.Translate(100.0f, 300.0f);

            Shape shape = new Shape()
            {
                Opacity = 0.5f,
                FillColor = new Color(0.0f, 0.5f, 0.0f, 0.5f),
                StrokeColor = new Color(0.5f, 0.0f, 0.5f, 0.5f),
                StrokeWidth = 30.0f,
                FillRule = FillRuleType.EvenOdd,
                StrokeJoin = StrokeJoinType.Round,
            };

            shape.Scale(0.5f);
            shape.Translate(350.0f, 300.0f);

            shape.AddPath(new PathCommands(new PathCommandType[] { PathCommandType.MoveTo,
                                                                   PathCommandType.LineTo,
                                                                   PathCommandType.LineTo,
                                                                   PathCommandType.LineTo,
                                                                   PathCommandType.LineTo,
                                                                   PathCommandType.Close },
                                            new float[] {0.0f, -160.0f,
                                                        125.0f, 160.0f,
                                                        -180.0f, -45.0f,
                                                        180.0f, -45.0f,
                                                        -125.0f, 160.0f }));

            canvasView.AddDrawable(shape);

            Shape starClipper = new Shape()
            {
                FillColor = new Color(1.0f, 1.0f, 1.0f, 1.0f),
            };
            starClipper.AddCircle(0.0f, 0.0f, 160.0f, 160.0f);
            starClipper.Translate(250.0f, 550.0f);

            LinearGradient starFillLinearGradient = new LinearGradient()
            {
                ColorStops = new List<ColorStop>()
                {
                    new ColorStop(0.0f, new Color(1.0f,0.0f,0.0f,1.0f)),
                    new ColorStop(0.5f, new Color(0.0f,1.0f,0.0f,1.0f)),
                    new ColorStop(1.0f, new Color(0.0f,0.0f,1.0f,1.0f))
                }.AsReadOnly()
            };
            starFillLinearGradient.SetBounds(new Position2D(-50, -50), new Position2D(50, 50));

            LinearGradient starStrokeLinearGradient = new LinearGradient()
            {
                ColorStops = new List<ColorStop>()
                {
                    new ColorStop(0.0f, new Color(1.0f,0.0f,1.0f,1.0f)),
                    new ColorStop(1.0f, new Color(0.0f,1.0f,1.0f,1.0f))
                }.AsReadOnly()
            };
            starStrokeLinearGradient.SetBounds(new Position2D(0, -50), new Position2D(50, 50));

            starShape = new Shape()
            {
                Opacity = 0.5f,
                FillColor = new Color(0.0f, 1.0f, 1.0f, 1.0f),
                StrokeColor = new Color(0.5f, 1.0f, 0.5f, 1.0f),
                StrokeWidth = 30.0f,
                StrokeCap = StrokeCapType.Round,
                FillGradient = starFillLinearGradient,
                StrokeGradient = starStrokeLinearGradient,
            };

            starShape.Translate(250.0f, 550.0f);
            starShape.Scale(0.5f);
            starShape.AddMoveTo(-1.0f, -165.0f);
            starShape.AddLineTo(53.0f, -56.0f);
            starShape.AddLineTo(174.0f, -39.0f);
            starShape.AddLineTo(87.0f, 45.0f);
            starShape.AddLineTo(107.0f, 166.0f);
            starShape.AddLineTo(-1.0f, 110.0f);
            starShape.AddLineTo(-103.0f, 166.0f);
            starShape.AddLineTo(-88.0f, 46.0f);
            starShape.AddLineTo(-174.0f, -38.0f);
            starShape.AddLineTo(-54.0f, -56.0f);
            starShape.Close();

            starShape.ClipPath(starClipper);

            canvasView.AddDrawable(starShape);

            group1 = new DrawableGroup();
            group1.AddDrawable(roundedRectShape);
            group1.AddDrawable(arcShape);

            group2 = new DrawableGroup();
            group2.AddDrawable(group1);
            group2.AddDrawable(circleShape);
            canvasView.AddDrawable(group2);

            Picture picture = new Picture();
            picture.Load(CommonResource.GetDaliResourcePath() + "DaliDemo/Kid1.svg");
            picture.SetSize(new Size2D(150, 150));
            picture.Translate(300.0f, 550.0f);
            canvasView.AddDrawable(picture);

            // Test Getter
            Position2D p1 = new Position2D(9, 9), p2 = new Position2D(8, 8);
            starFillLinearGradient.GetBounds(ref p1, ref p2);
            log.Debug(tag, "Gradient Bounds : P1 :" + p1.X + " " + p1.Y + " / P2 :" + p2.X + " " + p2.Y + "\n");

            ReadOnlyCollection<ColorStop> stops = starShape.FillGradient.ColorStops;
            for (int i = 0; i < stops.Count; i++)
            {
                log.Debug(tag, "Gradient Stops :" + i + " " + stops[i].Offset + " " + stops[i].Color.R + " " + stops[i].Color.G + " " + stops[i].Color.B + " " + stops[i].Color.A + "\n");
            }

            log.Debug(tag, "picture size : " + picture.GetSize().Width + " " + picture.GetSize().Height + "\n");

            log.Debug(tag, "circleShape Color : " + circleShape.FillColor.R + " " + circleShape.FillColor.G + " " + circleShape.FillColor.B + " " + circleShape.FillColor.A + "\n");
            log.Debug(tag, "circleShape StrokeColor : " + circleShape.StrokeColor.R + " " + circleShape.StrokeColor.G + " " + circleShape.StrokeColor.B + " " + circleShape.StrokeColor.A + "\n");

            log.Debug(tag, "arcShape StrokeCap : " + arcShape.StrokeCap + "\n");

            log.Debug(tag, "shape2 FillRule : " + shape.FillRule + "\n");
            log.Debug(tag, "shape2 StrokeWidth : " + shape.StrokeWidth + "\n");
            log.Debug(tag, "shape2 StrokeJoin : " + shape.StrokeJoin + "\n");
            log.Debug(tag, "shape2 Opacity : " + shape.Opacity + "\n");

            for (int i = 0; i < circleShape.StrokeDash.Count; i++)
            {
                log.Debug(tag, "shape2 StrokeDash : " + circleShape.StrokeDash[i] + "\n");
            }

            // Exception test.
            try
            {
                circleShape.Transform(new float[] { 0.6f, 0.0f });
            }
            catch (ArgumentException e)
            {
                log.Debug(tag, "Transform : " + e.Message + "\n");
            }
            try
            {
                circleShape.Transform(null);
            }
            catch (ArgumentException e)
            {
                log.Debug(tag, "Transform : " + e.Message + "\n");
            }
            try
            {
                circleShape.StrokeDash = null;
            }
            catch (ArgumentException e)
            {
                log.Debug(tag, "StrokeDash setter : " + e.Message + "\n");
            }

            root.Add(canvasView);

            timer = new Timer(1000 / 32);
            timer.Tick += onTick;
            timer.Start();
        }
Example #16
0
 static void Main(string[] args)
 {
     new DaliDemo(CommonResource.GetDaliResourcePath() + @"../../style/demo-theme.json").Run(args);
 }
Example #17
0
        private void CreateSwitchView()
        {
            // Init parent of SwitchView
            parentView[2]        = new View();
            parentView[2].Size   = new Size(1920, 680);
            parentView[2].Layout = new GridLayout()
            {
                Rows = 4, GridOrientation = GridLayout.Orientation.Horizontal
            };
            root.Add(parentView[2]);

            // Create switch styles
            SwitchStyle utilitySt = new SwitchStyle
            {
                Size         = new Size(96, 60),
                IsSelectable = true,
                Track        = new ImageViewStyle
                {
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_on.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_on_dim.png",
                    },
                    Border = new Rectangle(30, 30, 30, 30),
                },
                Thumb = new ImageViewStyle
                {
                    Size        = new Size(60, 60),
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                    },
                },
            };
            SwitchStyle familySt = new SwitchStyle
            {
                IsSelectable = true,
                Track        = new ImageViewStyle
                {
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_24c447.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_dim_24c447.png",
                    },
                    Border = new Rectangle(30, 30, 30, 30),
                },
                Thumb = new ImageViewStyle
                {
                    Size        = new Size(60, 60),
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                    },
                },
            };
            SwitchStyle foodSt = new SwitchStyle
            {
                IsSelectable = true,
                Track        = new ImageViewStyle
                {
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_ec7510.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_dim_ec7510.png",
                    },
                    Border = new Rectangle(30, 30, 30, 30),
                },
                Thumb = new ImageViewStyle
                {
                    Size        = new Size(60, 60),
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                    },
                },
            };
            SwitchStyle kitchenSt = new SwitchStyle
            {
                IsSelectable = true,
                Track        = new ImageViewStyle
                {
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_9762d9.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_dim_9762d9.png",
                    },
                    Border = new Rectangle(30, 30, 30, 30),
                },
                Thumb = new ImageViewStyle
                {
                    Size        = new Size(60, 60),
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Selected         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
                        Disabled         = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                        DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
                    },
                },
            };

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            int i = 0;

            for (; i < 4; i++)
            {
                utilitySwitch[i] = new Switch();
                utilitySwitch[i].ApplyStyle(utilitySt);
                utilitySwitch[i].Size   = new Size(96, 60);
                utilitySwitch[i].Margin = new Extents(100, 0, 20, 0);
                parentView[2].Add(utilitySwitch[i]);
            }
            for (i = 0; i < 4; i++)
            {
                familySwitch[i] = new Switch();
                familySwitch[i].ApplyStyle(familySt);
                familySwitch[i].Size = new Size(96, 60);
                parentView[2].Add(familySwitch[i]);
            }
            for (i = 0; i < 4; i++)
            {
                foodSwitch[i] = new Switch();
                foodSwitch[i].ApplyStyle(foodSt);
                foodSwitch[i].Size = new Size(96, 60);
                parentView[2].Add(foodSwitch[i]);
            }
            for (i = 0; i < 4; i++)
            {
                kitchenSwitch[i] = new Switch();
                kitchenSwitch[i].ApplyStyle(kitchenSt);
                kitchenSwitch[i].Size = new Size(96, 60);
                parentView[2].Add(kitchenSwitch[i]);
            }

            ///////////////////////////////////////////////Create by Style//////////////////////////////////////////////////////////
            for (i = 0; i < 4; i++)
            {
                utilitySwitch2[i] = new Switch();
                utilitySwitch2[i].ApplyStyle(utilitySt);
                utilitySwitch2[i].Size = new Size(96, 60);
                parentView[2].Add(utilitySwitch2[i]);
            }
            for (i = 0; i < 4; i++)
            {
                familySwitch2[i] = new Switch();
                familySwitch2[i].ApplyStyle(familySt);
                familySwitch2[i].Size = new Size(96, 60);
                parentView[2].Add(familySwitch2[i]);
            }
            for (i = 0; i < 4; i++)
            {
                foodSwitch2[i] = new Switch();
                foodSwitch2[i].ApplyStyle(foodSt);
                foodSwitch2[i].Size = new Size(96, 60);
                parentView[2].Add(foodSwitch2[i]);
            }
            for (i = 0; i < 4; i++)
            {
                kitchenSwitch2[i] = new Switch();
                kitchenSwitch2[i].ApplyStyle(kitchenSt);
                kitchenSwitch2[i].Size = new Size(96, 60);
                parentView[2].Add(kitchenSwitch2[i]);
            }

            utilitySwitch[2].IsEnabled = false;
            familySwitch[2].IsEnabled  = false;
            foodSwitch[2].IsEnabled    = false;
            kitchenSwitch[2].IsEnabled = false;

            utilitySwitch2[2].IsEnabled = false;
            familySwitch2[2].IsEnabled  = false;
            foodSwitch2[2].IsEnabled    = false;
            kitchenSwitch2[2].IsEnabled = false;

            utilitySwitch[3].IsEnabled  = false;
            familySwitch[3].IsEnabled   = false;
            foodSwitch[3].IsEnabled     = false;
            kitchenSwitch[3].IsEnabled  = false;
            utilitySwitch[3].IsSelected = true;
            familySwitch[3].IsSelected  = true;
            foodSwitch[3].IsSelected    = true;
            kitchenSwitch[3].IsSelected = true;

            utilitySwitch2[3].IsEnabled  = false;
            familySwitch2[3].IsEnabled   = false;
            foodSwitch2[3].IsEnabled     = false;
            kitchenSwitch2[3].IsEnabled  = false;
            utilitySwitch2[3].IsSelected = true;
            familySwitch2[3].IsSelected  = true;
            foodSwitch2[3].IsSelected    = true;
            kitchenSwitch2[3].IsSelected = true;
        }
Example #18
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            flexibleView1                 = new FlexibleView();
            flexibleView1.Name            = "RecyclerView";
            flexibleView1.Position2D      = new Position2D(500, 200);
            flexibleView1.Size2D          = new Size2D(400, 450);
            flexibleView1.Padding         = new Extents(10, 10, 10, 10);
            flexibleView1.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.4f);

            List <ListItemData> dataList = new List <ListItemData>();

            for (int i = 0; i < 131; ++i)
            {
                dataList.Add(new ListItemData(i));
            }
            adapter = new ListBridge(dataList);
            flexibleView1.SetAdapter(adapter);

            LinearLayoutManager layoutManager1 = new LinearLayoutManager(LinearLayoutManager.VERTICAL);

            //GridLayoutManager layoutManager1 = new GridLayoutManager(3, LinearLayoutManager.VERTICAL);
            flexibleView1.SetLayoutManager(layoutManager1);

            flexibleView1.FocusedItemIndex = 0;

            window.Add(flexibleView1);

            flexibleView1.Focusable = true;

            flexibleView1.KeyEvent    += RecyclerView_KeyEvent;
            flexibleView1.FocusGained += FlexibleView_FocusGained;
            flexibleView1.FocusLost   += FlexibleView_FocusLost;

            scrollBar1            = new ScrollBar();
            scrollBar1.Direction  = ScrollBar.DirectionType.Vertical;
            scrollBar1.Position2D = new Position2D(394, 2);
            scrollBar1.Size2D     = new Size2D(4, 446);
            scrollBar1.Style.Track.BackgroundColor = Color.Green;
            scrollBar1.Style.Thumb.Size            = new Size(4, 30);
            scrollBar1.Style.Thumb.BackgroundColor = Color.Yellow;
            scrollBar1.Style.Track.ResourceUrl     = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png";
            flexibleView1.AttachScrollBar(scrollBar1);


            flexibleView2                 = new FlexibleView();
            flexibleView2.Name            = "RecyclerView";
            flexibleView2.Position2D      = new Position2D(500, 800);
            flexibleView2.Size2D          = new Size2D(700, 200);
            flexibleView2.Padding         = new Extents(10, 10, 10, 10);
            flexibleView2.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.4f);

            flexibleView2.SetAdapter(adapter);

            GridLayoutManager layoutManager2 = new GridLayoutManager(3, LinearLayoutManager.HORIZONTAL);

            flexibleView2.SetLayoutManager(layoutManager2);

            flexibleView2.FocusedItemIndex = 0;

            window.Add(flexibleView2);

            flexibleView2.Focusable = true;

            flexibleView2.KeyEvent    += RecyclerView_KeyEvent;
            flexibleView2.FocusGained += FlexibleView_FocusGained;
            flexibleView2.FocusLost   += FlexibleView_FocusLost;

            scrollBar2            = new ScrollBar();
            scrollBar2.Position2D = new Position2D(2, 194);
            scrollBar2.Size2D     = new Size2D(696, 4);
            scrollBar2.Style.Track.BackgroundColor = Color.Green;
            scrollBar2.Style.Thumb.Size            = new Size(30, 4);
            scrollBar2.Style.Thumb.BackgroundColor = Color.Yellow;
            scrollBar2.Style.Track.ResourceUrl     = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png";
            flexibleView2.AttachScrollBar(scrollBar2);


            FocusManager.Instance.SetCurrentFocusView(flexibleView1);
        }
Example #19
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);
            }
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
            /////////////////////////////////////// Symmetrical Circular Pagination ///////////////////////////////////////
            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////

            circular                   = new CircularPagination();
            circular.Position2D        = new Position2D(50, 20);
            circular.Size2D            = new Size2D(360, 360);
            circular.BackgroundColor   = new Color(0.2f, 0.2f, 0.2f, 0.6f);
            circular.IndicatorSize     = new Size(26, 26);
            circular.IndicatorImageURL = new Selector <string>()
            {
                Normal   = CommonResource.GetFHResourcePath() + "9. Controller/pagination_ic_nor.png",
                Selected = CommonResource.GetFHResourcePath() + "9. Controller/pagination_ic_sel.png",
            };

            circular.IndicatorCount = 19;

            //circular.SelectedIndex = 0;

            window.Add(circular);

            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            /////////////////////////////////////// Asymmetrical Circular Pagination ///////////////////////////////////////
            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            homeCircular                 = new CircularPagination();
            homeCircular.Position2D      = new Position2D(50, 410);
            homeCircular.Size2D          = new Size2D(360, 360);
            homeCircular.BackgroundColor = new Color(0.7f, 0.7f, 0.7f, 0.6f);

            homeCircular.IndicatorSize     = new Size(26, 26);
            homeCircular.IndicatorImageURL = new Selector <string>()
            {
                Normal   = CommonResource.GetFHResourcePath() + "9. Controller/pagination_ic_nor.png",
                Selected = CommonResource.GetFHResourcePath() + "9. Controller/pagination_ic_sel.png",
            };

            // If you want to set the center indicator image differently from other indicators,
            // Use CenterIndicatorImageURL like below. (for example, home indicator clock picker)
            homeCircular.CenterIndicatorImageURL = new Selector <string>()
            {
                Normal   = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_press.png",
                Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png",
            };

            homeCircular.IsSymmetrical       = false;
            homeCircular.RightIndicatorCount = 5;
            homeCircular.LeftIndicatorCount  = 2;

            //homeCircular.SetIndicatorPosition(0, new Position(111, 11));
            //homeCircular.SetIndicatorPosition(2, new Position(222, 73));

            //homeCircular.SelectedIndex = 0;

            window.Add(homeCircular);

            window.KeyEvent += Window_KeyEvent;
        }
Example #21
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            root = new View()
            {
                Size2D = new Size2D(1920, 1080),
            };
            window.Add(root);
            CreateInforText();

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            createText[0]            = new TextLabel();
            createText[0].Text       = "Create Slider just by properties";
            createText[0].TextColor  = Color.White;
            createText[0].Size2D     = new Size2D(450, 100);
            createText[0].Position2D = new Position2D(200, 100);
            createText[0].MultiLine  = true;
            root.Add(createText[0]);

            slider[0] = CreateByProperty(40, 300, 800, 50, 20, Slider.DirectionType.Horizontal);
            slider[1] = CreateByProperty(300, 450, 50, 400, 20, Slider.DirectionType.Vertical);

            slider[2] = CreateByProperty(40, 400, 800, 50, 30, Slider.DirectionType.Horizontal);
            slider[2].Style.LowIndicator.Text = "SubText";
            slider[2].LowIndicatorSize        = new Size(100, 40);

            slider[3] = CreateByProperty(600, 450, 50, 400, 30, Slider.DirectionType.Vertical);
            slider[3].Style.LowIndicator.Text = "SubText";
            slider[3].LowIndicatorSize        = new Size(100, 40);

            /////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            createText[1]            = new TextLabel();
            createText[1].TextColor  = Color.White;
            createText[1].Text       = "Create Slider just by Attributes";
            createText[1].Size2D     = new Size2D(450, 100);
            createText[1].Position2D = new Position2D(1000, 100);
            createText[1].MultiLine  = true;
            root.Add(createText[1]);

            SliderStyle attributes = new SliderStyle
            {
                TrackThickness = 4,
                Track          = new ImageViewStyle
                {
                    BackgroundColor = new Selector <Color>
                    {
                        All = new Color(0, 0, 0, 0.1f),
                    }
                },

                Progress = new ImageViewStyle
                {
                    BackgroundColor = new Selector <Color>
                    {
                        All = new Color(0.05f, 0.63f, 0.9f, 1),
                    }
                },

                Thumb = new ImageViewStyle
                {
                    Size        = new Size(60, 60),
                    ResourceUrl = new Selector <string>
                    {
                        Normal  = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_normal.png",
                        Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_press.png",
                    },
                    BackgroundImage = new Selector <string>
                    {
                        Normal  = "",
                        Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_effect.png",
                    }
                },
                //ThumbBackground = new ImageViewStyle
                //{
                //    Size = new Size(60, 60),
                //    ResourceUrl = new Selector<string>
                //    {
                //        Normal = "",
                //        Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_effect.png",
                //    }
                //}
            };

            slider2[0] = CreateByAttributes(attributes, 890, 300, 800, 50, 20, Slider.DirectionType.Horizontal);
            slider2[1] = CreateByAttributes(attributes, 1150, 450, 50, 400, 20, Slider.DirectionType.Vertical);

            slider2[2] = CreateByAttributes(attributes, 890, 400, 800, 50, 30, Slider.DirectionType.Horizontal);
            slider2[2].Style.LowIndicator.Text = "SubText";
            slider2[2].LowIndicatorSize        = new Size(100, 40);

            slider2[3] = CreateByAttributes(attributes, 1450, 450, 50, 400, 30, Slider.DirectionType.Vertical);
            slider2[3].Style.LowIndicator.Text = "SubText";
            slider2[3].LowIndicatorSize        = new Size(100, 40);
        }
Example #22
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            //Create root view with linear layout.
            root = new View()
            {
                Size            = new Size(1920, 1080),
                BackgroundColor = new Color(0.7f, 0.9f, 0.8f, 1.0f),
                Layout          = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Horizontal,
                    CellPadding       = new Size(50, 50),
                    LinearAlignment   = LinearLayout.Alignment.Center,
                }
            };
            window.Add(root);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            parent1 = new View()
            {
                Size   = new Size(900, 800),
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                    CellPadding       = new Size(50, 50),
                    LinearAlignment   = LinearLayout.Alignment.Top,
                }
            };

            root.Add(parent1);
            // Create a description text.
            createText[0]           = new TextLabel();
            createText[0].Text      = "Create DropDown just by properties";
            createText[0].Size      = new Size(800, 100);
            createText[0].MultiLine = true;
            parent1.Add(createText[0]);

            //Create a dropdown by property.
            #region CreateByProperty
            dropDown = new DropDown();
            var style = dropDown.Style;
            style.Button.BackgroundImage  = "";
            style.Button.Icon.ResourceUrl = CommonResource.GetFHResourcePath() + "6. List/list_ic_dropdown.png";
            style.Button.Text.PointSize   = 20;
            style.Button.Text.FontFamily  = "SamsungOneUI 500";
            style.Button.Text.TextColor   = new Color(0, 0, 0, 1);
            dropDown.ApplyStyle(style);
            dropDown.Size                            = new Size(900, 108);
            dropDown.HeaderText.Text                 = "TitleArea";
            dropDown.HeaderText.TextColor            = new Color(0, 0, 0, 1);
            dropDown.HeaderText.PointSize            = 28;
            dropDown.HeaderText.FontFamily           = "SamsungOneUI 500C";
            dropDown.HeaderText.PositionX            = 50;
            dropDown.Button.TextLabel.Text           = "DropDown Text";
            dropDown.Button.Icon.Size                = new Size(48, 48);
            dropDown.Button.IconRelativeOrientation  = Button.IconOrientation.Right;
            dropDown.Button.ParentOrigin             = ParentOrigin.CenterLeft;
            dropDown.Button.PivotPoint               = PivotPoint.CenterLeft;
            dropDown.Button.PositionX                = 56;
            dropDown.SpaceBetweenButtonTextAndIcon   = 8;
            dropDown.ListBackgroundImage.ResourceUrl = CommonResource.GetFHResourcePath() + "10. Drop Down/dropdown_bg.png";
            dropDown.ListBackgroundImage.Border      = new Rectangle(51, 51, 51, 51);
            dropDown.ListBackgroundImage.Size        = new Size(360, 500);
            dropDown.ListMargin.Start                = 20;
            dropDown.ListMargin.Top                  = 20;
            dropDown.ListPadding                     = new Extents(4, 4, 4, 4);
            dropDown.BackgroundColor                 = new Color(1, 1, 1, 1);
            parent1.Add(dropDown);
            for (int i = 0; i < 8; i++)
            {
                DropDown.DropDownDataItem item = new DropDown.DropDownDataItem();
                item.Size            = new Size(360, 96);
                item.BackgroundColor = new Selector <Color>
                {
                    Pressed = new Color(0, 0, 0, 0.4f),
                    Other   = new Color(1, 1, 1, 0),
                };
                item.Text                    = "Normal list " + i;
                item.PointSize               = 18;
                item.FontFamily              = "SamsungOne 500";
                item.TextPosition            = new Position(28, 0);
                item.CheckImageSize          = new Size(40, 40);
                item.CheckImageResourceUrl   = CommonResource.GetFHResourcePath() + "10. Drop Down/dropdown_checkbox_on.png";
                item.CheckImageGapToBoundary = 16;
                dropDown.AddItem(item);
            }

            dropDown.SelectedItemIndex = 3;

            ////////Attach scrollbar///////////
            scrollBar               = new ScrollBar();
            scrollBar.Direction     = ScrollBar.DirectionType.Vertical;
            scrollBar.Size          = new Size(4, 446);
            scrollBar.TrackColor    = Color.Green;
            scrollBar.ThumbSize     = new Size(4, 30);
            scrollBar.ThumbColor    = Color.Yellow;
            scrollBar.TrackImageURL = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png";
            dropDown.AttachScrollBar(scrollBar);

            #endregion
            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            parent2 = new View()
            {
                Size   = new Size(900, 800),
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                    CellPadding       = new Size(50, 50),
                    LinearAlignment   = LinearLayout.Alignment.Top,
                }
            };
            root.Add(parent2);

            // Create a description text.
            createText[1]           = new TextLabel();
            createText[1].Text      = "Create DropDown just by Attributes";
            createText[1].Size      = new Size(800, 100);
            createText[1].MultiLine = true;
            parent2.Add(createText[1]);

            //Create a dropdown by style.
            #region CreateByStyle

            DropDownStyle dropDownStyle = new DropDownStyle
            {
                HeaderText = new TextLabelStyle
                {
                    Text = new Selector <string> {
                        All = "TitleArea"
                    },
                    PointSize = new Selector <float?> {
                        All = 28
                    },
                    TextColor = new Selector <Color> {
                        All = new Color(0, 0, 0, 1)
                    },
                    FontFamily = "SamsungOneUI 500C",
                    PositionX  = 50,
                },

                Button = new ButtonStyle
                {
                    Text = new TextLabelStyle
                    {
                        Text = new Selector <string> {
                            All = "DropDown Text"
                        },
                        PointSize = new Selector <float?> {
                            All = 20
                        },
                        TextColor = new Selector <Color> {
                            All = new Color(0, 0, 0, 1)
                        },
                        FontFamily = "SamsungOneUI 500",
                    },
                    Icon = new ImageViewStyle
                    {
                        Size        = new Size(48, 48),
                        ResourceUrl = new Selector <string> {
                            All = CommonResource.GetFHResourcePath() + "6. List/list_ic_dropdown.png"
                        },
                    },
                    IconRelativeOrientation = Button.IconOrientation.Right,
                    PositionX       = 56,
                    BackgroundImage = "",
                },
                ListBackgroundImage = new ImageViewStyle
                {
                    ResourceUrl = new Selector <string> {
                        All = CommonResource.GetFHResourcePath() + "10. Drop Down/dropdown_bg.png"
                    },
                    Border = new Selector <Rectangle> {
                        All = new Rectangle(51, 51, 51, 51)
                    },
                    Size = new Size(360, 500),
                },
                SpaceBetweenButtonTextAndIcon = 8,
                ListMargin      = new Extents(20, 0, 20, 0),
                BackgroundColor = new Selector <Color> {
                    All = new Color(1, 1, 1, 1)
                },
                ListPadding = new Extents(4, 4, 4, 4),
            };

            dropDown2      = new DropDown(dropDownStyle);
            dropDown2.Size = new Size(900, 108);
            parent2.Add(dropDown2);

            DropDownItemStyle itemStyle = new DropDownItemStyle
            {
                BackgroundColor = new Selector <Color>
                {
                    Pressed = new Color(0, 0, 0, 0.4f),
                    Other   = new Color(1, 1, 1, 0),
                },
                Text = new TextLabelStyle
                {
                    PointSize = new Selector <float?> {
                        All = 18
                    },
                    FontFamily = "SamsungOne 500",
                    Position   = new Position(28, 0),
                },
                CheckImage = new ImageViewStyle
                {
                    Size        = new Size(40, 40),
                    ResourceUrl = new Selector <string> {
                        All = CommonResource.GetFHResourcePath() + "10. Drop Down/dropdown_checkbox_on.png"
                    },
                },
                CheckImageGapToBoundary = 16,
            };

            for (int i = 0; i < 8; i++)
            {
                DropDown.DropDownDataItem item = new DropDown.DropDownDataItem(itemStyle);
                item.Size = new Size(360, 96);
                item.Text = "Normal list " + i;
                dropDown2.AddItem(item);
            }
            dropDown2.SelectedItemIndex = 0;

            ////////Attach scrollbar///////////
            scrollBar2               = new ScrollBar();
            scrollBar2.Direction     = ScrollBar.DirectionType.Vertical;
            scrollBar2.Size          = new Size(4, 446);
            scrollBar2.TrackColor    = Color.Green;
            scrollBar2.ThumbSize     = new Size(4, 30);
            scrollBar2.ThumbColor    = Color.Yellow;
            scrollBar2.TrackImageURL = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png";
            dropDown2.AttachScrollBar(scrollBar2);

            #endregion
            //Add all views into root view.
            root.Add(parent1);
            root.Add(parent2);
        }