コード例 #1
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;
        }
コード例 #2
0
        public ConactsInfoView()
        {
            WebView browser = new WebView {
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            HtmlWebViewSource htmlSource = new HtmlWebViewSource();

//			<link rel="stylesheet" href="default.css">
            htmlSource.Html = @"<html>
<head>
<style type=""text/css"">
	@font-face{ font-family: MyriadProRegular; src: url("     + Device.OnPlatform("Fonts/MyriadProRegular.ttf", "MyriadProRegular.ttf", "MyriadProRegular.ttf") + @")}
   body,p {
	color: #333333;
	font-size: "     + Utils.GetSize(14) + @"px;
    font-family: MyriadProRegular;
    text-align: justify;
}
h3 {
	font-size: "     + Utils.GetSize(14) + @"px;
	margin-bottom: 5px;
	color: #009F9C;
}
.green {
	color: #009F9C;
}
  </style>
</head>
<body>
<h3>Наши контакты</h3>
Уважаемые клиенты! <br>
Используя приведенные ниже возможности Вы можете проконсультироваться по всем вопросам работы сайта, проведения оплаты, отгрузки товара. <br><br>
График работы специалистов контактного центра &laquo;Одежда-Мастер&raquo;: пн.-пт.: с 9-00 до 18-00. <br><br>
</head><body>";
            browser.Source  = htmlSource;


            MyLabel lbl1 = new MyLabel {
                TextColor = ApplicationStyle.RedColor, FontAttributes = FontAttributes.Bold, LineSpacing = 2f, Text = "Наши контакты",
            };
            MyLabel lbl2 = new MyLabel {
                TextColor = ApplicationStyle.TextColor, LineSpacing = 2f, Text = "Уважаемые клиенты!"
            };
            MyLabel lbl3 = new MyLabel {
                TextColor   = ApplicationStyle.TextColor,
                LineSpacing = 1.2f,
                Text        = "Используя приведенные ниже возможности Вы можете проконсультироваться по всем вопросам работы сайта, проведения оплаты, отгрузки товара.",
            };
            MyLabel lbl4 = new MyLabel {
                TextColor   = ApplicationStyle.TextColor,
                LineSpacing = 1.2f,
                Text        = "График работы специалистов контактного центра «Одежда-Мастер»: пн.-пт.: с 9-00 до 18-00.",
            };

            StackLayout layoutContacts = new StackLayout {
                Spacing  = 10,
                Children =
                {
                    GetContact(Device.OnPlatform("Info/skype.png", "skype.png", "skype.png"), "Skype для связи",             "odezhda-master1",   "skype:odezhda-master1?chat"),
                    GetContact(Device.OnPlatform("Info/phone.png", "phone.png", "phone.png"), "Телефон горячей линии",       "+7 (495) 204-1583", "tel:+79109960134"),
                    GetContact(Device.OnPlatform("Info/phone.png", "phone.png", "phone.png"), "Для клиентов из Москвы и МО", "+7 (910) 996-0134", "tel:+79109960134"),
                }
            };
            StackLayout layoutMain = new StackLayout {
                Spacing  = 0,
                Padding  = new Thickness(8, 8),
                Children =
                {
                    //					browser,
                    lbl1,
                    new Label {
                        HeightRequest = 8,Text                   = " "
                    },
                    lbl2,
                    new Label {
                        HeightRequest = 8,Text                   = " "
                    },
                    lbl3,
                    new Label {
                        Text = " "
                    },
                    lbl4,
                    new Label {
                        Text = " "
                    },
                    layoutContacts
                }
            };

            Content = layoutMain;
        }
コード例 #3
0
        public ProductInCategoryTemplate()
        {
            double paddingLayput = Utils.GetSize(0.5);

            Padding = new Thickness(paddingLayput, paddingLayput, paddingLayput, 0);

            BackgroundColor = ApplicationStyle.LineColor;
            imgHeight       = (int)Utils.GetSize(App.Density * 140, 1);     // 133;
            imgWidth        = (int)Utils.GetSize(App.Density * 180, 1);     // 166;

            cachedImage = new CachedImage()
            {
                VerticalOptions    = LayoutOptions.FillAndExpand,
                HorizontalOptions  = LayoutOptions.FillAndExpand,
                HeightRequest      = Utils.GetSize(133, 1),
                CacheDuration      = TimeSpan.FromDays(30),
                Margin             = new Thickness(0, 5 * App.ScaleWidth, 0, 0),
                LoadingPlaceholder = "Zaglushka_",
                RetryCount         = 2
            };

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

            Grid gridImg = new Grid();            // { HeightRequest = 136 };

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

            lblName = new Label {
                LineBreakMode     = LineBreakMode.TailTruncation,
                TextColor         = ApplicationStyle.TextColor,
                FontSize          = Utils.GetSize(14),
                HorizontalOptions = LayoutOptions.Center,
            };
            lblPriceOld = new MyLabel {
                TextColor         = ApplicationStyle.LabelColor,
                FontSize          = Utils.GetSize(11),
                HorizontalOptions = LayoutOptions.Center,
                Margin            = new Thickness(0, 8, 0, 5),
                IsVisible         = false,
                IsStrikeThrough   = true
            };
            lblPrice = new Label {
                TextColor         = ApplicationStyle.GreenColor,
                FontSize          = Utils.GetSize(12),
                HorizontalOptions = LayoutOptions.Center,
                Margin            = new Thickness(0, 8, 0, 5),
            };
            StackLayout layoutPrice = new StackLayout {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    lblPriceOld,
                    lblPrice
                }
            };

            lblSize = new Label {
                LineBreakMode     = LineBreakMode.TailTruncation,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                FontSize          = Utils.GetSize(10),
            };

            BoxView bottomLine = new BoxView {
                VerticalOptions = LayoutOptions.EndAndExpand,
                BackgroundColor = ApplicationStyle.GreenColor,
                HeightRequest   = 1.5,
            };

            StackLayout layoutDescription = new StackLayout {
                VerticalOptions = LayoutOptions.End,
                Spacing         = 0,
                Padding         = new Thickness(8, 0),
                Children        =
                {
                    lblName,
                    layoutPrice,
                    lblSize,
                }
            };

            StackLayout layout = new StackLayout {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 5,
                BackgroundColor = Color.White,
                Orientation     = StackOrientation.Vertical,
                Children        =
                {
                    gridImg,
                    layoutDescription,
                    bottomLine
                }
            };
            TapGestureRecognizer tap = new TapGestureRecognizer();

            layout.GestureRecognizers.Add(tap);
            tap.CommandParameter = this;
            tap.Tapped          += (sender, e) => {
                if (EventClick != null)
                {
                    EventClick(sender, e);
                }
            };

            Content = layout;
        }
