コード例 #1
0
        void SetTimerEditCount(int countOrder, int productsMin, int productsUnits, MyEntry entCount)
        {
            Timer tmrCountProduct = new Timer(2000);             // Секунда

            tmrCountProduct.Elapsed += (obj, evn) => {
                int countExcessProduct = (countOrder - productsMin) % productsUnits;
                if (countExcessProduct != 0)
                {
                    countOrder -= countExcessProduct;
                    Device.BeginInvokeOnMainThread(() => entCount.Text = countOrder.ToString());
                }
            };
            tmrCountProduct.AutoReset = false;
            tmrCountProduct.Enabled   = true;
        }
コード例 #2
0
        StackLayout ShownPanelSearch()
        {
            return(intilizeSearchNotKitkat());


                        #if __ANDROID__
            if (Android.OS.Build.VERSION.SdkInt == Android.OS.BuildVersionCodes.Kitkat)
            {
                MyEntry entSearch = new MyEntry {
                    Placeholder             = "Поиск по каталогу",
                    HeightRequest           = heightSearch,
                    BackgroundColor         = Color.Transparent,
                    HorizontalTextAlignment = TextAlignment.Center,
                    HorizontalOptions       = LayoutOptions.FillAndExpand,
                    VerticalOptions         = LayoutOptions.CenterAndExpand,
                    PlaceholderColor        = ApplicationStyle.LabelColor,


                    BorderColor  = ApplicationStyle.LineColor,
                    BorderRadius = 7,
                    BorderWidth  = 10,
                };
                entSearch.Focused += OnSearchClick;

//				Image imgSearch = new Image {
//					Source = "Header/loup_poisk.png",
//					VerticalOptions = LayoutOptions.CenterAndExpand,
//					HorizontalOptions = LayoutOptions.Start
//				};
                StackLayout layoutText = new StackLayout {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Orientation       = StackOrientation.Horizontal,
                    BackgroundColor   = ApplicationStyle.LineColor,
                    Children          =
                    {
                        entSearch,
                    }
                };
                return(layoutText);
            }
            else
            {
                return(intilizeSearchNotKitkat());
            }
                        #else
            return(intilizeSearchNotKitkat());
                        #endif
        }
コード例 #3
0
        void OnCountChange(object sender, TextChangedEventArgs e)
        {
            if (isInitialization || returnCountChange)
            {
                returnCountChange = false;
                return;
            }
            oldDate = DateTime.Now;

            ProductView.StopTimer();
            Regex   rxNums   = new Regex(@"^\d+$");
            MyEntry entCount = sender as MyEntry;

            // любые цифры
            if (entCount.Text != "" && !rxNums.IsMatch(entCount.Text))
            {
                entCount.Text     = e.OldTextValue;
                returnCountChange = true;
                return;
            }
            if (e.NewTextValue != "")
            {
                countOrder = int.Parse(entCount.Text);
            }

            int tempOldValue = -1;

            int.TryParse(e.OldTextValue, out tempOldValue);
            if (oldValue == -1)
            {
                if (BasketItem.Quantity > BasketItem.ProductActualQuantity)
                {
                    oldValue = BasketItem.Quantity;
                }
                else
                {
                    oldValue = tempOldValue;
                }
                //oldValue = tempOldValue;
            }

            OnCountChanged();
            isInitialization = false;
        }
