Пример #1
0
        public override ReactElement Render()
        {
            var taAtt = new TextAreaAttributes {
                Style     = Style.Margin(5).Padding(5).FontSize(18).Width(500),
                ClassName = props.Titre.Value,
                Name      = props.Titre.Value,
                //Cols = 10,
                Wrap      = Html5.Wrap.Soft,
                Rows      = 5,
                MaxLength = 10,
                Value     = ListToString(props.ItemApi),
                OnChange  = e => props.OnChangeSTB(e.CurrentTarget.Value),
                Ref       = e => _element = e,
                //SelectionStart = _selStart,
                //SelectionEnd = _selEnd
            };

            var ti = new TextInput(
                disabled: props.Disabled,
                content: props.InputValueSTB.ToString(),
                onChange: e => props.OnChange(e),
                className: new NonBlankTrimmedString("Content")
                );

            var ba = new ButtonAttributes
            {
                Disabled = string.IsNullOrWhiteSpace(props.InputValueSTB.ToString()),
                OnClick  = e => props.OnSave()
                           //OnClick = async(e) =>
                           //{
                           //    props.OnSave();
                           //    await props.MessageApi.SaveMessage(iDelaiMsec: 1000);
                           //    _element.Select();
                           //    //ScrollToBottom();
                           //},
            };

            return
                (DOM.FieldSet(
                     new FieldSetAttributes {
                ClassName = props.Titre.Value
            },
                     DOM.Legend(null, props.Titre.Value), // ToDo : éviter saut de ligne
                     DOM.Span(new Attributes {
                ClassName = "label"
            }, "Add item : "),
                     ti,
                     DOM.TextArea(taAtt),
                     DOM.Button(ba, "Add")
                     ));
        }
Пример #2
0
        public override ReactElement Render()
        {
            var fa = new FieldSetAttributes {
                ClassName = props.ClassName
            };
            var lgd = DOM.Legend(null,
                                 string.IsNullOrWhiteSpace(
                                     props.Title + " : " + props.Content) ? "Untitled" :
                                 props.Title + " : " + props.Content);
            var la = new Attributes {
                ClassName = "label"
            };
            var tiTitle = new TextInput
                          (
                disabled: false,
                content: props.Title,
                onChange: e => props.OnChange(new MessageDetails(e, props.Content)),
                className: new NonBlankTrimmedString("Title")
                          );
            var tiContent = new TextInput
                            (
                disabled: false,
                content: props.Content,
                onChange: e => props.OnChange(new MessageDetails(props.Title, e)),
                className: new NonBlankTrimmedString("Content")
                            );
            var ba = new ButtonAttributes
            {
                Disabled = props.Disabled,
                OnClick  = e => props.OnSave()
            };

            return(DOM.FieldSet(
                       fa,
                       lgd,
                       DOM.Span(la, "Title"), tiTitle,
                       DOM.Span(la, "Content"), tiContent,
                       DOM.Button(ba, "Save")
                       ));
        }
 public ButtonAttributes this[ModButton button]
 {
     get
     {
         if (ButtonAttributes.TryGetValue(button, out var attributes))
         {
             return(attributes);
         }
         var path = GetButtonAttributesPath(button);
         if (File.Exists(path))
         {
             attributes        = Read <ButtonAttributes>(path);
             attributes.Button = button;
         }
         else
         {
             attributes = new ButtonAttributes(button);
         }
         ButtonAttributes.Add(button, attributes);
         return(attributes);
     }
 }
