コード例 #1
0
 private void SetUp()
 {
     PopUpContents = new DataTemplate(() =>
     {
         SfTextInputLayout rideCreditsInputLayout = new SfTextInputLayout
         {
             Hint                = "Amount",
             FocusedColor        = Color.Black,
             UnfocusedColor      = Color.Black,
             ContainerType       = ContainerType.Outlined,
             OutlineCornerRadius = 8
         };
         amount = new Entry();
         rideCreditsInputLayout.InputView    = amount;
         rideCreditsInputLayout.ErrorText    = "Field cant be left blank";
         rideCreditsInputLayout.FocusedColor = Color.Black;
         return(new StackLayout {
             VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { rideCreditsInputLayout }
         });
     });
     PopupLayout = new SfPopupLayout();
     PopupLayout.PopupView.HeaderTitle       = "Puchase Ride Credits";
     PopupLayout.PopupView.ContentTemplate   = PopUpContents;
     PopupLayout.PopupView.AnimationMode     = AnimationMode.Fade;
     PopupLayout.PopupView.AppearanceMode    = AppearanceMode.TwoButton;
     PopupLayout.PopupView.HorizontalOptions = LayoutOptions.CenterAndExpand;
     PopupLayout.PopupView.VerticalOptions   = LayoutOptions.Center;
     PopupLayout.Closed += PopupLayout_Closed;
     PopupLayout.Opened += PopupLayout_Opened;
     PopupLayout.PopupView.AcceptCommand = new Command(() => { Purchase_Ride_Credits(); });
     RhodesDataBase = new RhodesDataBase();
 }
コード例 #2
0
 /// <summary>
 /// Sets the error.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="sfTextInputLayout">The sf text input layout.</param>
 /// <param name="errorMessage">The error message.</param>
 private void SetError(View control,
                       SfTextInputLayout sfTextInputLayout,
                       String errorMessage)
 {
     sfTextInputLayout.ErrorText = errorMessage;
     sfTextInputLayout.HasError  = true;
     control.Focus();
 }
コード例 #3
0
        async void EntryScan(Image image)
        {
            try
            {
                var scanPage = new ZXingScannerPage();
                await Navigation.PushAsync(scanPage);

                scanPage.OnScanResult += (result) =>
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        await Navigation.PopAsync();

                        SfTextInputLayout sfInputText = null;
                        Entry entry             = null;
                        CustomDatePicker picker = null;

                        foreach (View t in entryStack.Children)
                        {
                            if (t.StyleId == image.StyleId)
                            {
                                var stack = (StackLayout)t;

                                foreach (View v in stack.Children)
                                {
                                    if (v.StyleId == image.StyleId)
                                    {
                                        string type = v.GetType().ToString();

                                        if (type == "ASolute_Mobile.CustomRenderer.CustomEntry")
                                        {
                                            CustomEntry customentry = (CustomEntry)v;
                                            customentry.Text        = result.Text;
                                        }
                                        else if (type == "Syncfusion.XForms.TextInputLayout.SfTextInputLayout")
                                        {
                                            sfInputText = (SfTextInputLayout)v;
                                            entry       = (Entry)sfInputText.InputView;
                                            entry.Text  = result.Text;
                                        }
                                        else if (type == "ASolute_Mobile.CustomRenderer.CustomDatePicker")
                                        {
                                            picker      = (CustomDatePicker)v;
                                            picker.Date = DateTime.Parse(result.Text);
                                        }
                                    }
                                }
                            }
                        }
                    });
                };
            }
            catch
            {
            }
        }