コード例 #4
0
ファイル: DeliveryView.cs プロジェクト: galoch-s/OMShopMobile
        public DeliveryView(List <Basket> basketList, double total)
        {
            Total           = total;
            _basketList     = basketList;
            VerticalOptions = LayoutOptions.FillAndExpand;

            Label lblSort = new Label {
                Text            = "Способ доставки:",
                VerticalOptions = LayoutOptions.CenterAndExpand
            };
            StackLayout titleSortLayout = new StackLayout {
                BackgroundColor = ApplicationStyle.LineColor,
                HeightRequest   = Utils.GetSize(22),
                Padding         = new Thickness(8, 0),
                Children        =
                {
                    lblSort
                }
            };

            radioList = new BindableRadioGroup {
                Spacing         = 1,
                BackgroundColor = Color.White,
                TextColor       = ApplicationStyle.TextColor,
                Padding         = new Thickness(8, 0, 0, 0)
            };
            radioList.CheckedChanged += (sender, e) => {
                var radio = sender as CustomRadioButton;
                if (radio == null || radio.Id == -1)
                {
                    return;
                }
                selectDelivery = radio.Text;
            };

            StackLayout bottomLayout = new StackLayout {
                BackgroundColor = ApplicationStyle.LineColor,
                HeightRequest   = Utils.GetSize(22),
                Padding         = new Thickness(8, 0),
                Children        =
                {
                }
            };

            Switch elSwitch = new Switch {
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.EndAndExpand
            };

            elSwitch.Toggled += OnClickDataTrue;

            StackLayout layoutSwitch = new StackLayout {
                Padding       = new Thickness(8, 0),
                Orientation   = StackOrientation.Horizontal,
                HeightRequest = Utils.GetSize(43),
                Children      =
                {
                    new Label {
                        Text            = "Данные указаны верно",
                        VerticalOptions = LayoutOptions.CenterAndExpand,
                        TextColor       = ApplicationStyle.TextColor,
                    },
                    elSwitch
                }
            };

            editorComment = new MyEditor {
                //VerticalOptions = LayoutOptions.FillAndExpand,
                TextColor        = ApplicationStyle.TextColor,
                Placeholder      = "Оставить комментарий к заказу",
                PlaceholderColor = ApplicationStyle.LabelColor,
                FontSize         = Utils.GetSize(14),
                HeightRequest    = 100
            };
            editorComment.Focused   += OnTextFocused;
            editorComment.Unfocused += OnTextUnFocused;

            entCoupon = new MyEntry {
                PlaceholderColor  = ApplicationStyle.LabelColor,
                Placeholder       = "Введите код на скидку",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Margin            = new Thickness(0),
                Padding           = new Thickness(0),
            };

            MyButton btnCoupon = new MyButton {
                BackgroundColor = ApplicationStyle.LineColor,
                TextColor       = ApplicationStyle.LabelColor,
                UseWithTextBox  = true,
                FontSize        = 14,
                Text            = "Применить",
                WidthRequest    = 114,
            };

            btnCoupon.Clicked += CouponClick;;

            StackLayout layoutBtnCoupon = new StackLayout {
                BackgroundColor = ApplicationStyle.LineColor,
                WidthRequest    = 114,
                Margin          = new Thickness(1)
            };

            StackLayout layoutCoupon = new StackLayout {
                HeightRequest = 30,
                Orientation   = StackOrientation.Horizontal,
                Children      =
                {
                    entCoupon,
                    btnCoupon
                }
            };
            CustomFrame frameCoupon = new CustomFrame {
                OutlineColor      = ApplicationStyle.LineColor,
                OutlineWidth      = 2,
                HeightRequest     = 31,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                HasShadow         = false,
                Content           = layoutCoupon,
                Padding           = new Thickness(0),
                Margin            = new Thickness(8, 18)
            };


            Label lblTitleMessageOrder = new Label {
                VerticalOptions = LayoutOptions.Center,
                TextColor       = ApplicationStyle.TextColor,
                Text            = "Сумма заказа"
            };
            Label lblMessageOrder = new Label {
                TextColor         = ApplicationStyle.TextColor,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.EndAndExpand,
                Text = Total + " р."
            };
            StackLayout layoutSumOrder = new StackLayout {
                VerticalOptions = LayoutOptions.Center,
                Orientation     = StackOrientation.Horizontal,
                HeightRequest   = Constants.HeightRowListView,
                Padding         = new Thickness(8, 0),
                Children        =
                {
                    lblTitleMessageOrder,
                    lblMessageOrder
                }
            };

            Label lblTitleMessageCoupon = new Label {
                VerticalOptions = LayoutOptions.Center,
                TextColor       = ApplicationStyle.TextColor,
                Text            = "Скидка по купону"
            };

            lblMessageCoupon = new Label {
                TextColor         = ApplicationStyle.TextColor,
                HorizontalOptions = LayoutOptions.EndAndExpand,
                VerticalOptions   = LayoutOptions.Center,
            };
            StackLayout layoutSumCoupon = new StackLayout {
                Orientation   = StackOrientation.Horizontal,
                HeightRequest = Constants.HeightRowListView,
                Padding       = new Thickness(8, 0),
                Children      =
                {
                    lblTitleMessageCoupon,
                    lblMessageCoupon
                }
            };

            lblCouponMeassage = new Label {
                TextColor = ApplicationStyle.RedColor,
                IsVisible = false
            };
            layoutCouponInfo = new StackLayout {
                Spacing   = 0,
                IsVisible = false,
                Children  =
                {
                    new BoxView(),
                    layoutSumOrder,
                    new BoxView(),
                    layoutSumCoupon,
                    new BoxView(),
                }
            };
            indicatorCoupon = new ActivityIndicator {
                Color           = Device.OnPlatform(Color.Black, Color.Gray, Color.Default),
                IsRunning       = true,
                IsVisible       = false,
                VerticalOptions = LayoutOptions.CenterAndExpand,
            };

            StackLayout layoutCouponMain = new StackLayout {
                Padding  = new Thickness(8, 0),
                Children =
                {
                    lblCouponMeassage,
                    layoutCouponInfo,
                    indicatorCoupon
                }
            };

            layoutBody = new StackLayout {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 0,
                Children        =
                {
                    titleSortLayout,
                    radioList,
                    bottomLayout,
                    editorComment,
                    new StackLayout {
                        BackgroundColor = ApplicationStyle.LineColor,
                        HeightRequest   = Utils.GetSize(22),
                        Padding         = new Thickness(8,  0),
                        Children        =
                        {
                        }
                    },
                    frameCoupon,
                    layoutCouponMain,
                    layoutSwitch,
                }
            };
            double heightBot  = Utils.GetSize(49);
            Grid   gridBottom = new Grid {
                Padding         = new Thickness(0),
                HeightRequest   = heightBot,
                VerticalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions  =
                {
                    new RowDefinition {
                        Height = heightBot,
                    }
                },
                RowSpacing        = 0,
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(50, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(50, GridUnitType.Star)
                    },
                },
                BackgroundColor = Color.White,
            };

            lblTotal = new Label {
                FontSize                = 24,
                TextColor               = ApplicationStyle.GreenColor,
                VerticalOptions         = LayoutOptions.CenterAndExpand,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                FontAttributes          = FontAttributes.Bold,
                Text = Total + "р."
            };
            btnOrder = new Button {
                Text              = "Оформить",
                FontSize          = Utils.GetSize(18),
                TextColor         = Color.White,
                BackgroundColor   = ApplicationStyle.LabelColor,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                HeightRequest     = heightBot,
                BorderRadius      = 0,
            };
            btnOrder.Clicked += ClickCheckOut;

            gridBottom.Children.Add(lblTotal, 0, 0);
            gridBottom.Children.Add(btnOrder, 1, 0);

            StackLayout layoutBottom = new StackLayout {
                Spacing  = 0,
                Children =
                {
                    new BoxView {
                        VerticalOptions = LayoutOptions.EndAndExpand
                    },
                    gridBottom
                }
            };

            scrollBody = new ScrollView {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Content         = layoutBody
            };
            mainGrid = new Grid {
                VerticalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions  =
                {
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = Utils.GetSize(50),
                    },
                },
                BackgroundColor = Color.Green
            };
            mainGrid.Children.Add(scrollBody, 0, 0);
            mainGrid.Children.Add(layoutBottom, 0, 1);

            layoutMain = new StackLayout {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 0,
                Children        =
                {
                    scrollBody,
                    layoutBottom,
                }
            };
            indicator = new ActivityIndicator {
                Color           = Device.OnPlatform(Color.Black, Color.Gray, Color.Default),
                IsRunning       = true,
                IsVisible       = true,
                VerticalOptions = LayoutOptions.CenterAndExpand,
            };

            Content = indicator;
            SetDeliveryAsync();
        }
