Beispiel #1
0
        public void Activate()
        {
            Window window = Window.Instance;

            root = new View()
            {
                Size            = new Size(1920, 1080),
                BackgroundColor = new Color(0.8f, 0.8f, 0.8f, 0.6f),
            };

            CreateBoardAndButtons();

            toast1_1      = Toast.FromText("null parameter construction", 1000);
            toast1_1.Size = new Size(500, 132);
            toast1_1.Post(window);

            ToastStyle attr = new ToastStyle
            {
                Size                  = new Size(512, 132),
                BackgroundImage       = CommonResource.GetFHResourcePath() + "12. Toast Popup/toast_background.png",
                BackgroundImageBorder = new Rectangle(64, 64, 4, 4),
                Duration              = 3000
            };

            toast2_1         = new Toast(attr);
            toast2_1.Message = "attibute parameter construction";
            toast2_1.Post(window);
            //root.Add(toast2_1);


            board.UpFocusableView = button1;
            window.Add(root);

            FocusManager.Instance.SetCurrentFocusView(button1);
        }
Beispiel #2
0
        private void CreateToastView()
        {
            // Init parent of ToastView
            parentView[1]        = new View();
            parentView[1].Size   = new Size(1920, 500);
            parentView[1].Layout = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Horizontal, LinearAlignment = LinearLayout.Alignment.Center, CellPadding = new Size2D(300, 0)
            };
            root.Add(parentView[1]);

            // Create Toasts
            toast1_1      = Toast.FromText("Null parameter construction", 1000);
            toast1_1.Size = new Size(700, 132);
            toast1_1.Post(NUIApplication.GetDefaultWindow());

            ToastStyle attr = new ToastStyle
            {
                Size                  = new Size(712, 132),
                BackgroundImage       = CommonResource.GetFHResourcePath() + "12. Toast Popup/toast_background.png",
                BackgroundImageBorder = new Rectangle(64, 64, 4, 4),
                Duration              = 3000
            };

            toast2_1         = new Toast(attr);
            toast2_1.Message = "Style parameter construction";
            toast2_1.Post(NUIApplication.GetDefaultWindow());

            // Create Buttons
            CreateBoardAndButtons();
        }
Beispiel #3
0
        private Slider CreateByProperty(int posX, int posY, int w, int h, int curValue, Slider.DirectionType dir)
        {
            Slider source = new Slider();

            source.TrackThickness = 4;
            source.Style.Track.BackgroundColor    = new Color(0, 0, 0, 0.1f);
            source.Style.Progress.BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1);
            source.Style.Thumb.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",
            };
            source.Style.Thumb.Size            = new Size(60, 60);
            source.Style.Thumb.BackgroundImage = new Selector <string>
            {
                Normal  = "",
                Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_effect.png",
            };
            source.Direction = dir;
            root.Add(source);
            source.Focusable             = true;
            source.MinValue              = MIN_VALUE;
            source.MaxValue              = MAX_VALUE;
            source.StateChangedEvent    += OnStateChanged;
            source.ValueChangedEvent    += OnValueChanged;
            source.SlidingFinishedEvent += OnSlidingFinished;

            source.Position2D   = new Position2D(posX, posY);
            source.Size2D       = new Size2D(w, h);
            source.CurrentValue = curValue;
            return(source);
        }
Beispiel #4
0
        private void InitSliders()
        {
            // Null style construction
            slider_null_style[0] = CreateByProperty(800, 50, 20, Slider.DirectionType.Horizontal);
            slider_null_style[1] = CreateByProperty(800, 50, 30, Slider.DirectionType.Horizontal);
            slider_null_style[1].LowIndicatorTextContent = "SubText";
            slider_null_style[1].LowIndicatorSize        = new Size(100, 40);
            slider_null_style[2] = CreateByProperty(50, 400, 20, Slider.DirectionType.Vertical);
            slider_null_style[3] = CreateByProperty(50, 400, 30, Slider.DirectionType.Vertical);
            slider_null_style[3].LowIndicatorTextContent = "SubText";
            slider_null_style[3].LowIndicatorSize        = new Size(100, 40);

            // Style construction
            SliderStyle st = 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",
                    }
                }
            };

            slider_style[0] = CreateByStyle(st, 800, 50, 20, Slider.DirectionType.Horizontal);
            slider_style[1] = CreateByStyle(st, 800, 50, 30, Slider.DirectionType.Horizontal);
            slider_style[1].LowIndicatorTextContent = "SubText";
            slider_style[1].LowIndicatorSize        = new Size(100, 40);
            slider_style[2] = CreateByStyle(st, 50, 400, 20, Slider.DirectionType.Vertical);
            slider_style[3] = CreateByStyle(st, 50, 400, 30, Slider.DirectionType.Vertical);
            slider_style[3].LowIndicatorTextContent = "SubText";
            slider_style[3].LowIndicatorSize        = new Size(100, 40);
        }