コード例 #4
0
        private void Approve_Button_Clicked(object sender, EventArgs e)
        {
            customEntry = new Editor {
                HeightRequest = 100
            };
            //this.BindingContext = new PopupViewModel();

            //customEntry.SetBinding(Editor.TextProperty, new Binding("Notes", BindingMode.Default, null, null, null, this.BindingContext));
            popupLayout.PopupView.ContentTemplate = new DataTemplate(() =>
            {
                StackLayout stackLayout = new StackLayout();
                stackLayout.Orientation = StackOrientation.Vertical;

                SfTextInputLayout inputLayout = new SfTextInputLayout();
                inputLayout.Hint      = "Notes";
                inputLayout.InputView = customEntry;


                Button button            = new Button();
                button.Text              = "APPROVE";
                button.BackgroundColor   = Color.Transparent;
                button.TextColor         = Color.Black;
                button.Image             = "approve.png";
                button.HorizontalOptions = LayoutOptions.End;
                button.Clicked          += Button_Clicked_approved;

                stackLayout.Children.Add(inputLayout);
                stackLayout.Children.Add(button);

                return(stackLayout);
            });
            popupLayout.PopupView.ShowFooter    = false;
            popupLayout.PopupView.ShowHeader    = false;
            popupLayout.PopupView.WidthRequest  = 350;
            popupLayout.PopupView.HeightRequest = 180;
            popupLayout.PopupView.AnimationMode = AnimationMode.SlideOnBottom;
            //popupLayout.PopupView.HorizontalOptions = LayoutOptions.FillAndExpand;
            popupLayout.Show();
        }
コード例 #5
0
 /// <summary>
 /// Clears the error.
 /// </summary>
 /// <param name="sfTextInputLayout">The sf text input layout.</param>
 private void ClearError(SfTextInputLayout sfTextInputLayout)
 {
     sfTextInputLayout.ErrorText = string.Empty;
     sfTextInputLayout.HasError  = false;
 }
