Ejemplo n.º 1
0
        public FirstPage()
        {
            var titleBar = new TitleBar(this, TitleBar.BarBtnEnum.bbLeftRight);
            titleBar.BarColor = Color.Gray;
            titleBar.Title = "FIRST";

            titleBar.BtnLeft.BackgroundColor = Color.Transparent;
            titleBar.BtnLeft.Source = Device.OnPlatform("Icon/2.png", "ic_2.png", "Assets/Icon/2.png");
            titleBar.BtnLeft.Click += async (s, e) => { await this.Navigation.PushAsync(new SecondPage()); };

            titleBar.BtnRight.BackgroundColor = Color.Transparent;
            titleBar.BtnRight.Source = Device.OnPlatform("Icon/3.png", "ic_3.png", "Assets/Icon/3.png");
            titleBar.BtnRight.Click += async (s, e) => { await this.Navigation.PushAsync(new ThirdPage()); };

            var stackLayout = new StackLayout
            {
                BackgroundColor = Color.Yellow,
                Children =
                {
                    titleBar,
                }
            };

            Content = stackLayout;
        }
Ejemplo n.º 2
0
        public SecondPage()
        {
            var titleBar = new TitleBar(this, TitleBar.BarBtnEnum.bbBackLeftRightRight);
            titleBar.BarColor = Color.Gray;
            titleBar.Title = "SECOND";

            titleBar.BtnBack.BackgroundColor = Color.Transparent;
            titleBar.BtnBack.Source = Device.OnPlatform("Icon/back.png", "ic_back.png", "Assets/Icon/back.png");

            titleBar.BtnLeft.BackgroundColor = Color.Transparent;
            titleBar.BtnLeft.Source = Device.OnPlatform("Icon/3.png", "ic_3.png", "Assets/Icon/3.png");
            titleBar.BtnLeft.Click += (s, e) => { this.Navigation.PushAsync(new ThirdPage()); };

            titleBar.BtnRight.BackgroundColor = Color.Transparent;
            titleBar.BtnRight.Source = Device.OnPlatform("Icon/4.png", "ic_4.png", "Assets/Icon/4.png");
            titleBar.BtnRight.Click += (s, e) => { this.Navigation.PushAsync(new FourthPage()); };

            titleBar.BtnRightRight.BackgroundColor = Color.Transparent;
            titleBar.BtnRightRight.Source = Device.OnPlatform("Icon/5.png", "ic_5.png", "Assets/Icon/5.png");
            titleBar.BtnRightRight.Click += (s, e) => { this.Navigation.PushAsync(new FifthPage()); };

            var stackLayout = new StackLayout
            {
                BackgroundColor = Color.Green,
                Children =
                {
                    titleBar,
                }
            };

            Content = stackLayout;
        }
