Пример #1
0
        /// <summary>
        /// Create the okButton
        /// </summary>
        /// <returns>
        /// The created okButton.
        /// </returns>
        Tizen.NUI.Components.Button CreateCancelButton()
        {
            Button cancelSample = new Button("Cancel");

            cancelButton = cancelSample.GetPushButton();

            // Hide popup.
            cancelButton.ClickEvent += (obj, ee) =>
            {
                _popup.Hide();
            };

            // Move focus to okayButton.
            cancelButton.KeyEvent += (obj, e) =>
            {
                if (e.Key.KeyPressedName == "Left" && Key.StateType.Down == e.Key.State)
                {
                    FocusManager.Instance.SetCurrentFocusView(okayButton);
                }

                return(false);
            };

            return(cancelButton);
        }
Пример #2
0
        public override View Run()
        {
            var view = new View
            {
                Layout = new LinearLayout
                {
                    LinearAlignment   = LinearLayout.Alignment.Center,
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                }
            };
            var menu = new View
            {
                Layout = new LinearLayout
                {
                    LinearOrientation = LinearLayout.Orientation.Horizontal
                },
                SizeHeight         = 200,
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.Green.ToNative()
            };

            view.Add(menu);


            var scrollView = new ScrollView()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
            };

            int itemWidth  = 300;
            int itemHeight = 300;
            int itemCols   = 10;
            int itemRows   = 10;

            var outterLayout = new View
            {
                Layout = new LinearLayout
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                },
                SizeWidth  = itemWidth * itemCols,
                SizeHeight = itemHeight * itemRows
            };

            scrollView.Add(outterLayout);

            for (int i = 0; i < itemRows; i++)
            {
                var innerLayout = new View
                {
                    Layout = new LinearLayout
                    {
                        LinearOrientation = LinearLayout.Orientation.Horizontal,
                    },
                    SizeHeight = itemHeight,
                    SizeWidth  = itemWidth * itemCols,
                };
                for (int j = 0; j < itemCols; j++)
                {
                    var rnd  = new Random();
                    var item = new View
                    {
                        SizeWidth       = itemWidth,
                        SizeHeight      = itemHeight,
                        BackgroundColor = Color.FromRgb(rnd.Next(10, 255), rnd.Next(10, 255), rnd.Next(10, 255)).ToNative()
                    };
                    innerLayout.Add(item);
                }
                outterLayout.Add(innerLayout);
            }
            scrollView.ScrollingEventThreshold = 1;
            scrollView.ScrollDragStarted      += (s, e) => Console.WriteLine($"DragStarted");
            scrollView.ScrollDragEnded        += (s, e) => Console.WriteLine("DragEnd");
            scrollView.ScrollAnimationStarted += (s, e) => Console.WriteLine($"ScrollAnimation started");
            scrollView.ScrollAnimationEnded   += (s, e) => Console.WriteLine("$ScrollAnimation ended");
            scrollView.Scrolling += (s, e) =>
            {
                Console.WriteLine($"OnScrolling : Bound : {scrollView.ScrollBound} - {e.Position.X}x{e.Position.Y}");
            };


            var direction = new Button()
            {
                Text       = "direction(V)",
                SizeHeight = 300,
                SizeWidth  = 300,
            };

            direction.Clicked += (s, e) =>
            {
                if (scrollView.ScrollOrientation == ScrollOrientation.Horizontal)
                {
                    scrollView.ScrollOrientation = ScrollOrientation.Vertical;
                    direction.Text = "direction(V)";
                }
                else
                {
                    scrollView.ScrollOrientation = ScrollOrientation.Horizontal;
                    direction.Text = "direction(H)";
                }
            };
            menu.Add(direction);

            var scrollBar = new Button()
            {
                Text       = "Bar(Never)",
                SizeHeight = 300,
                SizeWidth  = 300,
            };

            scrollBar.Clicked += (s, e) =>
            {
                if (scrollView.VerticalScrollBarVisibility == ScrollBarVisibility.Never)
                {
                    scrollView.VerticalScrollBarVisibility = ScrollBarVisibility.Default;
                    scrollBar.Text = "Bar(Default)";
                }
                else if (scrollView.VerticalScrollBarVisibility == ScrollBarVisibility.Default)
                {
                    scrollView.VerticalScrollBarVisibility = ScrollBarVisibility.Always;
                    scrollBar.Text = "Bar(Always)";
                }
                else if (scrollView.VerticalScrollBarVisibility == ScrollBarVisibility.Always)
                {
                    scrollView.VerticalScrollBarVisibility = ScrollBarVisibility.Never;
                    scrollBar.Text = "Bar(Never)";
                }
            };
            menu.Add(scrollBar);


            view.Add(scrollView);
            return(view);
        }