Пример #4
0
        public SampleLayout(bool isThemeButtonVisiable = true)
        {
            Size2D = new Size2D(Window.Instance.Size.Width, Window.Instance.Size.Height);
            //Window.Instance.Add(this);
            LayoutHeader = new Tizen.FH.NUI.Controls.Header("DefaultHeader");
            LayoutHeader.PositionY = 0;

            LayoutContent = new View
            {
                Size2D = new Size2D(Window.Instance.Size.Width, Window.Instance.Size.Height - 128),
                Position2D = new Position2D(0, 128),
            };

            Content = new View
            {
                Size2D = new Size2D(Window.Instance.Size.Width, Window.Instance.Size.Height - 128 - 150),
                Position2D = new Position2D(0, 150),
            };
            LayoutContent.Add(Content);

            if (isThemeButtonVisiable)
            {
                ButtonAttributes buttonAttributes = new ButtonAttributes
                {
                    IsSelectable = true,
                    BackgroundImageAttributes = new ImageAttributes
                    {
                        ResourceURL = new StringSelector { All = CommonResource.GetResourcePath() + "3. Button/rectangle_point_btn_normal.png" },
                        Border = new RectangleSelector { All = new Rectangle(5, 5, 5, 5) }
                    },

                    ShadowImageAttributes = new ImageAttributes
                    {
                        ResourceURL = new StringSelector { All = CommonResource.GetResourcePath() + "3. Button/rectangle_btn_shadow.png" },
                        Border = new RectangleSelector { All = new Rectangle(5, 5, 5, 5) }
                    },

                    OverlayImageAttributes = new ImageAttributes
                    {
                        ResourceURL = new StringSelector { Pressed = CommonResource.GetResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = "" },
                        Border = new RectangleSelector { All = new Rectangle(5, 5, 5, 5) },
                    },

                    TextAttributes = new TextAttributes
                    {
                        PointSize = new FloatSelector { All = 30 },
                        HorizontalAlignment = HorizontalAlignment.Center,
                        VerticalAlignment = VerticalAlignment.Center,
                        WidthResizePolicy = ResizePolicyType.FillToParent,
                        HeightResizePolicy = ResizePolicyType.FillToParent,

                        TextColor = new ColorSelector
                        {
                            All = new Color(0, 0, 0, 1),
                        },
                    }
                };

                UtilityButton = new Tizen.NUI.CommonUI.Button(buttonAttributes);
                UtilityButton.Size2D = new Size2D(200, 80);
                UtilityButton.Position2D = new Position2D(56, 32);
                UtilityButton.Text = "Utility";
                UtilityButton.ClickEvent += UtilityButton_ClickEvent;
                LayoutContent.Add(UtilityButton);

                buttonAttributes.BackgroundImageAttributes.ResourceURL.All = CommonResource.GetResourcePath() + "3. Button/[Button] App Primary Color/rectangle_point_btn_normal_ec7510.png";
                FoodButton = new Tizen.NUI.CommonUI.Button(buttonAttributes);
                FoodButton.Size2D = new Size2D(200, 80);
                FoodButton.Position2D = new Position2D(312, 32);
                FoodButton.Text = "Food";
                FoodButton.ClickEvent += FoodButton_ClickEvent;
                LayoutContent.Add(FoodButton);

                buttonAttributes.BackgroundImageAttributes.ResourceURL.All = CommonResource.GetResourcePath() + "3. Button/[Button] App Primary Color/rectangle_point_btn_normal_24c447.png";
                FamilyButton = new Tizen.NUI.CommonUI.Button(buttonAttributes);
                FamilyButton.Size2D = new Size2D(200, 80);
                FamilyButton.Position2D = new Position2D(578, 32);
                FamilyButton.Text = "Family";
                FamilyButton.ClickEvent += FamilyButton_ClickEvent;
                LayoutContent.Add(FamilyButton);

                buttonAttributes.BackgroundImageAttributes.ResourceURL.All = CommonResource.GetResourcePath() + "3. Button/[Button] App Primary Color/rectangle_point_btn_normal_9762d9.png";
                KitchenButton = new Tizen.NUI.CommonUI.Button(buttonAttributes);
                KitchenButton.Size2D = new Size2D(200, 80);
                KitchenButton.Position2D = new Position2D(834, 32);
                KitchenButton.Text = "Kitchen";
                KitchenButton.ClickEvent += KitchenButton_ClickEvent;
                LayoutContent.Add(KitchenButton);
            }

            this.isThemeButtonVisible = isThemeButtonVisiable;
            Window.Instance.Add(LayoutHeader);
            Window.Instance.Add(LayoutContent);

            //SampleMain.SampleNaviFrame.NaviFrameItemPush(LayoutHeader, LayoutContent);

            //this.ResourceUrl = CommonResource.GetResourcePath() + "0. BG/background_default_overlay.png";
        }
Пример #5
0
 public extern static ReactElement Button(ButtonAttributes properties, params ReactElementOrText[] children);