コード例 #6
0
        public EmpresaEssentialView()
        {
            InitializeComponent();

            StackLayout sl1 = new StackLayout();


            var inputes = new Label
            {
                Text = "       Essential       ",
                HorizontalOptions = LayoutOptions.Center,
                FontSize          = 18,
                // inputes.FontAttributes = FontAttributes.Bold;
                VerticalOptions = LayoutOptions.Center,
                TextColor       = Color.White,
                BackgroundColor = Color.FromHex(Colores.JobMeOrange),
                Margin          = new Thickness(0, 0, 0, 20)
            };


            string         fuente   = string.Empty;
            FontAttributes atributo = FontAttributes.None;

            switch (Device.RuntimePlatform)
            {
            case Device.iOS:
                fuente   = "Font Awesome 5 Free";
                atributo = FontAttributes.Bold;
                break;;

            case Device.Android:
                fuente   = "FontSolid-900.otf#Font Awesome 5 Free Solid";
                atributo = FontAttributes.None;
                break;
            }
            ;

            //Company
            var inputCompany = new SfTextInputLayout
            {
                Hint                = "Company",
                InputViewPadding    = 5,
                LeadingViewPosition = ViewPosition.Outside,
                LeadingView         = new Label()
                {
                    Text            = "\uf0c0",
                    FontFamily      = fuente,
                    FontSize        = 24,
                    FontAttributes  = atributo,
                    TextColor       = Color.FromHex(Colores.JobMeGray),
                    VerticalOptions = LayoutOptions.Center
                },
                ContainerType = ContainerType.Filled,
                //inputName.HelperText = "Enter your name";
                CharMaxLength = 50,
                //inputName.ShowCharCount = true;
                HintLabelStyle = new LabelStyle()
                {
                    FontSize = 16
                },
                InputView = new Entry()
            };

            //Image
            var imageentry = new Entry();

            imageentry.Focused += Imageentry_Focused;

            var inputlogo = new SfTextInputLayout
            {
                Hint                = "Logo",
                InputViewPadding    = 5,
                LeadingViewPosition = ViewPosition.Outside,
                LeadingView         = new Label()
                {
                    Text            = "\uf0c0",
                    FontFamily      = fuente,
                    FontSize        = 24,
                    FontAttributes  = atributo,
                    TextColor       = Color.FromHex(Colores.JobMeGray),
                    VerticalOptions = LayoutOptions.Center
                },
                ContainerType = ContainerType.Filled,
                //inputName.HelperText = "Enter your name";
                CharMaxLength = 50,
                //inputName.ShowCharCount = true;
                HintLabelStyle = new LabelStyle()
                {
                    FontSize = 16
                },
                InputView = imageentry
            };


            //Description
            var inputDescription = new SfTextInputLayout
            {
                Hint                = "Description",
                InputViewPadding    = 5,
                LeadingViewPosition = ViewPosition.Outside,
                LeadingView         = new Label()
                {
                    Text            = "\uf0c0",
                    FontFamily      = fuente,
                    FontSize        = 24,
                    FontAttributes  = atributo,
                    TextColor       = Color.FromHex(Colores.JobMeGray),
                    VerticalOptions = LayoutOptions.Center
                },
                ContainerType = ContainerType.Filled,
                //inputName.HelperText = "Enter your name";
                CharMaxLength = 50,
                //inputName.ShowCharCount = true;
                HintLabelStyle = new LabelStyle()
                {
                    FontSize = 16
                },
                InputView = new Entry()
            };

            //Mail
            var inputMail = new SfTextInputLayout
            {
                Hint                = "Mail",
                InputViewPadding    = 5,
                LeadingViewPosition = ViewPosition.Outside,
                LeadingView         = new Label()
                {
                    Text            = "\uf0e0",
                    FontFamily      = fuente,
                    FontSize        = 24,
                    FontAttributes  = atributo,
                    TextColor       = Color.FromHex(Colores.JobMeGray),
                    VerticalOptions = LayoutOptions.Center
                },
                ContainerType = ContainerType.Filled,
                //inputMail.HelperText = "Enter your Mail";
                //inputMail.CharMaxLength = 3;
                //inputMail.ShowCharCount = true;
                HintLabelStyle = new LabelStyle()
                {
                    FontSize = 16
                },
                InputView = new Entry()
            };

            //inputName
            var inputName = new SfTextInputLayout
            {
                Hint                = "Name",
                InputViewPadding    = 5,
                LeadingViewPosition = ViewPosition.Outside,

                LeadingView = new Label()
                {
                    Text            = "\uf57d",
                    FontFamily      = fuente,
                    FontAttributes  = atributo,
                    FontSize        = 24,
                    TextColor       = Color.FromHex(Colores.JobMeGray),
                    VerticalOptions = LayoutOptions.Center,
                    Margin          = new Thickness(0, 0, 10, 0)
                },
                ContainerType = ContainerType.Filled,
                //inputCountry.HelperText = "Enter your country";
                CharMaxLength = 50,
                //inputCountry.ShowCharCount = true;
                HintLabelStyle = new LabelStyle()
                {
                    FontSize = 16
                },
                InputView = new Entry()
                {
                    Margin = new Thickness(0, 0, 30, 0)
                }
            };


            //Telephone
            var inputPhone = new SfTextInputLayout
            {
                Hint                = "Phone",
                InputViewPadding    = 5,
                LeadingViewPosition = ViewPosition.Outside,
                LeadingView         = new Label()
                {
                    Text            = "\uf095",
                    FontFamily      = fuente,
                    FontSize        = 24,
                    FontAttributes  = atributo,
                    TextColor       = Color.FromHex(Colores.JobMeGray),
                    VerticalOptions = LayoutOptions.Center
                },
                ContainerType = ContainerType.Filled,
                //inputPhone.HelperText = "Enter your Phone";
                //inputPhone.CharMaxLength = 3;
                // inputPhone.ShowCharCount = true;
                HintLabelStyle = new LabelStyle()
                {
                    FontSize = 16
                },
                InputView = new Entry()
            };


            //Username
            var inputUser = new SfTextInputLayout
            {
                Hint                = "Username",
                InputViewPadding    = 5,
                LeadingViewPosition = ViewPosition.Outside,
                LeadingView         = new Label()
                {
                    Text            = "\uf406",
                    FontFamily      = fuente,
                    FontSize        = 24,
                    FontAttributes  = atributo,
                    TextColor       = Color.FromHex(Colores.JobMeGray),
                    VerticalOptions = LayoutOptions.Center
                },
                ContainerType = ContainerType.Filled,
                // inputUser.HelperText = "Enter your Username";
                //inputUser.CharMaxLength = 3;
                //inputUser.ShowCharCount = true;
                HintLabelStyle = new LabelStyle()
                {
                    FontSize = 16
                },
                InputView = new Entry()
            };

            //Password
            var inputPass = new SfTextInputLayout
            {
                Hint = "Password",
                EnablePasswordVisibilityToggle = true,
                InputViewPadding    = 5,
                LeadingViewPosition = ViewPosition.Outside,
                LeadingView         = new Label()
                {
                    Text            = "\uf023",
                    FontFamily      = fuente,
                    FontSize        = 24,
                    FontAttributes  = atributo,
                    TextColor       = Color.FromHex(Colores.JobMeGray),
                    VerticalOptions = LayoutOptions.Center
                },
                ContainerType = ContainerType.Filled,
                // inputPass.HelperText = "Enter your Password";
                //inputPass.c = 3;
                //inputPass.ShowCharCount = true;
                HintLabelStyle = new LabelStyle()
                {
                    FontSize = 16
                },
                InputView = new Entry()
                {
                    IsPassword = true
                }
            };

            //Add moore
            var lbaddmore = new Label
            {
                Text = " +      Add more contacts      ",
                HorizontalOptions = LayoutOptions.Center,
                FontSize          = 18,
                // inputes.FontAttributes = FontAttributes.Bold;
                VerticalOptions = LayoutOptions.Center,
                TextColor       = Color.White,
                BackgroundColor = Color.FromHex(Colores.JobMeOrange),
                Margin          = new Thickness(0, 0, 0, 20)
            };



            var lbaddmoretap = new TapGestureRecognizer();

            lbaddmoretap.Tapped += (sender, args) =>
            {
            };


            var lbPalomita = new Label()
            {
                Text              = "\uf00c",
                FontFamily        = fuente,
                FontSize          = 60,
                FontAttributes    = atributo,
                TextColor         = Color.FromHex(Colores.JobMeOrange),
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Margin            = new Thickness(0, 0, 0, 80)
            };

            var lbPalomitatap = new TapGestureRecognizer();

            lbPalomitatap.Tapped += async(sender, args) => await AddUser();

            lbPalomita.GestureRecognizers.Add(lbPalomitatap);

            sl1.Orientation = StackOrientation.Vertical;
            //Label label1 = new Label();
            //label1.SetBinding(Label.TextProperty, "Nombre");
            //label1.BindingContext = vm;

            //sl1.Children.Add(inputNM);
            sl1.Children.Add(inputes);
            sl1.Children.Add(inputCompany);
            sl1.Children.Add(inputlogo);

            sl1.Children.Add(inputDescription);
            sl1.Children.Add(inputMail);
            sl1.Children.Add(inputName);
            sl1.Children.Add(inputUser);
            sl1.Children.Add(inputPass);
            sl1.Children.Add(inputPhone);
            sl1.Children.Add(lbaddmore);

            this.Content = sl1;
        }
