/// <summary>
        /// Dispose popup
        /// </summary>
        public void Deactivate()
        {
            Window.Instance.GetDefaultLayer().Remove(guide);
            guide.Dispose();
            guide = null;

            Window.Instance.GetDefaultLayer().Remove(userGuide);
            userGuide.Dispose();
            userGuide = null;

            Window.Instance.GetDefaultLayer().Remove(popupButton);
            popupButton.Dispose();
            popupButton = null;
        }
        /// <summary>
        /// Dispose toggle.
        /// </summary>
        public void Deactivate()
        {
            Window.Instance.GetDefaultLayer().Remove(guide);
            guide.Dispose();
            guide = null;

            Window.Instance.GetDefaultLayer().Remove(userGuide);
            userGuide.Dispose();
            userGuide = null;

            Window.Instance.GetDefaultLayer().Remove(toggle);
            toggle.Dispose();
            toggle = null;
        }
Exemple #3
0
        /// <summary>
        /// PushButton initialisation.
        /// </summary>
        /// <param name="text">text</param>
        private void OnIntialize(string text)
        {
            _pushbutton                 = new Tizen.NUI.Components.Button();
            _pushbutton.Focusable       = true;
            _pushbutton.Size2D          = new Size2D(300, 80);
            _pushbutton.Focusable       = true;
            _pushbutton.ParentOrigin    = ParentOrigin.TopLeft;
            _pushbutton.PivotPoint      = PivotPoint.TopLeft;
            _pushbutton.Text            = text;
            _pushbutton.TextColor       = Color.White;
            _pushbutton.BackgroundImage = normalImagePath;

            // Chang background Visual and Label when focus gained.
            _pushbutton.FocusGained += (obj, e) =>
            {
                _pushbutton.BackgroundImage = focusImagePath;
                _pushbutton.TextColor       = Color.Black;
            };

            // Chang background Visual and Label when focus lost.
            _pushbutton.FocusLost += (obj, e) =>
            {
                _pushbutton.BackgroundImage = normalImagePath;
                _pushbutton.TextColor       = Color.White;
            };

            // Chang background Visual when pressed.
            _pushbutton.KeyEvent += (obj, ee) =>
            {
                if ("Return" == ee.Key.KeyPressedName)
                {
                    if (Key.StateType.Down == ee.Key.State)
                    {
                        _pushbutton.BackgroundImage = pressImagePath;
                        Tizen.Log.Fatal("NUI", "Press in pushButton sample!!!!!!!!!!!!!!!!");
                    }
                    else if (Key.StateType.Up == ee.Key.State)
                    {
                        _pushbutton.BackgroundImage = focusImagePath;
                        Tizen.Log.Fatal("NUI", "Release in pushButton sample!!!!!!!!!!!!!!!!");
                    }
                }

                return(false);
            };
        }
        /// <summary>
        /// RadioButton initialisation.
        /// </summary>
        private void Initialize()
        {
            Window.Instance.BackgroundColor = Color.Black;

            guide = new TextLabel();
            guide.HorizontalAlignment    = HorizontalAlignment.Center;
            guide.VerticalAlignment      = VerticalAlignment.Center;
            guide.PositionUsesPivotPoint = true;
            guide.ParentOrigin           = ParentOrigin.TopLeft;
            guide.PivotPoint             = PivotPoint.TopLeft;
            guide.Size2D     = new Size2D(1920, 96);
            guide.FontFamily = "Samsung One 600";
            guide.Position2D = new Position2D(0, 94);
            guide.MultiLine  = false;
            //guide.PointSize = 15.0f;
            guide.PointSize = DeviceCheck.PointSize15;
            guide.Text      = "Toggle Sample \n";
            guide.TextColor = Color.White;
            //guide.BackgroundColor = new Color(43.0f / 255.0f, 145.0f / 255.0f, 175.0f / 255.0f, 1.0f);
            Window.Instance.GetDefaultLayer().Add(guide);

            userGuide = new TextLabel();
            userGuide.HorizontalAlignment    = HorizontalAlignment.Begin;
            userGuide.VerticalAlignment      = VerticalAlignment.Top;
            userGuide.PositionUsesPivotPoint = true;
            userGuide.ParentOrigin           = ParentOrigin.TopLeft;
            userGuide.PivotPoint             = PivotPoint.TopLeft;
            userGuide.FontFamily             = "Samsung One 400";
            userGuide.Position  = new Position(200, 275, 0);
            userGuide.MultiLine = true;
            //userGuide.PointSize = 10.0f;
            userGuide.PointSize = DeviceCheck.PointSize10;
            userGuide.Text      = "Please press Enter key to switch the ON/OFF state.\n";
            userGuide.TextColor = Color.White;
            Window.Instance.GetDefaultLayer().Add(userGuide);

            Toggle toggleSample = new Toggle();

            toggle          = toggleSample.GetToggleButton();
            toggle.Position = new Position(884, 540, 0);
            Window.Instance.GetDefaultLayer().Add(toggle);
            FocusManager.Instance.SetCurrentFocusView(toggle);
        }