Ejemplo n.º 3
0
        public DiscountPage()
            : base(typeof(DiscountViewModel), typeof(DiscountContentUI))
        {
            BackgroundColor = (Color)App.Current.Resources[MainStyles.MainLightBackgroundColor];

            var appBar = new TitleBar(this, TitleBar.BarBtnEnum.bbBack)
            {
                BarColor = (Color)App.Current.Resources[MainStyles.StatusBarColor]
            };
            appBar.BtnBack.BackgroundColor = Color.Transparent;
            appBar.BtnBack.Source = contentUI.IconBack;

            ContentLayout.Children.Add(appBar);

            DiscountListView = new ListViewAnimation();
            DiscountListView.HasUnevenRows = true;
            DiscountListView.SetBinding(ListView.HeightRequestProperty, new Binding("DiscountItemsCount", BindingMode.Default, new ListViewHeightConverter(), (Device.OnPlatform(109, 109, 136))));
            DiscountListView.SeparatorVisibility = SeparatorVisibility.None;
            DiscountListView.SetBinding(ListView.ItemsSourceProperty, "DiscountItems");
            DiscountListView.ItemTemplate = new DataTemplate(() => new DiscountTemplate(DiscountListView,  Device.OnPlatform(108, 108, 136)));
            DiscountListView.ItemTapped += viewModel.OnDiscountItemTapped;
            DiscountListView.IsEnabled = false;
            DiscountListView.BackgroundColor = (Color)App.Current.Resources[MainStyles.MainLightBackgroundColor];
            DiscountListView.AnimationFinished += async (s, e) => 
            {
                await Task.Delay(100);
                DiscountListView.IsEnabled = true; 
            };

            discountLayout = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Padding = Device.OnPlatform(new Thickness(0, 4), new Thickness(0, 4), new Thickness(0, 4, -12, 0)),
            };
            discountLayout.Children.Add(DiscountListView);

            var mainLayout = new AbsoluteLayout();
            if (Device.OS == TargetPlatform.WinPhone)
            {
                AbsoluteLayout.SetLayoutFlags(discountLayout, AbsoluteLayoutFlags.All);
                AbsoluteLayout.SetLayoutBounds(discountLayout, new Rectangle(0f, 0f, 1f, 1f));
                mainLayout.Children.Add(discountLayout);
            }
            else
            {
                var scrollDiscount = new ScrollView
                {
                    Content = discountLayout,
                };

                AbsoluteLayout.SetLayoutFlags(scrollDiscount, AbsoluteLayoutFlags.All);
                AbsoluteLayout.SetLayoutBounds(scrollDiscount, new Rectangle(0f, 0f, 1f, 1f));
                mainLayout.Children.Add(scrollDiscount);
            }
            ContentLayout.Children.Add(mainLayout);
        }
Ejemplo n.º 4
0
        public FifthPage()
        {
            var titleBar = new TitleBar(this, TitleBar.BarBtnEnum.bbBackRightRight);
            titleBar.BarColor = Color.Gray;
            titleBar.Title = "FIFTH";

            titleBar.BtnBack.BackgroundColor = Color.Transparent;
            titleBar.BtnBack.Source = Device.OnPlatform("Icon/back.png", "ic_back.png", "Assets/Icon/back.png");

            var stackLayout = new StackLayout
            {
                BackgroundColor = Color.Green,
                Children =
                {
                    titleBar,
                }
            };

            Content = stackLayout;
        }
Ejemplo n.º 5
0
        public ThirdPage()
        {
            var titleBarTop = new TitleBar(this, TitleBar.BarBtnEnum.bbBack, TitleBar.BarAlignEnum.baTop);
            titleBarTop.BarColor = Color.Gray;
            titleBarTop.Title = "THIRD";

            titleBarTop.BtnBack.BackgroundColor = Color.Transparent;
            titleBarTop.BtnBack.Source = Device.OnPlatform("Icon/back.png", "ic_back.png", "Assets/Icon/back.png");

            var titleBarBottom = new TitleBar(this, TitleBar.BarBtnEnum.bbLeftRight, TitleBar.BarAlignEnum.baBottom);
            titleBarBottom.BarColor = Color.Transparent;

            titleBarBottom.BtnLeft.BackgroundColor = Color.Gray;
            titleBarBottom.BtnLeft.Source = Device.OnPlatform("Icon/4.png", "ic_4.png", "Assets/Icon/4.png");
            titleBarBottom.BtnLeft.Click += (s, e) => { this.Navigation.PushAsync(new FourthPage()); };

            titleBarBottom.BtnRight.BackgroundColor = Color.Gray;
            titleBarBottom.BtnRight.Source = Device.OnPlatform("Icon/5.png", "ic_5.png", "Assets/Icon/5.png");
            titleBarBottom.BtnRight.Click += (s, e) => { this.Navigation.PushAsync(new FifthPage()); };

            var relativeLayout = new RelativeLayout
            {
                BackgroundColor = Color.Blue,
            };

            relativeLayout.Children.Add(titleBarTop,
                Constraint.Constant(0),
                Constraint.Constant(0),
                Constraint.RelativeToParent(parent => { return parent.Width; }));

            relativeLayout.Children.Add(titleBarBottom,
                Constraint.Constant(0),
                Constraint.RelativeToParent(parent => { return parent.Height - titleBarBottom.HeightBar; }),
                Constraint.RelativeToParent(parent => { return parent.Width; }));

            Content = relativeLayout;
        }