コード例 #5
0
        public AuthorizationView()
        {
            entEmail = new EntryExtension {
                Placeholder = "E-mail*",
                Keyboard    = Keyboard.Email,
            };

            entPassword = new MyEntry {
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Placeholder       = "Пароль*",
                IsPassword        = true,
            };
            TapGestureRecognizer tapLayout = new TapGestureRecognizer();

            tapLayout.Tapped += (sender, e) => { entPassword.Focus(); };
            this.GestureRecognizers.Add(tapLayout);

            Button btnResetPassword = new Button {
                TextColor       = ApplicationStyle.GreenColor,
                BackgroundColor = Color.Transparent,
                FontSize        = Utils.GetSize(14),
                Text            = "Забыли?"
            };

            btnResetPassword.Clicked += OnClickReset;

            StackLayout layoutPassword = new StackLayout {
                HeightRequest     = Utils.GetSize(43),
                Padding           = new Thickness(8, 0),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Horizontal,
                Children          =
                {
                    entPassword,
                    btnResetPassword,
                }
            };

            StackLayout layoutBlockPassword = new StackLayout {
                Spacing  = 0,
                Children =
                {
                    layoutPassword,
                    new BoxView()
                }
            };


            btnLogin = new Button {
                Text = "Войти", HeightRequest = Utils.GetSize(43)
            };
            btnLogin.Clicked += (s, e) => {
                activityIndicator.IsRunning = true;
                ClickLogin(s, entEmail.textBox.Text, entPassword.Text);
            };

            Button btnGoToRegitration = new Button {
                Text            = "Зарегистрироваться",
                TextColor       = ApplicationStyle.LabelColor,
                BackgroundColor = Color.White,
                HeightRequest   = Utils.GetSize(43)
            };

            btnGoToRegitration.Clicked += (sender, e) => {
                RegitrationClick(this, null);
            };
            StackLayout layoutButton = new StackLayout {
                Spacing  = 0,
                Padding  = new Thickness(8, 18),
                Children =
                {
                    btnLogin,
                    btnGoToRegitration
                }
            };

            activityIndicator = new ActivityIndicator
            {
                Color           = Device.OnPlatform(Color.Black, Color.Gray, Color.Default),
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            layoutMain = new StackLayout {
                Spacing  = 0,
                Children =
                {
                    entEmail,
                    layoutBlockPassword,
                    layoutButton,
                    activityIndicator
                }
            };

            Content = layoutMain;
        }
コード例 #6
0
        public OrderTemplate(EventHandler eventImageClick)
        {
            isInitialization = true;
            int    heightIcoMedium = 18;
            int    heightTempImg   = 133;
            double scaleIco        = (double)107 / heightTempImg;
            int    heightIco       = (int)Utils.GetSize(heightIcoMedium * scaleIco, 1);

            img = new CachedImage {
                VerticalOptions     = LayoutOptions.CenterAndExpand,
                HeightRequest       = Utils.GetSize(85),
                CacheDuration       = TimeSpan.FromDays(30),
                RetryCount          = 2,
                RetryDelay          = 250,
                BitmapOptimizations = true,
                LoadingPlaceholder  = "Zaglushka_",
            };

            imgClock = new Image {
                VerticalOptions = LayoutOptions.Start,
                Source          = Device.OnPlatform("Catalog/clock_", "clock", "clock"),
                HeightRequest   = heightIco,
                IsVisible       = false
            };
            imgSklad = new Image {
                VerticalOptions = LayoutOptions.Start,
                Source          = Device.OnPlatform("Catalog/sklad", "Sklad", "Sklad"),
                HeightRequest   = heightIco,
                IsVisible       = false
            };
            StackLayout icoLayout = new StackLayout {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.End,
                Padding           = new Thickness(0, Utils.GetSize(2), Utils.GetSize(2), 0),
                Spacing           = 2,
                Children          =
                {
                    imgClock,
                    imgSklad
                }
            };

            Grid gridImg = new Grid {
                VerticalOptions = LayoutOptions.Center,
                HeightRequest   = Utils.GetSize(85),
                WidthRequest    = Utils.GetSize(57),
                Padding         = new Thickness(0, 0, 8, 0)
            };

            gridImg.Children.Add(img, 0, 0);
            gridImg.Children.Add(icoLayout, 0, 0);

            tapImageClick         = new TapGestureRecognizer();
            tapImageClick.Tapped += (sender, e) => {
                OnePage.redirectApp.RedirectToPage(PageName.Image, false, false);
                OnePage.redirectApp.imageView.Show(Constants.PathToImage + imgPath, BasketItem.Article);
            };
            img.GestureRecognizers.Add(tapImageClick);

            lblName = new Label {
                TextColor     = ApplicationStyle.GreenColor,
                HeightRequest = Utils.GetSize(26),
                FontSize      = Utils.GetSize(12),
            };
            lblActualCount = new Label {
                TextColor = ApplicationStyle.RedColor,
                FontSize  = Utils.GetSize(11),
            };
            lblArt = new Label {
                TextColor = ApplicationStyle.TextColor,
                FontSize  = Utils.GetSize(12),
            };
            lblSize = new Label {
                TextColor = ApplicationStyle.TextColor,
                FontSize  = Utils.GetSize(12),
            };
            StackLayout layoutInfo = new StackLayout {
                Spacing  = Utils.GetSize(2),
                Padding  = new Thickness(0, 0, 0, Utils.GetSize(5)),
                Children =
                {
                    lblArt,
                    lblSize
                }
            };

            lblPriceOld = new MyLabel {
                TextColor         = ApplicationStyle.LabelColor,
                FontSize          = Utils.GetSize(11),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.End,
                IsVisible         = false,
                IsStrikeThrough   = true
            };
            lblPrice = new Label {
                TextColor       = ApplicationStyle.TextColor,
                FontSize        = Utils.GetSize(12),
                VerticalOptions = LayoutOptions.EndAndExpand,
            };
            StackLayout layoutPrice = new StackLayout {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    lblPrice,
                    lblPriceOld
                }
            };

            StackLayout infoLayout = new StackLayout {
                Spacing     = Utils.GetSize(2),
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    lblName,
                    lblActualCount,
                    layoutInfo,
                    layoutPrice,
                }
            };

            btnPlus = new Button {
                Style = ApplicationStyle.ButtonCountStyle,
                Text  = "+",
            };
            btnPlus.Clicked += OnClickPlus;

            btnMinus = new Button {
                Style = ApplicationStyle.ButtonCountStyle,
                Text  = "–",
            };
            btnMinus.Clicked += OnClickMinus;

            entCount = new MyEntry {
                WidthRequest            = Utils.GetSize(40),
                HeightRequest           = Utils.GetSize(30),
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.CenterAndExpand,
                TextColor = ApplicationStyle.TextColor,
                Padding   = new Thickness(1, 0)
            };
            entCount.TextChanged += OnCountChange;
            lblCount              = new Label {
                WidthRequest            = Utils.GetSize(40),
                HeightRequest           = Utils.GetSize(30),
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.CenterAndExpand,
                TextColor = ApplicationStyle.TextColor
            };

            actionLayout = new StackLayout {
                Spacing           = 0,
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.EndAndExpand,
                Children          =
                {
                    btnPlus,
                    entCount,
                    lblCount,
                    btnMinus,
                }
            };

            imgDelete = new Image {
                Source        = Device.OnPlatform("Basket/dot_green_delete_.png", "dot_green_delete_.png", "dot_green_delete_.png"),
                HeightRequest = Utils.GetSize(24),
            };
            layoutImgDelete = new StackLayout {
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Padding         = new Thickness(8),
                Children        =
                {
                    imgDelete
                }
            };

            TapGestureRecognizer tapDelete = new TapGestureRecognizer();

            tapDelete.Tapped += ClickDelete;
            layoutImgDelete.GestureRecognizers.Add(tapDelete);

            StackLayout layout = new StackLayout {
                Spacing           = 0,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding           = new Thickness(0, 8, 8, 8),
                Orientation       = StackOrientation.Horizontal,
                Children          =
                {
                    layoutImgDelete,
                    gridImg,
                    infoLayout,
                    actionLayout
                }
            };

            layoutMain = new StackLayout {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    layout
                }
            };
            View = layoutMain;
        }