Exemple #5
0
        private View CreateListItem(int imageIndex, string text, bool toggle)
        {
            LinearLayout linearLayout = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Horizontal,
            };

            View listItem = new View()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.WrapContent,
                Layout  = linearLayout,
                Padding = new Extents(5, 5, 40, 40),
                Name    = "flexibleLayout-entry-" + text,
            };

            TextLabel textLabel = new TextLabel()
            {
                Text       = text,
                Name       = "flexibleLayout-text-label-" + text,
                Margin     = new Extents(90, 0, 0, 0),
                TextColor  = new Color(0.6f, 0.6f, 0.6f, 1),
                PointSize  = 38,
                FontFamily = "SamsungOneUI 500C",
            };

            if (imageIndex >= 0)
            {
                ImageView icon = new ImageView(applicationIconsArray[imageIndex]);
                listItem.Add(icon);
            }

            listItem.Add(textLabel);

            if (toggle)
            {
                Tizen.NUI.Components.ButtonStyle buttonStyle = new Tizen.NUI.Components.ButtonStyle
                {
                    Icon = new ImageViewStyle
                    {
                        ResourceUrl = new Tizen.NUI.Components.StringSelector
                        {
                            Normal   = this.DirectoryInfo.Resource + TestImages.iconImage[2],
                            Selected = this.DirectoryInfo.Resource + TestImages.iconImage[1]
                        },
                    },
                    IsSelectable = true,
                };

                Tizen.NUI.Components.Button toggleButton = new Tizen.NUI.Components.Button(buttonStyle)
                {
                    Name   = "toggleButton",
                    Size2D = new Size2D(90, 30),
                };

                listItem.Add(toggleButton);
            }


            return(listItem);
        }
        /// <summary>
        /// Popup initialisation.
        /// </summary>
        private void Initialize()
        {
            Window.Instance.BackgroundColor = Color.Black;

            guide = new TextLabel();
            guide.HorizontalAlignment    = HorizontalAlignment.Center;
            guide.VerticalAlignment      = VerticalAlignment.Center;
            guide.PositionUsesPivotPoint = true;
            guide.ParentOrigin           = ParentOrigin.TopLeft;
            guide.PivotPoint             = PivotPoint.TopLeft;
            guide.Size2D     = new Size2D(1920, 96);
            guide.FontFamily = "Samsung One 600";
            guide.Position2D = new Position2D(0, 94);
            guide.MultiLine  = false;
            //guide.PointSize = 15.0f;
            guide.PointSize = DeviceCheck.PointSize15;
            guide.Text      = "Popup Sample \n";
            guide.TextColor = Color.White;
            //guide.BackgroundColor = new Color(43.0f / 255.0f, 145.0f / 255.0f, 175.0f / 255.0f, 1.0f);
            Window.Instance.GetDefaultLayer().Add(guide);

            userGuide = new TextLabel();
            userGuide.HorizontalAlignment    = HorizontalAlignment.Begin;
            userGuide.VerticalAlignment      = VerticalAlignment.Top;
            userGuide.PositionUsesPivotPoint = true;
            userGuide.ParentOrigin           = ParentOrigin.TopLeft;
            userGuide.PivotPoint             = PivotPoint.TopLeft;
            userGuide.FontFamily             = "Samsung One 400";
            userGuide.Position  = new Position(200, 200, 0);
            userGuide.MultiLine = true;
            //userGuide.PointSize = 10.0f;
            userGuide.PointSize = DeviceCheck.PointSize10;
            userGuide.Text      = "Press Enter key to show the popup.\n";
            userGuide.TextColor = Color.White;
            Window.Instance.GetDefaultLayer().Add(userGuide);

            Popups popupSample = new Popups();

            popup = popupSample.GetPopup();
            popup.VisibilityChanged += (obj, e) =>
            {
                if (e.Visibility)
                {
                    bool flag = Window.Instance.UngrabKey(166);
                    Tizen.Log.Fatal("UISample", "Ungrab key: " + flag);
                }
                else
                {
                    Tizen.Log.Fatal("UISample", "Grab key: ");
                    Window.Instance.GrabKey(166, Window.KeyGrabMode.Topmost);
                }
            };
            Window.Instance.GetDefaultLayer().Add(popup);

            Button pushSample = new Button("PopupButton");

            popupButton          = pushSample.GetPushButton();
            popupButton.Position = new Position(810, 500, 0); //300, 80
            Window.Instance.GetDefaultLayer().Add(popupButton);
            popupButton.KeyEvent += (obj, e) =>
            {
                if (e.Key.State == Key.StateType.Up)
                {
                    popup.Show();
                    FocusManager.Instance.SetCurrentFocusView(popup.FindChildByName("OKButton"));
                }
                return(true);
            };

            FocusManager.Instance.SetCurrentFocusView(popupButton);
        }