コード例 #7
0
        private void ListTemplate()
        {
            AssList.ItemSpacing    = 0;
            AssList.AutoFitMode    = Syncfusion.ListView.XForms.AutoFitMode.DynamicHeight;
            AssList.BindingContext = new Assignments();
            AssList.ItemTemplate   = new DataTemplate(() =>
            {
                Grid MainGrid = new Grid()
                {
                    VerticalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromRgba(0, 0, 0, 0.5), Margin = new Thickness(0), Padding = 0
                };

                StackLayout main = new StackLayout()
                {
                    Spacing = 5, Margin = 0, Padding = 0, Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand
                };

                StackLayout firstRow = new StackLayout()
                {
                    Orientation = StackOrientation.Horizontal, Spacing = 0, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 50
                };
                Label l = new Label()
                {
                    TextColor = Color.White, FontSize = 18, WidthRequest = 200, LineBreakMode = Xamarin.Forms.LineBreakMode.TailTruncation, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center, Margin = new Thickness(0, 0)
                };
                l.SetBinding(Label.TextProperty, new Binding("Description"));
                firstRow.Children.Add(l);

                StackLayout border = new StackLayout()
                {
                    WidthRequest = 150, HeightRequest = 50, VerticalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.End, Margin = new Thickness(0, 0)
                };
                StackLayout score = new StackLayout()
                {
                    Orientation = StackOrientation.Horizontal, WidthRequest = 150, VerticalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand
                };

                StackLayout holder1 = new StackLayout()
                {
                    VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Center, WidthRequest = 105, HeightRequest = 40
                };
                var inputLayout1 = new SfTextInputLayout()
                {
                    ContainerType = ContainerType.Outlined, VerticalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.Center, HeightRequest = 40, InputViewPadding = 0, ReserveSpaceForAssistiveLabels = false
                };
                SfNumericTextBox points = new SfNumericTextBox()
                {
                    TextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand, TextColor = Color.White, HeightRequest = 40, Margin = 0, SelectAllOnFocus = true
                };
                points.SetBinding(SfNumericTextBox.ValueProperty, new Binding("Points", BindingMode.TwoWay));
                inputLayout1.SetBinding(SfTextInputLayout.ContainerBackgroundColorProperty, new Binding("BackColor"));
                points.MaximumNumberDecimalDigits = 1;
                points.Completed      += Handle_ValueChanged;
                points.Minimum         = 0;
                inputLayout1.InputView = points;
                holder1.Children.Add(inputLayout1);

                StackLayout holder2 = new StackLayout()
                {
                    VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Center, WidthRequest = 105, HeightRequest = 40
                };
                var inputLayout2 = new SfTextInputLayout()
                {
                    ContainerType = ContainerType.Outlined, VerticalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.Center, HeightRequest = 40, InputViewPadding = 0, ReserveSpaceForAssistiveLabels = false
                };
                SfNumericTextBox possible = new SfNumericTextBox()
                {
                    TextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand, TextColor = Color.White, HeightRequest = 40, Margin = 0, SelectAllOnFocus = true
                };
                possible.SetBinding(SfNumericTextBox.ValueProperty, new Binding("Possible", BindingMode.TwoWay));
                inputLayout2.SetBinding(SfTextInputLayout.ContainerBackgroundColorProperty, new Binding("BackColor"));
                possible.MaximumNumberDecimalDigits = 1;
                possible.Completed    += Handle_ValueChanged;
                inputLayout2.InputView = possible;
                holder2.Children.Add(inputLayout2);

                score.Children.Add(holder1);
                score.Children.Add(holder2);

                border.Children.Add(score);
                border.BackgroundColor = Color.Transparent;
                firstRow.Children.Add(border);

                StackLayout subMain = new StackLayout()
                {
                    Spacing = 0, Margin = 0, Padding = 0, HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.StartAndExpand
                };
                cat = new SfComboBox()
                {
                    HorizontalOptions = LayoutOptions.StartAndExpand, WidthRequest = 200, HeightRequest = 50, TextColor = Color.White, VerticalOptions = LayoutOptions.CenterAndExpand
                };
                cat.ComboBoxSource    = Cats;
                cat.SelectionChanged += ComboBox_SelectionChanged;
                cat.SetBinding(SfComboBox.TextProperty, new Binding("AssignmentType", BindingMode.TwoWay));
                subMain.Children.Add(cat);
                gradeBox = new SfComboBox()
                {
                    HorizontalOptions = LayoutOptions.End, WidthRequest = 150, TextColor = Color.White
                };
                gradeBox.SetBinding(SfComboBox.TextProperty, new Binding("Grade", BindingMode.TwoWay));
                gradeBox.ComboBoxSource    = gradesPoss;
                gradeBox.SelectionChanged += Gradebox_SelectionChanged;
                subMain.Children.Add(gradeBox);

                StackLayout last = new StackLayout()
                {
                    Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.End, HorizontalOptions = LayoutOptions.FillAndExpand, Margin = new Thickness(0, 0)
                };
                Binding dateNTime   = new Binding("Date");
                dateNTime.Converter = new AssignmentDateConverter();
                Label date          = new Label()
                {
                    TextColor = Color.White, VerticalOptions = LayoutOptions.End, FontSize = 15f, FontAttributes = FontAttributes.Bold, Margin = new Thickness(0, 0), HorizontalOptions = LayoutOptions.EndAndExpand
                };
                date.SetBinding(Label.TextProperty, dateNTime);
                last.Children.Add(date);

                main.Children.Add(firstRow);
                main.Children.Add(subMain);
                main.Children.Add(last);
                main.Children.Add(new BoxView()
                {
                    Color = Color.Black, HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 2
                });

                MainGrid.Children.Add(main);
                return(MainGrid);
            });
        }