Пример #3
0
        public override View Run()
        {
            var view = new View
            {
                Layout = new LinearLayout
                {
                    LinearAlignment   = LinearLayout.Alignment.Center,
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                }
            };
            var menu = new View
            {
                Layout = new LinearLayout
                {
                    LinearOrientation = LinearLayout.Orientation.Horizontal
                },
                SizeHeight         = 200,
                WidthSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor    = Color.Green.ToNative()
            };

            view.Add(menu);


            var scrollView = new ScrollView()
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
            };

            int itemWidth  = 300;
            int itemHeight = 300;
            int itemCols   = 10;
            int itemRows   = 10;

            var outterLayout = new View
            {
                Layout = new LinearLayout
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                },
                SizeWidth  = itemWidth * itemCols,
                SizeHeight = itemHeight * itemRows
            };

            scrollView.Add(outterLayout);

            for (int i = 0; i < itemRows; i++)
            {
                var innerLayout = new View
                {
                    Layout = new LinearLayout
                    {
                        LinearOrientation = LinearLayout.Orientation.Horizontal,
                    },
                    SizeHeight = itemHeight,
                    SizeWidth  = itemWidth * itemCols,
                };
                for (int j = 0; j < itemCols; j++)
                {
                    var rnd  = new Random();
                    var item = new View
                    {
                        SizeWidth       = itemWidth,
                        SizeHeight      = itemHeight,
                        BackgroundColor = Color.FromRgb(rnd.Next(10, 255), rnd.Next(10, 255), rnd.Next(10, 255)).ToNative()
                    };
                    innerLayout.Add(item);
                }
                outterLayout.Add(innerLayout);
            }

            scrollView.Scrolling += (s, e) =>
            {
                Console.WriteLine($"OnScrolling : Bound : {scrollView.ScrollBound}");
            };


            var direction = new Button()
            {
                Text       = "direction(V)",
                SizeHeight = 300,
                SizeWidth  = 300,
            };

            direction.Clicked += (s, e) =>
            {
                if (scrollView.ScrollOrientation == ScrollOrientation.Horizontal)
                {
                    scrollView.ScrollOrientation = ScrollOrientation.Vertical;
                    direction.Text = "direction(V)";
                }
                else
                {
                    scrollView.ScrollOrientation = ScrollOrientation.Horizontal;
                    direction.Text = "direction(H)";
                }
            };
            menu.Add(direction);

            var scrollBar = new Button()
            {
                Text       = "Bar(X)",
                SizeHeight = 300,
                SizeWidth  = 300,
            };

            scrollBar.Clicked += (s, e) =>
            {
                if (scrollView.HideScrollbar)
                {
                    scrollView.HideScrollbar = false;
                    scrollBar.Text           = "Bar(O)";
                }
                else
                {
                    scrollView.HideScrollbar = true;
                    scrollBar.Text           = "Bar(X)";
                }
            };
            menu.Add(scrollBar);


            view.Add(scrollView);
            return(view);
        }
Пример #4
0
        /// <summary>
        /// Create the view be used to set popup.content.
        /// </summary>
        /// <returns>
        /// The created contentView.
        /// </returns>
        View CreateContent()
        {
            View contentView = new View();

            contentView.Size2D       = new Size2D(860, 486);
            contentView.ParentOrigin = ParentOrigin.TopLeft;
            contentView.PivotPoint   = PivotPoint.TopLeft;
            contentView.Position     = new Position(0, 0, 0);

            TextLabel titleView = new TextLabel("Information");

            titleView.FontFamily   = "Samsung One 600";
            titleView.TextColor    = Color.Black;
            titleView.ParentOrigin = ParentOrigin.TopLeft;
            titleView.PivotPoint   = PivotPoint.TopLeft;
            titleView.Position     = new Position(70, 65, 0);
            titleView.Size2D       = new Size2D(720, 70);
            titleView.MultiLine    = false;
            //titleView.PointSize = 10;
            titleView.PointSize           = DeviceCheck.PointSize10;
            titleView.HorizontalAlignment = HorizontalAlignment.Center;

            ImageView imageView = new ImageView(barImage);

            imageView.ParentOrigin = ParentOrigin.TopLeft;
            imageView.PivotPoint   = PivotPoint.TopLeft;
            imageView.Position     = new Position(70, 143, 0);
            imageView.Size2D       = new Size2D(720, 3);

            ImageView shadow = new ImageView(shadowImage);

            shadow.ParentOrigin = ParentOrigin.TopLeft;
            shadow.PivotPoint   = PivotPoint.TopLeft;
            shadow.Position     = new Position(70, 146, 0);
            shadow.Size2D       = new Size2D(720, 9);


            TextLabel contentLabel = new TextLabel("Do you want to erase this file Permanently?");

            contentLabel.FontFamily   = "Samsung One 400";
            contentLabel.TextColor    = Color.Black;
            contentLabel.ParentOrigin = ParentOrigin.TopLeft;
            contentLabel.PivotPoint   = PivotPoint.TopLeft;
            contentLabel.Position     = new Position(70, 204, 0);
            contentLabel.Size2D       = new Size2D(720, 120);
            contentLabel.MultiLine    = true;
            //contentLabel.PointSize = 8;
            contentLabel.PointSize           = DeviceCheck.PointSize8;
            contentLabel.HorizontalAlignment = HorizontalAlignment.Center;

            Tizen.NUI.Components.Button okButton = CreateOKButton();
            okButton.Position = new Position(120, 316, 0); //300, 80

            Tizen.NUI.Components.Button cancelButton = CreateCancelButton();
            cancelButton.Position = new Position(440, 316, 0); //300, 80

            contentView.Add(titleView);
            contentView.Add(imageView);
            contentView.Add(shadow);
            contentView.Add(contentLabel);
            contentView.Add(okButton);
            contentView.Add(cancelButton);
            return(contentView);
        }