コード例 #4
0
ファイル: ProductView.cs プロジェクト: galoch-s/OMShopMobile
        public ProductView()
        {
            lblArticle = new Label {
                HeightRequest         = Utils.GetSize(23),
                FontSize              = Utils.GetSize(11),
                VerticalTextAlignment = TextAlignment.Center,
                Margin = new Thickness(8, 0)
            };

            BoxView artLine = new BoxView();

            img = new Image();
            if (Device.OS == TargetPlatform.Android)
            {
                img.HeightRequest = Utils.GetSize(300, 1);
            }
            else
            {
                img.HeightRequest = Utils.GetSize(300);
            }

            ImageClick = new TapGestureRecognizer();
            img.GestureRecognizers.Add(ImageClick);
            imgSklad = new Image {
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.EndAndExpand,
                Source            = Device.OnPlatform("Catalog/sklad_", "Sklad", "Sklad"),
                HeightRequest     = Utils.GetSize(18, 1),
                IsVisible         = false
            };

            Grid imgGrid = new Grid {
                Padding = new Thickness(8, 0),
            };

            imgGrid.Children.Add(img, 0, 0);
            imgGrid.Children.Add(imgSklad, 0, 0);

            lblName = new Label {
                HorizontalOptions = LayoutOptions.CenterAndExpand, Margin = new Thickness(8, 8)
            };

            lblPriceOld = new MyLabel {
                FontSize          = Utils.GetSize(17),
                TextColor         = ApplicationStyle.LabelColor,
                HorizontalOptions = LayoutOptions.Center,
                IsVisible         = false,
                IsStrikeThrough   = true
            };
            lblPrice = new Label {
                FontSize          = Utils.GetSize(18),
                TextColor         = ApplicationStyle.GreenColor,
                HorizontalOptions = LayoutOptions.Center,
            };
            StackLayout layoutPrice = new StackLayout {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Center,
                Spacing           = Utils.GetSize(10),
                Children          =
                {
                    lblPriceOld,
                    lblPrice
                }
            };

            InitSizes();

            btnTableSize = new MyButton {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                BackgroundColor   = Color.Transparent,
                HeightRequest     = Utils.GetSize(25),
                Text        = "Таблица размеров",
                FontSize    = Utils.GetSize(9),
                TextColor   = ApplicationStyle.GreenColor,
                IsUnderline = true
            };
            btnTableSize.Clicked += (sender, e) => { EventTableSizeClick(sender, e); };

            lblDescription = new MyLabel {
                LineSpacing = 1.5f
            };

            btnOrder = new Button {
                Text              = "В корзину",
                FontSize          = Utils.GetSize(15),
                TextColor         = Color.White,
                BackgroundColor   = ApplicationStyle.RedColor,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BorderRadius      = 0,
            };
            btnOrder.Clicked += BasketButtonClick;

            SetButtom();

            StackLayout layoutBody = new StackLayout {
                Spacing  = 5,
                Padding  = new Thickness(8, 5),
                Children =
                {
                    btnTableSize,
                    lblDescription
                }
            };

            Image imgClock = new Image {
                Source        = Device.OnPlatform("Catalog/clock_", "clock", "clock"),
                HeightRequest = Utils.GetSize(18, 1),
            };
            MyLabel lblTitleTimer = new MyLabel {
                TextColor       = ApplicationStyle.GreenColor,
                Text            = "Расписание доступности товара:",
                VerticalOptions = LayoutOptions.CenterAndExpand,
                FontSize        = Utils.GetSize(14),
                IsUnderline     = true,
            };

            layoutTitleTimer = new StackLayout {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Horizontal,
                Padding           = new Thickness(8, 0),
                Children          =
                {
                    imgClock,
                    lblTitleTimer
                }
            };
            TapGestureRecognizer tapLayoutTitle = new TapGestureRecognizer();

            tapLayoutTitle.Tapped += OnSelectTimer;
            layoutTitleTimer.GestureRecognizers.Add(tapLayoutTitle);

            gridTime = new Grid {
                Padding           = new Thickness(8, 0),
                ColumnSpacing     = Utils.GetSize(30),
                RowSpacing        = 0,
                IsVisible         = false,
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    },
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    },
                }
            };
            lblTime = new Label();

            layoutContent = new StackLayout {
                Padding         = new Thickness(0, 0, 0, 8),
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 0,
                Children        =
                {
                    lblArticle,
                    artLine,
                    imgGrid,
                    lblName,
                    layoutPrice,
                    layoutSize,
                    layoutBody,
                    layoutTitleTimer,
                    gridTime
                }
            };

            scrollView = new ScrollView {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Content         = layoutContent
            };

            mainGrid = new Grid {
                RowSpacing      = 0,
                VerticalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions  =
                {
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = Utils.GetSize(50)
                    },
                }
            };
            mainGrid.Children.Add(scrollView, 0, 0);
            mainGrid.Children.Add(layoutBottom, 0, 1);

            Content = mainGrid;

            VerticalOptions = LayoutOptions.FillAndExpand;
        }