コード例 #7
0
ファイル: ProductsSort.cs プロジェクト: galoch-s/OMShopMobile
        public ProductsSortView(FilterParam _filterParam)
        {
            filterParamDefault = _filterParam;
            VerticalOptions    = LayoutOptions.FillAndExpand;

            indicator = new ActivityIndicator {
                Color           = Device.OnPlatform(Color.Black, Color.Gray, Color.Default),
                IsRunning       = true,
                VerticalOptions = LayoutOptions.CenterAndExpand,
            };

            Label lblSort = new Label {
                Text            = "Сортировать по:",
                VerticalOptions = LayoutOptions.CenterAndExpand
            };
            StackLayout titleSortLayout = new StackLayout {
                BackgroundColor = ApplicationStyle.LineColor,
                HeightRequest   = Utils.GetSize(22),
                Padding         = new Thickness(8, 0),
                Children        =
                {
                    lblSort
                }
            };

            sortList = new ListView {
                ItemTemplate    = new DataTemplate(typeof(SortItemCell)),
                ItemsSource     = ParamSort.ParamsList,
                VerticalOptions = LayoutOptions.Start,
                RowHeight       = Utils.GetSize(43),
            };
            sortList.SizeChanged += (sender, e) => {
                sortList.HeightRequest = (sortList.RowHeight + 0.5) * ParamSort.ParamsList.Count;
            };
            sortList.ItemTapped += OnClickSort;
            Sorted(sortList, _filterParam.paramForSort);

            Label lblFilter = new Label {
                Text            = "Фильтровать по:",
                VerticalOptions = LayoutOptions.CenterAndExpand
            };
            StackLayout titleFilterLayout = new StackLayout {
                BackgroundColor = ApplicationStyle.LineColor,
//				VerticalOptions = LayoutOptions.Start,
                HeightRequest = Utils.GetSize(22),
                Padding       = new Thickness(8, 0),
                Children      =
                {
                    lblFilter
                }
            };

            sizesCell = new CellTemplate("Размеру")
            {
                HeightRequest = Utils.GetSize(43)
            };
            TapGestureRecognizer tapOrderStatusList = new TapGestureRecognizer();

            tapOrderStatusList.Tapped += OnSelectSize;;
            sizesCell.GestureRecognizers.Add(tapOrderStatusList);

            listSizes = new ListView {
                ItemTemplate = new DataTemplate(typeof(RadioButtonItemCell)),
            };
            listSizes.ItemTapped += OnClickSize;

            layoutSize = new StackLayout {
                Spacing  = 0,
                Children =
                {
                    sizesCell,
                    new BoxView(),
                    listSizes
                }
            };

            entPriceBegin = new MyEntry {
                VerticalOptions         = LayoutOptions.CenterAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                Padding           = new Thickness(5),
                BorderColor       = ApplicationStyle.LineColor,
                BorderRadius      = Utils.GetSize(3),
                BorderWidth       = Utils.GetSize(1),
                HeightRequest     = Utils.GetSize(26),
                WidthRequest      = Utils.GetSize(80),
                Placeholder       = "от",
                HorizontalOptions = LayoutOptions.EndAndExpand,
                Keyboard          = Keyboard.Numeric
            };
            entPriceEnd = new MyEntry {
                VerticalOptions         = LayoutOptions.CenterAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                Padding       = new Thickness(5),
                BorderColor   = ApplicationStyle.LineColor,
                BorderRadius  = Utils.GetSize(3),
                BorderWidth   = Utils.GetSize(1),
                HeightRequest = Utils.GetSize(26),
                WidthRequest  = Utils.GetSize(80),
                Placeholder   = "до",
                Keyboard      = Keyboard.Numeric
            };

            Label lblPriceBegin = new Label {
                VerticalOptions = LayoutOptions.CenterAndExpand,
                TextColor       = ApplicationStyle.TextColor,
                Text            = "Цене"
            };

            Label lblPriceEnd = new Label {
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Text            = " — "
            };

            StackLayout layoutPrice = new StackLayout {
                Orientation   = StackOrientation.Horizontal,
                Padding       = new Thickness(16, 0, 24, 0),
                HeightRequest = Utils.GetSize(43),
                Children      =
                {
                    lblPriceBegin,
                    entPriceBegin,
                    lblPriceEnd,
                    entPriceEnd,
                }
            };

            Button btnClear = new Button {
                BackgroundColor = Color.Transparent,
                TextColor       = ApplicationStyle.GreenColor,
                BorderColor     = ApplicationStyle.GreenColor,
                BorderWidth     = 1,
                WidthRequest    = Utils.GetSize(150),
                Text            = "СБРОСИТЬ ВСЕ",
            };

            btnClear.Clicked += OnClearClick;

            btnOk = new Button {
                BackgroundColor   = ApplicationStyle.RedColor,
                TextColor         = Color.White,
                HorizontalOptions = LayoutOptions.EndAndExpand,
                WidthRequest      = Utils.GetSize(150),
                Text = "ПРИМЕНИТЬ",
            };
            btnOk.Clicked += OnOkClick;

            StackLayout layoutBtn = new StackLayout {
                Padding       = new Thickness(8, 16),
                HeightRequest = Utils.GetSize(35),
                Orientation   = StackOrientation.Horizontal,
                Children      =
                {
                    btnClear,
                    btnOk,
                }
            };

            mainLayout = new StackLayout {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 0,
                Children        =
                {
                    titleSortLayout,
                    sortList,
                    titleFilterLayout,
                    layoutSize,
                    layoutPrice,
                    new BoxView(),
                    layoutBtn,
                }
            };
            Content = mainLayout;
        }
