コード例 #1
0
 public Switch(SwitchState state = SwitchState.Off, SwitchStyle style = SwitchStyle.Default, SwitchSize size = SwitchSize.Default) : base(CGRect.Empty)
 {
     //TrackLayer = new CAShapeLayer();
     //Button = new FabButton();
     prepareTrack();
     prepareButton();
     prepareSwitchSize(size);
     prepareSwitchStyle(style);
     prepareSwitchState(state);
 }
コード例 #2
0
ファイル: SwitchExample.cs プロジェクト: wonrst/TizenFX
        private void CreateSwitchView()
        {
            // Create switch styles
            SwitchStyle styleTest = new SwitchStyle
            {
                Size         = new Size(100, 100),
                IsSelectable = true,
                Track        = new ImageViewStyle
                {
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = path + "/switch/controller_switch_bg_off.png",
                        Selected         = path + "/switch/controller_switch_bg_on.png",
                        Disabled         = path + "/switch/controller_switch_bg_off_dim.png",
                        DisabledSelected = path + "/switch/controller_switch_bg_on_dim.png",
                    },
                    Size   = new Size(200, 100),
                    Border = new Rectangle(30, 30, 30, 30),
                },
                Thumb = new ImageViewStyle
                {
                    Size        = new Size(100, 100),
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = path + "/switch/controller_switch_handler.png",
                        Selected         = path + "/switch/controller_switch_handler.png",
                        Disabled         = path + "/switch/controller_switch_handler_dim.png",
                        DisabledSelected = path + "/switch/controller_switch_handler_dim.png",
                    },
                },
            };

            // Create by Property
            for (int i = 0; i < 4; i++)
            {
                switchTest[i] = new Switch();
                switchTest[i].ApplyStyle(styleTest);
                switchTest[i].Size   = new Size(200, 100);
                switchTest[i].Margin = new Extents(10, 10, 10, 10);
#if PROFILE_MOBILE
                switchTest[i].Feedback = true;
#endif
                rootContent.Add(switchTest[i]);
            }
            switchTest[2].IsEnabled  = false;
            switchTest[3].IsSelected = true;
        }
コード例 #3
0
        public void SlidingSwitchExtensionOnSelectedChanged()
        {
            tlog.Debug(tag, $"SlidingSwitchExtensionOnSelectedChanged START");

            var testingTarget = new MySlidingSwitchExtension();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <MySlidingSwitchExtension>(testingTarget, "Should return SlidingSwitchExtension instance.");

            SwitchStyle style = new SwitchStyle()
            {
                Track = new ImageViewStyle()
                {
                    BackgroundImage = image_path,
                },
                Thumb = new ImageViewStyle()
                {
                    BackgroundImage = image_path,
                },
            };

            using (Switch button = new Switch(style))
            {
                Window.Instance.Add(button);

                try
                {
                    testingTarget.MyOnSelectedChanged(button);
                }
                catch (Exception e)
                {
                    tlog.Debug(tag, e.Message.ToString());
                    Assert.Fail("Caught Exception : Failed!");
                }
            }

            testingTarget.MyDispose(true);
            tlog.Debug(tag, $"SlidingSwitchExtensionOnSelectedChanged END (OK)");
        }
コード例 #4
0
ファイル: SwitchSample.cs プロジェクト: walac/NUIPreview
        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;
        }
コード例 #5
0
        public void Activate()
        {
            Window window = Window.Instance;

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

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

            int num = 4;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            utilitySwitch2[3].IsEnabled  = false;
            familySwitch2[3].IsEnabled   = false;
            foodSwitch2[3].IsEnabled     = false;
            kitchenSwitch2[3].IsEnabled  = false;
            utilitySwitch2[3].IsSelected = true;
            familySwitch2[3].IsSelected  = true;
            foodSwitch2[3].IsSelected    = true;
            kitchenSwitch2[3].IsSelected = true;
        }
コード例 #6
0
 private void prepareSwitchStyle(SwitchStyle style)
 {
     SwitchStyle = style;
 }