コード例 #8
0
        string SearchControl(string controlID, string action, string content)
        {
            foreach (View t in entryStack.Children)
            {
                if (t.StyleId == controlID)
                {
                    var stack = (StackLayout)t;

                    foreach (View v in stack.Children)
                    {
                        if (v.StyleId == controlID)
                        {
                            string type = v.GetType().ToString();

                            if (type == "ASolute_Mobile.CustomRenderer.CustomEntry")
                            {
                                Entry entry = (Entry)v;

                                switch (action)
                                {
                                case "GetValue":
                                    return(entry.Text);


                                case "SetValue":
                                    entry.Text = content;
                                    break;

                                case "Focus":
                                    entry.Focus();
                                    break;

                                default:
                                    entry.Text = String.Empty;
                                    break;
                                }
                            }
                            else if (type == "Syncfusion.XForms.TextInputLayout.SfTextInputLayout")
                            {
                                SfTextInputLayout sfInputText = (SfTextInputLayout)v;

                                Entry entry = (Entry)sfInputText.InputView;

                                switch (action)
                                {
                                case "GetValue":
                                    return(entry.Text);

                                case "SetValue":
                                    entry.Text = content;
                                    break;

                                case "Focus":
                                    entry.Focus();
                                    break;

                                default:
                                    entry.Text = String.Empty;
                                    break;
                                }
                            }
                            else if (type == "ASolute_Mobile.CustomRenderer.CustomDatePicker")
                            {
                                CustomDatePicker picker = (CustomDatePicker)v;

                                switch (action)
                                {
                                case "GetValue":
                                    if (picker.NullableDate == null)
                                    {
                                        return("");
                                    }
                                    else
                                    {
                                        return(picker.Date.ToString("yyyy-MM-dd"));
                                    }


                                case "Focus":
                                    picker.Focus();
                                    break;

                                default:
                                    if (picker.NullableDate != null)
                                    {
                                        picker.Date         = DateTime.Now;
                                        picker.NullableDate = null;
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            return(null);
        }
コード例 #9
0
        async void GetNewPalletList()
        {
            try
            {
                var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.loadNewPalletURL(id, productPallet.ProductLinkId), this);

                clsResponse newPallet_response = JsonConvert.DeserializeObject <clsResponse>(content);

                if (newPallet_response.IsGood)
                {
                    newPallet      = JObject.Parse(content)["Result"].ToObject <clsPalletNew>();
                    unitBox.Text   = newPallet.DefaultProductUom;
                    statusBox.Text = newPallet.DefaultStockStatus;

                    foreach (clsKeyValue size in newPallet.PalletSize)
                    {
                        sizes.Add(size.Value);
                        string[] defaultSize = size.Value.Split('(');
                        if (defaultSize[1].Contains(newPallet.DefaultProductUom))
                        {
                            sizeBox.Text = size.Value;
                        }
                    }

                    foreach (clsKeyValue unit in newPallet.ProductUom)
                    {
                        units.Add(unit.Key);
                    }

                    foreach (clsKeyValue status_ in newPallet.StockStatus)
                    {
                        status.Add(status_.Key);
                    }

                    sizeBox.ComboBoxSource   = sizes;
                    unitBox.ComboBoxSource   = units;
                    statusBox.ComboBoxSource = status;

                    if (newPallet.ControlVolume != "H")
                    {
                        clsAttribute volume = new clsAttribute
                        {
                            Key     = "M3",
                            Caption = "M3",
                            Value   = newPallet.ControlVolume
                        };

                        newPallet.Attribute.Add(volume);
                    }

                    if (newPallet.ControlWeight != "H")
                    {
                        clsAttribute weight = new clsAttribute
                        {
                            Key     = "KG",
                            Caption = "KG",
                            Value   = newPallet.ControlWeight
                        };

                        newPallet.Attribute.Add(weight);
                    }

                    int row = 4, column = 0;
                    foreach (clsAttribute attr in newPallet.Attribute)
                    {
                        StackLayout autoGenerateEntryStack = new StackLayout
                        {
                            //Orientation = StackOrientation.Horizontal,
                            StyleId = attr.Key
                        };

                        if (attr.Key == "ExpiryDate" || attr.Key == "MfgDate")
                        {
                            customDatePicker = new CustomDatePicker
                            {
                                StyleId           = attr.Key,
                                HorizontalOptions = LayoutOptions.FillAndExpand,
                                NullableDate      = null
                            };

                            customDatePicker.Unfocused += (object sender, FocusEventArgs e) =>
                            {
                                DateUnfocus(sender);
                            };

                            Label fieldLbl = new Label
                            {
                                Text                  = attr.Caption,
                                FontAttributes        = FontAttributes.Bold,
                                VerticalTextAlignment = TextAlignment.Center
                            };

                            autoGenerateEntryStack.Children.Add(fieldLbl);
                            autoGenerateEntryStack.Children.Add(customDatePicker);
                        }
                        else
                        {
                            Entry entry = new Entry
                            {
                                StyleId           = attr.Key,
                                HorizontalOptions = LayoutOptions.FillAndExpand,
                            };

                            entry.Completed += Handle_Completed;

                            entry.Behaviors.Add(new MaxLengthValidation {
                                MaxLength = 50
                            });

                            if (attr.Key == "M3" || attr.Key == "KG")
                            {
                                entry.Keyboard = Keyboard.Numeric;
                            }

                            inputLayout           = new SfTextInputLayout();
                            inputLayout.Hint      = attr.Caption;
                            inputLayout.InputView = entry;
                            inputLayout.StyleId   = attr.Key;

                            /*  customEntry = new CustomEntry
                             * {
                             *   StyleId = attr.Key,
                             *   HorizontalOptions = LayoutOptions.FillAndExpand,
                             *
                             * };
                             *
                             * customEntry.Completed += Handle_Completed;
                             *
                             * customEntry.Behaviors.Add(new MaxLengthValidation { MaxLength = 50 });
                             *
                             * //entryStack.Children.Add(customEntry);*/

                            if (attr.Key != "ExpiryDate" && attr.Key != "MfgDate" && attr.Key != "M3" && attr.Key != "KG")
                            {
                                Image scan = new Image
                                {
                                    Source          = "barCode.png",
                                    WidthRequest    = 60,
                                    HeightRequest   = 30,
                                    VerticalOptions = LayoutOptions.Center,
                                    StyleId         = attr.Key
                                };

                                var scan_barcode = new TapGestureRecognizer
                                {
                                    NumberOfTapsRequired = 1
                                };

                                scan_barcode.Tapped += (sender, e) =>
                                {
                                    var image = sender as Image;

                                    EntryScan(image);
                                };
                                scan.GestureRecognizers.Add(scan_barcode);

                                inputLayout.TrailingView = scan;
                            }


                            autoGenerateEntryStack.Children.Add(inputLayout);
                        }

                        if (attr.Value == "M")
                        {
                            /*  if (customEntry != null)
                             * {
                             *   customEntry.LineColor = Color.LightYellow;
                             * }
                             * if (customDatePicker != null)
                             * {
                             *   customDatePicker.BackgroundColor = Color.LightYellow;
                             * }*/

                            if (inputLayout != null)
                            {
                                inputLayout.ContainerBackgroundColor = Color.LightYellow;
                            }
                            if (customDatePicker != null)
                            {
                                customDatePicker.BackgroundColor = Color.LightYellow;
                            }
                        }
                        else
                        {
                            /*if (customEntry != null)
                             * {
                             *  customEntry.LineColor = Color.WhiteSmoke;
                             * }*/
                            if (inputLayout != null)
                            {
                                inputLayout.ContainerBackgroundColor = Color.WhiteSmoke;
                            }
                        }

                        entryStack.Children.Add(autoGenerateEntryStack);
                        // entryStack.Children.Add(scan);

                        //grid.Children.Add(fieldLbl, column, row);
                        column++;
                        //grid.Children.Add(entryStack, column, row);
                        row++;
                        column = 0;
                    }
                }
                else
                {
                    await DisplayAlert("Error", newPallet_response.Message, "OK");
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", ex.Message, "OK");
            }
        }
コード例 #10
0
        public AnalyzeFrame()
        {
            this.Visual = VisualMarker.Material;

            this.CornerRadius = 20;

            this.DirectionsLabel = new PartemLabelLight
            {
                Text          = "Enter the Url of an article to analyze its political bias.",
                Margin        = new Thickness(0, 0, 0, 15),
                LineBreakMode = Xamarin.Forms.LineBreakMode.WordWrap
            };

            this.URLTextBox = new SfTextInputLayout
            {
                Hint           = "Article Url",
                InputView      = new Entry(),
                Margin         = new Thickness(0, 0, 0, 15),
                Visual         = VisualMarker.Default,
                HintLabelStyle = new LabelStyle
                {
                    FontFamily = Device.RuntimePlatform == Device.iOS ? "Nexa-Light" : null,
                    FontSize   = 20
                },
                ErrorText = "Entered Url is invalid."
            };

            this.AnalyzeButton = new SfButton
            {
                Text               = "Analyze",
                FontFamily         = Device.RuntimePlatform == Device.iOS ? "Nexa-Bold" : null,
                FontSize           = 20,
                TextColor          = Color.White,
                CornerRadius       = 20,
                HeightRequest      = 50,
                BackgroundGradient = new SfLinearGradientBrush
                {
                    GradientStops =
                    {
                        new SfGradientStop {
                            Color = Color.FromHex("#12C2E9"), Offset = 0
                        },
                        new SfGradientStop {
                            Color = Color.FromHex("#C471ED"), Offset = 0.5
                        },
                        new SfGradientStop {
                            Color = Color.FromHex("#F64F59"), Offset = 1
                        }
                    }
                },
                HasShadow = true,
            };

            Content = new StackLayout
            {
                Children =
                {
                    this.DirectionsLabel,
                    this.URLTextBox,
                    this.AnalyzeButton
                }
            };

            Padding = new Thickness(20, 40);
            Margin  = new Thickness(20, 10, 20, 10);
        }