コード例 #8
0
ファイル: ProductView.cs プロジェクト: galoch-s/OMShopMobile
        void SetButtom()
        {
            entCount = new MyEntry {
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalOptions         = LayoutOptions.CenterAndExpand,
                TextColor      = ApplicationStyle.GreenColor,
                FontAttributes = FontAttributes.Bold,
                FontSize       = Utils.GetSize(18),
                Keyboard       = Keyboard.Numeric
            };
            entCount.TextChanged += OnCountChange;

            btnPlus = new Button {
                HeightRequest   = Utils.GetSize(49),
                WidthRequest    = Utils.GetSize(49),
                BorderRadius    = 0,
                TextColor       = ApplicationStyle.GreenColor,
                BackgroundColor = ApplicationStyle.LineColor,
                Text            = "+"
            };
            btnPlus.Clicked += OnPlusClick;

            btnMinus = new Button {
                HeightRequest   = Utils.GetSize(49),
                WidthRequest    = Utils.GetSize(49),
                BorderRadius    = 0,
                TextColor       = ApplicationStyle.GreenColor,
                BackgroundColor = ApplicationStyle.LineColor,
                Text            = "-",
            };
            btnMinus.Clicked += OnMinusClick;

            StackLayout layoutButtomCount = new StackLayout {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    btnPlus,
                    entCount,
                    btnMinus,
                }
            };
            Grid gridBottom = new Grid {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HeightRequest     = Utils.GetSize(49),
                ColumnSpacing     = 0,
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(50, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(50, GridUnitType.Star)
                    },
                },
                BackgroundColor = Color.White,
            };

            gridBottom.Children.Add(layoutButtomCount, 0, 0);
            gridBottom.Children.Add(btnOrder, 1, 0);

            layoutBottom = new StackLayout {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 0,
                Children        =
                {
                    new BoxView(),
                    gridBottom
                }
            };
        }