Ejemplo n.º 6
0
        public SettingsPage()
            : base(typeof(SettingsViewModel), typeof(SettingsContentUI))
        {
            BackgroundColor = (Color)App.Current.Resources[MainStyles.MainBackgroundColor];

            var appBar = new TitleBar(this, TitleBar.BarBtnEnum.bbBack)
            {
                BarColor = (Color)App.Current.Resources[MainStyles.MainBackgroundColor],
                TitleStyle = (Style)App.Current.Resources[LabelStyles.PageTitleStyle]
            };
            appBar.SetBinding(TitleBar.TitleProperty, "Title");
            appBar.BtnBack.BackgroundColor = Color.Transparent;
            appBar.BtnBack.Source = contentUI.IconBack;

            ContentLayout.Children.Add(appBar);

            var stackSettings = new StackLayout
            {
                Spacing = Device.OnPlatform(6, 6, 32),
                Padding = new Thickness(32)
            };

            #region Language setting
            var txtLangTitle = new LabelExtended
            {
                Style = (Style)App.Current.Resources[LabelStyles.SettingStyle]
            };
            txtLangTitle.SetBinding(Label.TextProperty, "CurrLanguageTitle");

            var txtLangValue = new LabelExtended
            {
                Style = (Style)App.Current.Resources[LabelStyles.SettingHintStyle]
            };
            txtLangValue.SetBinding(Label.TextProperty, "CurrLanguageName");

            var stackLang = new StackLayout
            {
                Children = 
                {
                    txtLangTitle,
                    txtLangValue
                }
            };

            var viewGesturesLang = new ViewGestures
            {
                Content = stackLang,
                DeformationValue = -5,
            };
            viewGesturesLang.BackgroundColor = this.BackgroundColor;
            viewGesturesLang.Tap += viewModel.LangSetting_Click;

            stackSettings.Children.Add(viewGesturesLang);
            #endregion

            if (Device.OS == TargetPlatform.WinPhone)
            {
                #region Map setting
                var txtMapTitle = new LabelExtended
                {
                    Style = (Style)App.Current.Resources[LabelStyles.SettingStyle]
                };
                txtMapTitle.SetBinding(Label.TextProperty, "MapTitle");

                var txtMapValue = new LabelExtended
                {
                    Style = (Style)App.Current.Resources[LabelStyles.SettingHintStyle]
                };
                txtMapValue.SetBinding(Label.TextProperty, "MapName");

                var stackMap = new StackLayout
                {
                    Children = 
                    {
                        txtMapTitle,
                        txtMapValue
                    }
                };

                var viewGesturesMap = new ViewGestures
                {
                    Content = stackMap,
                    DeformationValue = -5,
                };
                viewGesturesMap.BackgroundColor = this.BackgroundColor;
                viewGesturesMap.Tap += viewModel.MapSetting_Click;

                stackSettings.Children.Add(viewGesturesMap);
                #endregion
            }

            ContentLayout.Children.Add(stackSettings);
        }
        public DiscountDetailPage(string discountID)
            : base(typeof(DiscountDetailViewModel), typeof(DiscountDetailContentUI))
        {
            viewModel.SetDiscount(discountID);
            var fileNameConverter = new FileNameToImageConverter();

            BackgroundColor = (Color)App.Current.Resources[MainStyles.MainLightBackgroundColor];

            var mainLayout = new AbsoluteLayout();

            var appBar = new TitleBar(this, TitleBar.BarBtnEnum.bbBack)
            {
                BarColor = Color.Transparent,
            };
            appBar.BoxPadding.BackgroundColor = (Color)App.Current.Resources[MainStyles.StatusBarColor];
            appBar.BoxPadding.Opacity = 0.9;

            appBar.BtnBack.BackgroundColor = (Color)App.Current.Resources[MainStyles.StatusBarColor];
            appBar.BtnBack.Opacity = 0.9;
            appBar.BtnBack.Source = contentUI.IconBack;

            discountLayout = new StackLayout
            {
                Spacing = Device.OnPlatform(0, 0, 4),
            };

            #region Photo
            var imageLayout = new RelativeLayout 
            {
                HeightRequest = Device.OnPlatform(200, 200, 240)
            };

            var imgPhoto = new Image
            {
                Aspect = Aspect.AspectFill,
            };
            imgPhoto.SetBinding(Image.SourceProperty, new Binding("ImageFileName", BindingMode.Default, fileNameConverter));

            //imgPhoto.SetBinding(Image.SourceProperty, new Binding("ImgPhoto", BindingMode.Default, new FileStreamToImageSource(), FileStreamToImageSource.SizeImage.siBig));

            imageLayout.Children.Add(imgPhoto,
                Constraint.Constant(0),
                Constraint.Constant(0), 
                Constraint.RelativeToParent(parent => { return parent.Width; }),
                Constraint.RelativeToParent(parent => { return parent.Height; })
                );
            #endregion

            #region Label percent
            int sizeImgLabel = Device.OnPlatform(60, 60, 80);

            var imgLabel = new Image
            {
                HeightRequest = sizeImgLabel,
                WidthRequest = sizeImgLabel,
                Source = contentUI.ImgPercentLabel
            };

            var labelLayout = new AbsoluteLayout();
            AbsoluteLayout.SetLayoutFlags(imgLabel, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(imgLabel, new Rectangle(0f, 0f, 1f, 1f));
            labelLayout.Children.Add(imgLabel);

            imageLayout.Children.Add(labelLayout,
                Constraint.RelativeToParent(parent =>
                {
                    return parent.Width - sizeImgLabel - 5;
                }),
                Constraint.RelativeToView(imgPhoto, (parent, sibling) =>
                {
                    return sibling.Y + sibling.Height - sizeImgLabel - 5;
                }));

            // Percent
            var txtPercent = new Label
            {
                Style = (Style)App.Current.Resources[LabelStyles.LabelPercentStyle]
            };
            txtPercent.SetBinding(Label.TextProperty, "DiscountPercent");

            var percentLayout = new StackLayout
            {
                Spacing = 0,
                Orientation = StackOrientation.Horizontal,
                Children =
                {
                    txtPercent,
                    new Label
                    { 
                        Style = (Style)App.Current.Resources[LabelStyles.LabelPercentSymbolStyle],
                        VerticalOptions = LayoutOptions.End
                    }
                }
            };
            
            percentLayout.Rotation = -15; 
            AbsoluteLayout.SetLayoutFlags(percentLayout, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(percentLayout,
                new Rectangle(0.6, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)
            );
            labelLayout.Children.Add(percentLayout);

            discountLayout.Children.Add(imageLayout);
            #endregion

            #region Header
            Grid gridHeader = new Grid
            {
                VerticalOptions = LayoutOptions.Start,
                Padding = new Thickness(10),
                RowDefinitions = 
                    {
                        new RowDefinition { Height = GridLength.Auto }
                    },
                ColumnDefinitions = 
                    {
                        new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                        new ColumnDefinition { Width = new GridLength(4, GridUnitType.Star) }
                    }
            };

            #region Company logo
            var imgCompanyLogo = new Image
            {
                WidthRequest = Device.OnPlatform(64, 64, 64),
                HeightRequest = Device.OnPlatform(64, 64, 64),
                Aspect = Aspect.AspectFit
            };
            imgCompanyLogo.SetBinding(Image.SourceProperty, new Binding("LogoFileName", BindingMode.Default, fileNameConverter));
            //imgCompanyLogo.SetBinding(Image.SourceProperty, new Binding("ImgLogo", BindingMode.Default, new FileStreamToImageSource(), FileStreamToImageSource.SizeImage.siSmall));

            var stackCompanyLogo = new StackLayout
            {
                VerticalOptions = LayoutOptions.Center,
                Children = { imgCompanyLogo }
            };

            gridHeader.Children.Add(stackCompanyLogo, 0, 0);
            #endregion

            #region Category list
            var stackCategories = new StackLayout
            {
                Spacing = 10,
                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.End
            };

            for (var i = 0; i < viewModel.CategoriesCount; i++)
            {
                var txtCategory = new Label
                {
                    Style = (Style)App.Current.Resources[LabelStyles.CategoryStyle]
                };

                txtCategory.Text = viewModel.CategoryIndexName(i);
                txtCategory.BackgroundColor = viewModel.CategoryIndexColor(i);

                var categoryLayout = new StackLayout
                {
                    Padding = Device.OnPlatform(new Thickness(4), new Thickness(4), new Thickness(6)),
                    VerticalOptions = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.End,
                    Children =
                        {
                            txtCategory
                        }
                };
                categoryLayout.BackgroundColor = viewModel.CategoryIndexColor(i);

                stackCategories.Children.Add(categoryLayout);
            }
            #endregion

            var titleDetailLayout = new StackLayout
            {
                Padding = new Thickness (2, 0, 0, 0),
                Spacing = Device.OnPlatform(0, 0, 4),
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            titleDetailLayout.Children.Add(stackCategories);

            #region Name company
            var txtPartnerName = new Label
            {
                Style = (Style)App.Current.Resources[LabelStyles.DetailTitleStyle],
                HorizontalOptions = LayoutOptions.Start
            };
            txtPartnerName.SetBinding(Label.TextProperty, "NameCompany");
            titleDetailLayout.Children.Add(txtPartnerName);
            #endregion

            #region Url address
            var txtUrlAddress = new LabelExtended
            {
                Style = (Style)App.Current.Resources[LabelStyles.LinkStyle],
                TextColor = Color.FromHex("777"),
                HorizontalOptions = LayoutOptions.Start
            };
            txtUrlAddress.SetBinding(Label.TextProperty, "UrlAddress");
            
            var viewGesturesURL = new ViewGestures
            {
                Content = txtUrlAddress,
                DeformationValue = -5,
            };
            viewGesturesURL.BackgroundColor = this.BackgroundColor;
            viewGesturesURL.Tap += viewModel.txtUrlAddress_Click;
            titleDetailLayout.Children.Add(viewGesturesURL);
            #endregion

            gridHeader.Children.Add(titleDetailLayout, 1, 0);

            discountLayout.Children.Add(gridHeader);
            #endregion

            #region Description
            var txtDescription = new Label
            {
                Style = (Style)App.Current.Resources[LabelStyles.DescriptionStyle],
                LineBreakMode = LineBreakMode.WordWrap
            };
            txtDescription.SetBinding(Label.TextProperty, "Description");

            var descriptionLayout = new StackLayout
            {
                Padding = new Thickness(18, 0),
                Children =
                {
                    txtDescription
                }
            };
            discountLayout.Children.Add(descriptionLayout);
            #endregion

            discountLayout.VerticalOptions = LayoutOptions.Start;
            var scrollDiscount = new ScrollView
            {
                VerticalOptions = LayoutOptions.Start,
                Content = discountLayout,
                HeightRequest = Device.OnPlatform(600, 600, -1),
            };

            mainLayout.VerticalOptions = LayoutOptions.StartAndExpand ;
            AbsoluteLayout.SetLayoutFlags(scrollDiscount, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(scrollDiscount, new Rectangle(0f, 0f, 1f, 1f));
            mainLayout.Children.Add(scrollDiscount);

            AbsoluteLayout.SetLayoutFlags(appBar, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(appBar,
                new Rectangle(0, 0, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            mainLayout.Children.Add(appBar);

            ContentLayout.Children.Add(mainLayout);

            if (Device.OS == TargetPlatform.iOS)
                InitBranchListView();
        }
Ejemplo n.º 8
0
        public MainPage()
            : base(typeof(MainViewModel), typeof(MainContentUI), PanelSetEnum.psLeftRight)
        {
            BackgroundColor = (Color)App.Current.Resources[MainStyles.ListBackgroundColor];

            var appBar = new TitleBar(this, TitleBar.BarBtnEnum.bbLeftRight, TitleBar.BarAlignEnum.baBottom)
            {
                BarColor = Color.Transparent,
                HorizontalOptions = LayoutOptions.FillAndExpand  
            };
            appBar.BtnRight.BackgroundColor = new Color(255, 255, 255, 0);
            appBar.BtnRight.Source = contentUI.IconMenuSideBar;
            appBar.BtnRight.Click += viewModel.AppBar_BtnRightClick;

            appBar.BtnLeft.BackgroundColor = new Color(255, 255, 255, 0);
            appBar.BtnLeft.Source = contentUI.IconFilter;
            appBar.BtnLeft.Click += viewModel.AppBar_BtnLeftClick;

            RightPanel.BackgroundColor = (Color)App.Current.Resources[MainStyles.MainBackgroundColor];
            RightPanel.Opacity = 0.9;
            SpeedAnimatePanel = 200;

            LeftPanel.BackgroundColor = (Color)App.Current.Resources[MainStyles.MainBackgroundColor];
            LeftPanel.Opacity = 0.9;

            MapLocation = new MapTile
            {
                HasScrollEnabled = true,
                HasZoomEnabled = true,
                Context = contentUI,
            };

            MapLocation.ClickPinDetail += viewModel.MapLocation_ClickPinDetail;

            var btnLocation = new ImageButton();
            btnLocation.HeightRequest = appBar.HeightBar;
            btnLocation.WidthRequest = appBar.HeightBar;
            btnLocation.BackgroundColor = new Color(255, 255, 255, 0);
            btnLocation.Source = contentUI.IconLocation;
            btnLocation.Click += viewModel.BtnLocation_Click;

            var mainLayout = new RelativeLayout();
            mainLayout.Children.Add(MapLocation.MapLayout,
                Constraint.Constant(0),
                Constraint.Constant(0),
                Constraint.RelativeToParent(parent => { return parent.Width; }),
                Constraint.RelativeToParent(parent => { return parent.Height; }));
            
            mainLayout.Children.Add(appBar,
                Constraint.Constant(0),
                Constraint.RelativeToParent(parent => { return parent.Height - appBar.HeightBar; }),
                Constraint.RelativeToParent(parent => { return parent.Width; }),
                Constraint.Constant(appBar.HeightBar));

            mainLayout.Children.Add(btnLocation,
                Constraint.Constant(0),
                Constraint.RelativeToView(appBar, (parent, sibling) =>
                {
                    return sibling.Y - appBar.HeightBar - 10;
                }));       
            ContentLayout.Children.Add(mainLayout);

            PanelChanged += (s, e) => 
            {
                if (e.IsShow)
                    MapLocation.CloseDetailInfo();
            };

            #region Right SideBar menu
            RightPanel.ClearContext();
            RightPanel.AddToContext(new BoxView
                {
                    BackgroundColor = Color.Transparent,
                    HeightRequest = 50,
                });

            var imgLogo = new Image
            {
                Source = ImageSource.FromFile(contentUI.ImgLogo),
                HeightRequest = Device.OnPlatform(-1, -1, 120),
            };
            RightPanel.AddToContext(imgLogo);

            RightPanel.AddToContext(new BoxView
                {
                    BackgroundColor = Color.Transparent,
                    HeightRequest = 50,
                });

            var menuView = new ListViewExtended();
            menuView.SetBinding(ListView.ItemsSourceProperty, "MenuItemList");
            menuView.RowHeight = Device.OnPlatform(48, 48, 72);
            menuView.SeparatorVisibility = SeparatorVisibility.None;
            menuView.ItemTemplate = new DataTemplate(() => new MenuViewTemplate());
            menuView.ItemSelected += viewModel.OnMenuViewItemTapped;
            menuView.IsScrollable = false;
            RightPanel.AddToContext(menuView, false);
            #endregion

            #region Left SideBar menu
            LeftPanel.ClearContext();
            
            LeftPanel.AddToContext(new BoxView
            {
                BackgroundColor = Color.Transparent,
                HeightRequest = 50,
            });
            
            var filterView = new ListViewExtended();
            filterView.IsScrollable = false;
            filterView.SetBinding(ListView.ItemsSourceProperty, "FilterCategoryList");
            filterView.RowHeight = Device.OnPlatform(48, 48, 72);
            filterView.SeparatorVisibility = SeparatorVisibility.None;
            filterView.ItemTemplate = new DataTemplate(() => new FilterViewTemplate(viewModel));
            filterView.ItemSelected += viewModel.OnMenuViewItemTapped;
            LeftPanel.AddToContext(filterView, false);
            #endregion
        }
Ejemplo n.º 9
0
        public AboutPage()
            : base(typeof(AboutViewModel), typeof(AboutContentUI))
        {
            BackgroundColor = (Color)App.Current.Resources[MainStyles.MainBackgroundColor];

            var appBar = new TitleBar(this, TitleBar.BarBtnEnum.bbBack)
            {
                BarColor = (Color)App.Current.Resources[MainStyles.StatusBarColor]
            };
            appBar.BtnBack.BackgroundColor = Color.Transparent;
            appBar.BtnBack.Source = contentUI.IconBack;

            ContentLayout.Children.Add(appBar);

            #region Logo
            var imgLogo = new Image
            {
                Source = contentUI.ImgLogo,
                HeightRequest = Device.OnPlatform(-1, -1, 150),
            };
            #endregion

            #region Description info
            var txtDescription = new Label
            {
                Text = contentUI.TxtDescription,
                Style = (Style)App.Current.Resources[LabelStyles.DescriptionLightStyle],
            };

            var txtDescriptionBullet1 = new Label
            {
                Text = contentUI.TxtDescriptionBullet1,
                Style = (Style)App.Current.Resources[LabelStyles.DescriptionLightStyle],
            };

            var stackDescriptionBullet1 = new StackLayout
            {
                Padding = new Thickness(12, 0, 0, 0),
                Orientation = StackOrientation.Horizontal,
                Children =
                {
                    new Label 
                    {
                        VerticalOptions = LayoutOptions.Start,
                        Text = contentUI.TxtDescriptionBulletSymbol,
                        Style = (Style)App.Current.Resources[LabelStyles.DescriptionLightStyle],
                    },
                    new Label 
                    {
                        Text = contentUI.TxtDescriptionBullet1,
                        Style = (Style)App.Current.Resources[LabelStyles.DescriptionLightStyle],
                    },
                }
            };

            var stackDescriptionBullet2 = new StackLayout
            {
                Padding = new Thickness(12, 0, 0, 0),
                Orientation = StackOrientation.Horizontal,
                Children =
                {
                    new Label 
                    {
                        VerticalOptions = LayoutOptions.Start,
                        Text = contentUI.TxtDescriptionBulletSymbol,
                        Style = (Style)App.Current.Resources[LabelStyles.DescriptionLightStyle],
                    },
                    new Label 
                    {
                        Text = contentUI.TxtDescriptionBullet2,
                        Style = (Style)App.Current.Resources[LabelStyles.DescriptionLightStyle],
                    },
                }
            };

            var stackDescriptionBullet3 = new StackLayout
            {
                Padding = new Thickness(12, 0, 0, 0),
                Orientation = StackOrientation.Horizontal,
                Children =
                {
                    new Label 
                    {
                        VerticalOptions = LayoutOptions.Start,
                        Text = contentUI.TxtDescriptionBulletSymbol,
                        Style = (Style)App.Current.Resources[LabelStyles.DescriptionLightStyle],
                    },
                    new Label 
                    {
                        Text = contentUI.TxtDescriptionBullet3,
                        Style = (Style)App.Current.Resources[LabelStyles.DescriptionLightStyle],
                    },
                }
            };

            var stackDescription = new StackLayout
            {
                Children = 
                {
                    txtDescription,
                    stackDescriptionBullet1,
                    stackDescriptionBullet2,
                    stackDescriptionBullet3
                }
            };

            //because apple might reject application
            if (Device.OS != TargetPlatform.iOS)
            {
                var txtDescriptionLink = new LabelExtended
                {
                    Text = contentUI.TxtDescriptionLink,
                    Style = (Style)App.Current.Resources[LabelStyles.LinkStyle],
                    TextColor = (Color)App.Current.Resources[MainStyles.LightTextColor],
                    LineBreakMode = LineBreakMode.WordWrap,
                    IsUnderline = true
                };

                var viewGesturesLink = new ViewGestures
                {
                    Content = txtDescriptionLink,
                    DeformationValue = -5,
                };
                viewGesturesLink.BackgroundColor = this.BackgroundColor;
                viewGesturesLink.Tap += viewModel.txtLink_Click;
                stackDescription.Children.Add(viewGesturesLink);
            }
            #endregion

            #region Version info
            var txtTitleVersion = new Label 
            {
                Text = contentUI.TitleVersion,
                Style = (Style)App.Current.Resources[LabelStyles.DescriptionStyle],
                TextColor = (Color)App.Current.Resources[MainStyles.LightTextColor],
                Opacity = 0.5
            };

            var txtNumberVersion = new Label 
            {
                Text = contentUI.TxtVersionValue,
                Style = (Style)App.Current.Resources[LabelStyles.DescriptionLightStyle],
            };

            var stackVersion = new StackLayout
            {
                Children =
                {
                    txtTitleVersion,
                    txtNumberVersion
                }
            };
            #endregion

            #region Developer info
            var stackDeveloper = new StackLayout();

            var txtTitleDeveloper = new Label
            {
                Text = contentUI.TitleDeveloper,
                Style = (Style)App.Current.Resources[LabelStyles.DescriptionStyle],
                TextColor = (Color)App.Current.Resources[MainStyles.LightTextColor],
                Opacity = 0.5
            };
            stackDeveloper.Children.Add(txtTitleDeveloper);

            var txtPhone = new LabelExtended
            {
                Text = String.Format("{0}: {1}", contentUI.TxtPhone, contentUI.TxtPhoneValue),
                Style = (Style)App.Current.Resources[LabelStyles.DescriptionStyle],
                TextColor = (Color)App.Current.Resources[MainStyles.LightTextColor]
            };
            
            var viewGesturesPhone = new ViewGestures
            {
                Content = txtPhone,
                DeformationValue = -5,
            };
            viewGesturesPhone.BackgroundColor = this.BackgroundColor;
            viewGesturesPhone.Tap += viewModel.txtPhone_Click;
            stackDeveloper.Children.Add(viewGesturesPhone);

            var txtEmail = new Label
            {
                Text = String.Format("{0}: {1}", contentUI.TxtEmail, contentUI.TxtEmailValue),
                Style = (Style)App.Current.Resources[LabelStyles.DescriptionStyle],
                TextColor = (Color)App.Current.Resources[MainStyles.LightTextColor]
            };
            stackDeveloper.Children.Add(txtEmail);

            var txtHttp = new LabelExtended
            {
                Text = contentUI.TxtHttpValue,
                Style = (Style)App.Current.Resources[LabelStyles.LinkStyle],
                TextColor = (Color)App.Current.Resources[MainStyles.LightTextColor],
                IsUnderline = true
            };

            var viewGesturesHTTP = new ViewGestures
            {
                Content = txtHttp,
                DeformationValue = -5,
            };
            viewGesturesHTTP.BackgroundColor = this.BackgroundColor;
            viewGesturesHTTP.Tap += viewModel.txtLink_Click;
            stackDeveloper.Children.Add(viewGesturesHTTP);

            #endregion

            var stackAbout = new StackLayout
            {
                Padding = new Thickness(24),
                Spacing = 20,

                Children =
                {
                    imgLogo,
                    stackDescription,
                    stackVersion,
                    stackDeveloper
                }
            };

            var scrollAbout = new ScrollView
            {
                Content = stackAbout
            };

            ContentLayout.Children.Add(scrollAbout);
        }