Beispiel #5
0
        private void CreateButtonView()
        {
            // Init parent of ButtonView
            parentView[2]        = new View();
            parentView[2].Size   = new Size(1920, 200);
            parentView[2].Layout = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Horizontal, LinearAlignment = LinearLayout.Alignment.Center, CellPadding = new Size2D(100, 0)
            };
            root.Add(parentView[2]);

            // Create Buttons
            var buttonStyle = new ButtonStyle()
            {
                Size    = new Size(300, 80),
                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)
                    },
                    PointSize = 18,
                },
                BackgroundImage       = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png",
                BackgroundImageBorder = new Rectangle(5, 5, 5, 5),
            };

            // Button of switching mode
            button                = new Button(buttonStyle);
            button.Size           = new Size(500, 80);
            button.TextLabel.Text = mode[index];
            button.Clicked       += ButtonClicked;
            parentView[2].Add(button);

            // Button of LayoutDirection
            button2                = new Button(buttonStyle);
            button2.Size           = new Size(500, 80);
            button2.TextLabel.Text = "LayoutDirection is left to right";
            button2.Clicked       += ButtonClicked2;
            parentView[2].Add(button2);
        }
Beispiel #6
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

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

            CreateBoardAndButtons();
            string[] imageArray = new string[36];
            for (int i = 0; i < 36; i++)
            {
                if (i < 10)
                {
                    imageArray[i] = CommonResource.GetFHResourcePath() + "9. Controller/Loading Sequence_Native/loading_0" + i + ".png";
                }
                else
                {
                    imageArray[i] = CommonResource.GetFHResourcePath() + "9. Controller/Loading Sequence_Native/loading_" + i + ".png";
                }
            }

            loading1_1            = new Loading();
            loading1_1.Position2D = new Position2D(100, 350);
            loading1_1.Size2D     = new Size2D(100, 100);

            loading1_1.Images = imageArray;
            root.Add(loading1_1);

            LoadingStyle style = new LoadingStyle
            {
                Images = imageArray
            };

            loading2_1            = new Loading(style);
            loading2_1.Position2D = new Position2D(500, 350);
            loading2_1.Size2D     = new Size2D(100, 100);
            root.Add(loading2_1);

            window.Add(root);

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

            ///////////////////////////////////////////////Create by Properties//////////////////////////////////////////////////////////
            pagination1                   = new Pagination();
            pagination1.Name              = "Pagination1";
            pagination1.Position2D        = new Position2D(500, 450);
            pagination1.Size2D            = new Size2D(400, 30);
            pagination1.BackgroundColor   = new Color(1.0f, 1.0f, 1.0f, 0.6f);
            pagination1.IndicatorSize     = new Size(26, 26);
            pagination1.IndicatorImageURL = new Selector <string>()
            {
                Normal   = CommonResource.GetFHResourcePath() + "9. Controller/pagination_ic_nor.png",
                Selected = CommonResource.GetFHResourcePath() + "9. Controller/pagination_ic_sel.png",
            };
            pagination1.IndicatorSpacing = 8;
            pagination1.IndicatorCount   = PAGE_COUNT;
            pagination1.SelectedIndex    = 0;
            window.Add(pagination1);

            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            PaginationStyle style = new PaginationStyle();

            style.IndicatorSize     = new Size(15, 15);
            style.IndicatorImageURL = new Selector <string>()
            {
                Normal   = CommonResource.GetTVResourcePath() + "component/c_pagination/c_paganation_medium_dot_normal.png",
                Selected = CommonResource.GetTVResourcePath() + "component/c_pagination/c_paganation_medium_dot_focus.png",
            };
            style.IndicatorSpacing      = 14;
            pagination2                 = new Pagination(style);
            pagination2.Name            = "Pagination2";
            pagination2.Position2D      = new Position2D(500, 500);
            pagination2.Size2D          = new Size2D(400, 30);
            pagination2.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f);
            pagination2.IndicatorCount  = PAGE_COUNT;
            pagination2.SelectedIndex   = 0;
            window.Add(pagination2);

            window.KeyEvent += Window_KeyEvent;
        }
