public override View Draw(FormMode Mode, NetworkMode Network)
        {
            if (TextMode == TextMode.MultiLine)
            {
                var textarea = new EbXTextArea()
                {
                    IsReadOnly       = this.ReadOnly,
                    XBackgroundColor = this.XBackground,
                    EnableFocus      = true,
                    BorderOnFocus    = App.Settings.Vendor.GetPrimaryColor()
                };
                textarea.Unfocused += TextChanged;
                XControl            = textarea;
            }
            else
            {
                var textbox = new EbXTextBox
                {
                    IsReadOnly       = this.ReadOnly,
                    XBackgroundColor = this.XBackground,
                    EnableFocus      = true,
                    BorderOnFocus    = App.Settings.Vendor.GetPrimaryColor(),
                };
                textbox.Unfocused += TextChanged;
                XControl           = textbox;
            }

            return(base.Draw(Mode, Network));;
        }
Exemple #2
0
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                var ctrl = e.NewElement as IEbCustomControl;

                drawable.SetShape(ShapeType.Rectangle);
                drawable.SetCornerRadius(ctrl.BorderRadius);

                if (ctrl.BorderColor != null)
                {
                    drawable.SetStroke(ctrl.BorderThickness, ctrl.BorderColor.ToAndroid());
                }

                if (ctrl.XBackgroundColor != null)
                {
                    drawable.SetColor(ctrl.XBackgroundColor.ToAndroid());
                }

                Control.SetBackground(drawable);

                EbXTextBox textbox = e.NewElement as EbXTextBox;

                if (textbox.EnableFocus)
                {
                    textbox.Focused   += Textbox_Focused;
                    textbox.Unfocused += Textbox_Unfocused;
                }
            }
        }
Exemple #3
0
 public override View Draw(FormMode Mode, NetworkMode Network)
 {
     XControl = new EbXTextBox
     {
         IsReadOnly       = true,
         XBackgroundColor = EbMobileControl.ReadOnlyBackground
     };
     return(base.Draw(Mode, Network));
 }
        public override View Draw(FormMode mode, NetworkMode network)
        {
            dataHolder = new EbXTextBox
            {
                IsReadOnly       = true,
                XBackgroundColor = Color.FromHex("#fafafa")
            };
            Button link = new Button
            {
                Style = (Style)HelperFunctions.GetResourceValue("QRReaderButton")
            };

            link.Clicked += OpenQrScanner;

            Button clear = new Button
            {
                Style = (Style)HelperFunctions.GetResourceValue("QRReaderClearButton")
            };

            clear.Clicked += Clear_Clicked;;

            var grid = new Grid
            {
                Style          = (Style)HelperFunctions.GetResourceValue("QRReaderContainerGrid"),
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = 40
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = GridLength.Star
                    },
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    },
                }
            };

            grid.Children.Add(dataHolder, 0, 0);
            Grid.SetColumnSpan(dataHolder, 2);

            grid.Children.Add(link, 0, 1);
            grid.Children.Add(clear, 1, 1);

            XControl = grid;

            return(base.Draw(mode, network));
        }
        private void InitPowerSelect(TapGestureRecognizer gesture)
        {
            SearchBox = new EbXTextBox
            {
                IsReadOnly  = this.ReadOnly,
                Placeholder = $"Search {this.Label}...",
                FontSize    = 15,
                BorderColor = Color.Transparent
            };
            SearchBox.Focused += async(sender, args) => await OnSearchBoxFocused();;
            Label icon = new Label
            {
                Style = (Style)HelperFunctions.GetResourceValue("SSIconLabel"),
                GestureRecognizers = { gesture }
            };

            XControl = new InputGroup(SearchBox, icon)
            {
                XBackgroundColor = Background
            };
        }
        public override View Draw(FormMode Mode, NetworkMode Network)
        {
            decimalPadding = this.DecimalPlaces > 0 ? ".".PadRight(this.DecimalPlaces + 1, '0') : string.Empty;
            if (RenderType == NumericBoxTypes.ButtonType)
            {
                Grid grid = new Grid {
                    ColumnSpacing = 4, IsEnabled = !this.ReadOnly
                };

                if (this.IncrementButtons == null || this.IncrementButtons.Count == 0)
                {
                    this.IncrementButtons = new List <EbMobileNumBoxButtons>()
                    {
                        new EbMobileNumBoxButtons()
                        {
                            Value = -1
                        }, new EbMobileNumBoxButtons()
                        {
                            Value = 1
                        }
                    }
                }
                ;

                this.IncrementButtons = this.IncrementButtons.OrderBy(e => e.Value).ToList();
                Int16 index = 0;

                foreach (EbMobileNumBoxButtons btn in this.IncrementButtons)
                {
                    if (btn.Value > 0)
                    {
                        break;
                    }
                    this.AddIncrButton(grid, btn.Value, index++, "- ");
                }

                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = GridLength.Star
                });
                XValueBox = new EbXTextBox
                {
                    Text     = this.MinLimit + decimalPadding,
                    Keyboard = Keyboard.Numeric,
                    HorizontalTextAlignment = TextAlignment.Center,
                    IsReadOnly       = this.ReadOnly,
                    XBackgroundColor = this.XBackground,
                    EnableFocus      = true,
                    BorderOnFocus    = App.Settings.Vendor.GetPrimaryColor()
                };
                XValueBox.TextChanged += this.NumericValueChanged;
                XValueBox.Focused     += this.OnFocused;
                XValueBox.Unfocused   += this.OnUnFocused;

                grid.Children.Add(XValueBox, index++, 0);
                foreach (EbMobileNumBoxButtons btn in this.IncrementButtons)
                {
                    if (btn.Value < 0)
                    {
                        continue;
                    }
                    this.AddIncrButton(grid, btn.Value, index++, "+ ");
                }

                this.XControl = grid;
            }
            else
            {
                EbXNumericTextBox numeric = new EbXNumericTextBox
                {
                    Text                    = "0" + decimalPadding,
                    IsReadOnly              = this.ReadOnly,
                    XBackgroundColor        = this.XBackground,
                    Keyboard                = Keyboard.Numeric,
                    Behaviors               = { new NumericBoxBehavior() },
                    EnableFocus             = true,
                    BorderOnFocus           = App.Settings.Vendor.GetPrimaryColor(),
                    HorizontalTextAlignment = TextAlignment.End
                };
                numeric.TextChanged += this.NumericValueChanged;
                numeric.Focused     += this.OnFocused;
                numeric.Unfocused   += this.OnUnFocused;

                this.XControl = numeric;
            }

            return(base.Draw(Mode, Network));
        }