Beispiel #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)
            };
            window.Add(root);

            gridLayout = new View()
            {
                Position = new Position(400, 200),
                Size     = new Size(1920, 1080)
            };
            gridLayout.Layout = new GridLayout()
            {
                Rows            = 4,
                GridOrientation = GridLayout.Orientation.Horizontal,
            };
            //parent.Layout.Measure(new MeasureSpecification(new LayoutLength(1000), MeasureSpecification.ModeType.Exactly), new MeasureSpecification(new LayoutLength(780), MeasureSpecification.ModeType.Exactly));
            root.Add(gridLayout);

            imageArray = new string[36];
            for (int i = 0; i < 36; i++)
            {
                if (i < 10)
                {
                    imageArray[i] = CommonResource.GetFHResourcePath() + "9. Controller/Loading Sequence_Native/loading_0" + i + ".png";
                }
                else
                {
                    imageArray[i] = CommonResource.GetFHResourcePath() + "9. Controller/Loading Sequence_Native/loading_" + i + ".png";
                }
            }

            CreatePropLayout();
            CreateAttrLayout();
        }
Beispiel #9
0
        private Slider CreateByProperty(int w, int h, int curValue, Slider.DirectionType dir)
        {
            // Setting the property of selector is not supported now, so add these in style first.
            SliderStyle st = new SliderStyle
            {
                Thumb = new ImageViewStyle()
                {
                    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  = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_normal.png",
                        Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_effect.png",
                    }
                }
            };
            Slider source = new Slider(st);

            source.TrackThickness     = 5;
            source.ThumbSize          = new Size(60, 60);
            source.BgTrackColor       = new Color(0, 0, 0, 0.1f);
            source.SlidedTrackColor   = new Color(0.05f, 0.63f, 0.9f, 1);
            source.Direction          = dir;
            source.Focusable          = true;
            source.FocusableInTouch   = true;
            source.MinValue           = MIN_VALUE;
            source.MaxValue           = MAX_VALUE;
            source.StateChangedEvent += OnStateChanged;
            source.ValueChanged      += OnValueChanged;
            source.SlidingStarted    += OnSlidingStarted;
            source.SlidingFinished   += OnSlidingFinished;
            source.Size         = new Size(w, h);
            source.CurrentValue = curValue;
            return(source);
        }
Beispiel #10
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]);
        }
Beispiel #11
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;
        }
Beispiel #12
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            //ImageView imageView1 = new ImageView();
            //imageView1.Size2D = new Size2D(48, 48);
            //imageView1.Position2D = new Position2D(200, 200);
            //imageView1.ResourceUrl = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check.png";
            //window.Add(imageView1);

            //ImageView imageView2 = new ImageView();
            //imageView2.Size2D = new Size2D(48, 48);
            //imageView2.Position2D = new Position2D(500, 200);
            //imageView2.ResourceUrl = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_24c447.png";
            //window.Add(imageView2);

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

            textButton = new Button();
            textButton.Style.BackgroundImage       = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            textButton.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
            textButton.Size2D          = new Size2D(300, 80);
            textButton.Position2D      = new Position2D(100, 100);
            textButton.Style.Text.Text = "Button";
            root.Add(textButton);

            iconButton = new Button();
            iconButton.Style.BackgroundImage       = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            iconButton.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
            iconButton.Size2D                 = new Size2D(100, 100);
            iconButton.Position2D             = new Position2D(600, 100);
            iconButton.Style.Icon.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_radiobutton/c_radiobutton_white_check.png";
            root.Add(iconButton);

            iconTextButton = new Button();
            iconTextButton.Style.BackgroundImage       = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            iconTextButton.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
            iconTextButton.IconRelativeOrientation     = Button.IconOrientation.Left;
            iconTextButton.Style.Icon.ResourceUrl      = CommonResource.GetTVResourcePath() + "component/c_radiobutton/c_radiobutton_white_check.png";
            iconTextButton.Style.IconPadding.Top       = 20;
            iconTextButton.Style.IconPadding.Bottom    = 20;
            iconTextButton.Style.IconPadding.Start     = 20;
            iconTextButton.Style.IconPadding.End       = 20;
            iconTextButton.Style.Text.Text             = "IconTextButton";
            iconTextButton.Style.TextPadding.Top       = 20;
            iconTextButton.Style.TextPadding.Bottom    = 20;
            iconTextButton.Style.TextPadding.Start     = 20;
            iconTextButton.Style.TextPadding.End       = 50;
            iconTextButton.Size2D     = new Size2D(500, 300);
            iconTextButton.Position2D = new Position2D(900, 100);
            root.Add(iconTextButton);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            utilityBasicButton = new Button();
            utilityBasicButton.IsSelectable                = true;
            utilityBasicButton.Style.BackgroundImage       = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png";
            utilityBasicButton.Style.BackgroundImageBorder = new Rectangle(5, 5, 5, 5);
            utilityBasicButton.Style.ImageShadow           = new ImageShadow
            {
                Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                Border = new Rectangle(5, 5, 5, 5)
            };
            utilityBasicButton.Style.Overlay.ResourceUrl = new Selector <string>
            {
                Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png",
                Other   = ""
            };
            utilityBasicButton.Style.Overlay.Border = new Rectangle(5, 5, 5, 5);

            utilityBasicButton.Style.Text.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)
            };

            utilityBasicButton.Size2D               = new Size2D(300, 80);
            utilityBasicButton.Position2D           = new Position2D(XBase, 300);
            utilityBasicButton.Style.Text.PointSize = 20;
            utilityBasicButton.Style.Text.Text      = "UtilityBasicButton";
            utilityBasicButton.IsEnabled            = false;
            root.Add(utilityBasicButton);

            /////////////////////////////////////////////////////////////////////////////////////////////////////////
            utilityServiceButton = new Button();
            utilityServiceButton.Style.BackgroundImage       = CommonResource.GetFHResourcePath() + "3. Button/rectangle_point_btn_normal.png";
            utilityServiceButton.Style.BackgroundImageBorder = new Rectangle(5, 5, 5, 5);
            utilityServiceButton.Style.ImageShadow           = new ImageShadow
            {
                Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                Border = new Rectangle(5, 5, 5, 5)
            };
            utilityServiceButton.Style.Overlay.ResourceUrl = new Selector <string>
            {
                Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png",
                Other   = ""
            };
            utilityServiceButton.Style.Overlay.Border = new Rectangle(5, 5, 5, 5);
            utilityServiceButton.Style.Text.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)
            };

            utilityServiceButton.Size2D               = new Size2D(300, 80);
            utilityServiceButton.Position2D           = new Position2D(XBase, 500);
            utilityServiceButton.Style.Text.PointSize = 20;
            utilityServiceButton.Style.Text.Text      = "ServiceBasicButton";
            root.Add(utilityServiceButton);
            /////////////////////////////////////////////////////////////////////////////////////////////////////////
            utilityToggleButton = new Button();
            utilityToggleButton.IsSelectable          = true;
            utilityToggleButton.Style.BackgroundImage = new Selector <string>
            {
                Normal   = CommonResource.GetFHResourcePath() + "3. Button/rectangle_toggle_btn_normal.png",
                Selected = CommonResource.GetFHResourcePath() + "3. Button/rectangle_point_btn_normal.png",
            };

            utilityToggleButton.Style.BackgroundImageBorder = new Rectangle(5, 5, 5, 5);
            utilityToggleButton.Style.ImageShadow           = new ImageShadow
            {
                Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                Border = new Rectangle(5, 5, 5, 5)
            };
            utilityToggleButton.Style.Overlay.ResourceUrl = new Selector <string>
            {
                Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png",
                Other   = ""
            };
            utilityToggleButton.Style.Overlay.Border = new Rectangle(5, 5, 5, 5);


            utilityToggleButton.Style.Text.TextColor = new Selector <Color>
            {
                Normal   = new Color(0.058f, 0.631f, 0.92f, 1),
                Selected = new Color(1, 1, 1, 1),
            };

            utilityToggleButton.Size2D               = new Size2D(300, 80);
            utilityToggleButton.Position2D           = new Position2D(XBase, 700);
            utilityToggleButton.Style.Text.PointSize = 20;
            utilityToggleButton.Style.Text.Text      = new Selector <string>
            {
                Normal   = "Toggle Off",
                Selected = "Toggle On"
            };
            root.Add(utilityToggleButton);
            /////////////////////////////////////////////////////////////////////////////////////////////////////////
            utilityOvalButton = new Button();
            utilityOvalButton.IsSelectable          = true;
            utilityOvalButton.Style.BackgroundImage = new Selector <string>
            {
                Normal   = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_normal.png",
                Selected = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_select.png",
            };
            utilityOvalButton.Style.BackgroundImageBorder = new Rectangle(5, 5, 5, 5);
            utilityOvalButton.Style.ImageShadow           = new ImageShadow
            {
                Url    = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_shadow.png",
                Border = new Rectangle(5, 5, 5, 5)
            };
            utilityOvalButton.Style.Overlay.ResourceUrl = new Selector <string>
            {
                Pressed = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_press_overlay.png",
                Other   = ""
            };
            utilityOvalButton.Style.Overlay.Border = new Rectangle(5, 5, 5, 5);

            utilityOvalButton.Size2D               = new Size2D(104, 104);
            utilityOvalButton.Position2D           = new Position2D(XBase, 900);
            utilityOvalButton.Style.Text.PointSize = 20;
            root.Add(utilityOvalButton);

            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            ButtonStyle familyBasicButtonAttributes = 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
                {
                    Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                    Border = 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),
                    },
                }
            };

            familyBasicButton                      = new Button(familyBasicButtonAttributes);
            familyBasicButton.Size2D               = new Size2D(300, 80);
            familyBasicButton.Position2D           = new Position2D(XBase + XPadding, 300);
            familyBasicButton.Style.Text.PointSize = 20;
            familyBasicButton.Style.Text.Text      = "FamilyBasicButton";
            root.Add(familyBasicButton);

            //////////////////////////////////////////////////////////////////////////////////////////////////
            ButtonStyle familyServiceButtonAttributes = 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
                {
                    Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                    Border = 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),
                    },
                }
            };

            familyServiceButton                      = new Button(familyServiceButtonAttributes);
            familyServiceButton.Size2D               = new Size2D(300, 80);
            familyServiceButton.Position2D           = new Position2D(XBase + XPadding, 500);
            familyServiceButton.Style.Text.PointSize = 20;
            familyServiceButton.Style.Text.Text      = "FamilySeviceButton";
            root.Add(familyServiceButton);
            //////////////////////////////////////////////////////////////////////////////////////////////////
            ButtonStyle familyToggleButtonAttributes = 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
                {
                    Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                    Border = 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),
                    },
                }
            };

            familyToggleButton                      = new Button(familyToggleButtonAttributes);
            familyToggleButton.Size2D               = new Size2D(300, 80);
            familyToggleButton.Position2D           = new Position2D(XBase + XPadding, 700);
            familyToggleButton.Style.Text.PointSize = 20;
            familyToggleButton.Style.Text.Text      = new Selector <string>
            {
                Normal   = "Toggle Off",
                Selected = "Toggle On"
            };
            root.Add(familyToggleButton);
            //////////////////////////////////////////////////////////////////////////////////////////////////
            ButtonStyle familyOvalButtonAttributes = 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
                {
                    Url    = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_shadow.png",
                    Border = 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(familyOvalButtonAttributes);
            familyOvalButton.Size2D               = new Size2D(104, 104);
            familyOvalButton.Position2D           = new Position2D(XBase + XPadding, 900);
            familyOvalButton.Style.Text.PointSize = 20;
            root.Add(familyOvalButton);
        }
Beispiel #13
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);
        }
Beispiel #14
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;
        }
        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;
        }
Beispiel #16
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);
            }
Beispiel #17
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++)
            {
                int index = i + 1;

                // create utility radio button.
                utilityRadioButton[i] = new RadioButton();
                utilityRadioButton[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
                {
                    global::System.Console.WriteLine($"Left {index}th Utility RadioButton's IsSelected is changed to {args.IsSelected}.");
                };
                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();
                familyRadioButton[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
                {
                    global::System.Console.WriteLine($"Left {index}th Family RadioButton's IsSelected is changed to {args.IsSelected}.");
                };
                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();
                foodRadioButton[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
                {
                    global::System.Console.WriteLine($"Left {index}th Food RadioButton's IsSelected is changed to {args.IsSelected}.");
                };
                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();
                kitchenRadioButton[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
                {
                    global::System.Console.WriteLine($"Left {index}th Kitchen RadioButton's IsSelected is changed to {args.IsSelected}.");
                };
                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++)
            {
                int index = i + 1;

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

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

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

                kitchenRadioButton2[i] = new RadioButton(kitchenStyle2);
                kitchenRadioButton2[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
                {
                    global::System.Console.WriteLine($"Right {index}th Kitchen RadioButton's IsSelected is changed to {args.IsSelected}.");
                };
                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;
        }
Beispiel #18
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);
        }
Beispiel #19
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;
        }
Beispiel #20
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
            {
                Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                Border = 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
            {
                Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                Border = 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
            {
                Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                Border = 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
            {
                Url    = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_shadow.png",
                Border = 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
                {
                    Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                    Border = 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
                {
                    Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                    Border = 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
                {
                    Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                    Border = 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
                {
                    Url    = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_shadow.png",
                    Border = 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);
        }
Beispiel #21
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;
        }
Beispiel #22
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++)
            {
                //Create utility radio button.
                utilityCheckBox[i] = new CheckBox();
                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();
                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();
                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();
                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++)
            {
                utilityCheckBox2[i]        = new CheckBox(utilityStyle2);
                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].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].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].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;
        }
Beispiel #23
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
        }
Beispiel #24
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);
        }
Beispiel #25
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);
        }