Exemplo n.º 1
0
        private void Init()
        {
            _headerContainerGrid = new Grid
            {
                HorizontalOptions    = LayoutOptions.FillAndExpand,
                VerticalOptions      = LayoutOptions.Start,
                BackgroundColor      = HeaderBackgroundColor,
                MinimumHeightRequest = 50
            };

            _carouselView = new CarouselViewControl
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HeightRequest     = ContentHeight,
                ShowArrows        = false,
                ShowIndicators    = false,
                BindingContext    = this
            };

            _carouselView.PositionSelected += _carouselView_PositionSelected;

            _mainContainerSL = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          = { _headerContainerGrid, _carouselView },
                Spacing           = 0
            };

            Content = _mainContainerSL;
        }
Exemplo n.º 2
0
        private void Init()
        {
            ItemSource           = new ObservableCollection <TabItem>();
            _headerContainerGrid = new Grid
            {
                HorizontalOptions    = LayoutOptions.FillAndExpand,
                VerticalOptions      = LayoutOptions.Start,
                BackgroundColor      = HeaderBackgroundColor,
                MinimumHeightRequest = 50
            };

            _carouselView = new CarouselViewControl
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HeightRequest     = ContentHeight,
                ShowArrows        = false,
                ShowIndicators    = false,
                BindingContext    = this
            };

            _mainContainerSL = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          = { _headerContainerGrid, _carouselView },
                Spacing           = 0
            };

            Content = _mainContainerSL;
            ItemSource.CollectionChanged += ItemSource_CollectionChanged;
            SetPosition(SelectedTabIndex, true);
        }
Exemplo n.º 3
0
        public ProfilePage()
        {
            InitializeComponent();
            ProfilePageViewModel profilePageViewModel = new ProfilePageViewModel();

            BindingContext = profilePageViewModel;
            NavigationPage.SetHasNavigationBar(this, false);

            var myCarousel = new CarouselViewControl();

            myCarousel.ItemsSource = new ObservableRangeCollection <View>
            {
                new FavoritesView(), new CreditInformationView(), new FriendsView()
            };

            myCarousel.ShowIndicators  = true;
            myCarousel.IndicatorsShape = IndicatorsShape.Circle;
            //myCarousel.ItemTemplate = new MyTemplateSelector(); //new DataTemplate (typeof(MyView));
            myCarousel.BackgroundColor = Color.White;
            myCarousel.Position        = 0; //default
            //myCarousel.InterPageSpacing = 10;
            myCarousel.Orientation = CarouselViewOrientation.Horizontal;

            Frame carouselFrame = new Frame()
            {
                Content      = myCarousel,
                CornerRadius = 10,
                Padding      = 0,
                Margin       = 0,
            };

            ProfilePageGrid.Children.Add(carouselFrame, 0, 3);
            Grid.SetColumnSpan(carouselFrame, 2);
        }
Exemplo n.º 4
0
        public CarouselMain()
        {
            this.Title = "Photos";
            var carousel = new CarouselViewControl()
            {
                HeightRequest  = 300,
                ItemTemplate   = new PictureTemplateSelector(),
                ShowIndicators = true,
                //IsSwipingEnabled=true,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                //VerticalOptions = LayoutOptions.StartAndExpand,
                AnimateTransition = true,
                IndicatorsShape   = IndicatorsShape.Square,
                InterPageSpacing  = 10,
                Orientation       = CarouselViewOrientation.Horizontal,
            };

            carousel.SetBinding(CarouselViewControl.ItemsSourceProperty, "ItemSource");
            carousel.SetBinding(CarouselViewControl.PositionProperty, "Position");

            var lbl = new Label()
            {
                Margin = 10,
                Text   = "Bacon ipsum dolor amet jerky picanha beef chicken ball tip, capicola shoulder pork belly boudin prosciutto shank sausage pig hamburger. Tongue pork cupim landjaeger chuck short loin kielbasa fatback tail strip steak. Spare ribs kielbasa tenderloin jerky alcatra tri-tip pork. Spare ribs jowl shankle, ball tip alcatra ham short ribs picanha chicken drumstick. Cupim corned beef bacon, shoulder brisket ground round leberkas bresaola.\n\nT-bone beef ribs pastrami chuck. T-bone tongue swine bacon picanha, tenderloin beef strip steak. Pork loin sirloin picanha, short loin bresaola brisket alcatra corned beef venison sausage prosciutto cupim turkey boudin chicken. Sirloin capicola cupim chuck alcatra pork. Pork jerky fatback, meatball short loin tri-tip doner beef ribs bacon porchetta."
            };

            Content = new CompressedStackLayout()
            {
                Children = { carousel, new ScrollView()
                             {
                                 Content = lbl
                             } }
            };
        }
Exemplo n.º 5
0
        public async void OnToppingsCarouselScroll(object sender, ValueChangedEventArgs e)
        {
            if (sender is CarouselViewControl)
            {
                CarouselViewControl control = sender as CarouselViewControl;
                if (control.Position != LastPosition)
                {
                    var position = control.Position;
                    switch (position)
                    {
                    case 0:
                        await Navigation.PushAsync(new PizzaBasePage());

                        return;

                    case 1:
                        await Navigation.PushAsync(new ToppingsPage(CarouselViewModel.PizzaType));

                        break;

                    case 2:
                        break;

                    case 3:
                        break;
                    }
                    LastPosition = position;
                }
            }
        }
Exemplo n.º 6
0
        private CarouselViewControl CreateCarouselView()
        {
            var carouselView = new CarouselViewControl()
            {
                FlowDirection     = FlowDirection.RightToLeft,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Margin            = 0,
            };

            carouselView.SetValue(Grid.RowSpanProperty, 2);

            carouselView.SetBinding(CarouselViewControl.ItemsSourceProperty, new Binding()
            {
                Source = DataContext,
                Path   = "CarouselItems"
            });

            carouselView.SetBinding(CarouselViewControl.PositionProperty, new Binding()
            {
                Source = DataContext,
                Path   = "Position",
                Mode   = BindingMode.TwoWay,
            });

            carouselView.ItemTemplate = new DataTemplate(() => { return(CreateTemplateCarouselMainGrid()); });

            return(carouselView);
        }
Exemplo n.º 7
0
        public MainPage()
        {
            Title = "CarouselView";

            var carousel = new CarouselViewControl
            {
                ItemsSource = new ObservableCollection <View>()
                {
                    new CachedImage()
                    {
                        Source = ImageSource.FromFile("c1.jpg"), DownsampleToViewSize = true, Aspect = Aspect.AspectFill
                    },
                    new CachedImage()
                    {
                        Source = ImageSource.FromFile("c2.jpg"), DownsampleToViewSize = true, Aspect = Aspect.AspectFill
                    },
                    new CachedImage()
                    {
                        Source = ImageSource.FromFile("c3.jpg"), DownsampleToViewSize = true, Aspect = Aspect.AspectFill
                    }
                },
                ShowIndicators   = true,
                ShowArrows       = true,
                IsSwipingEnabled = true
            };

            carousel.SetBinding(CarouselViewControl.PositionSelectedCommandProperty, "MyCommand");

            Content = carousel;

            BindingContext = new MainViewModel();
        }
            //string TAG_VIEWS = "TAG_VIEWS";

            //SparseArray<Parcelable> mViewStates = new SparseArray<Parcelable>();

            //ViewPager mViewPager;



            public PageAdapter(CarouselViewControl element)

            {
                Element = element;

                Source = Element.ItemsSource != null ? new List <object>(Element.ItemsSource.GetList()) : null;
            }
Exemplo n.º 9
0
        private View ContentView()
        {
            var carousel = new CarouselViewControl
            {
                AnimateTransition = false,
                ShowArrows        = false,
                IsSwipeEnabled    = false,
                ItemsSource       = new List <DataTemplate>
                {
                    new DataTemplate(HistoryView),
                    new DataTemplate(AchievementsView),
                    new DataTemplate(GoalsView),
                    new DataTemplate(ProfileView),
                }
            };

            carousel.SetBinding(CarouselViewControl.PositionProperty, new Binding(
                                    nameof(HomeViewModel.CurrentView),
                                    BindingMode.TwoWay,
                                    new ViewToIndexConverter())
                                );
            Utils.Accessibility.Unused(carousel);

            return(carousel);
        }
Exemplo n.º 10
0
            public Layout Slide(List <SliderItem> sliders)
            {
                mSlider = new CarouselViewControl();
                List <View> children = new List <View> {
                };

                mSlider.HeightRequest = 200;
                //asdf.ShowArrows = true;
                mSlider.FlowDirection                 = FlowDirection.LeftToRight;
                mSlider.AnimateTransition             = true;
                mSlider.ShowIndicators                = true;
                mSlider.IndicatorsTintColor           = Color.Blue;
                mSlider.CurrentPageIndicatorTintColor = Color.White;

                foreach (SliderItem item in sliders)
                {
                    Image image = new Image {
                        Source = item.resim, Aspect = Aspect.Fill, ClassId = item.id, HeightRequest = 200, HorizontalOptions = LayoutOptions.Fill
                    };
                    children.Add(image);
                }


                mSlider.ItemsSource = children;

                StackLayout stack = new StackLayout {
                    HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand
                };

                stack.Children.Add(mSlider);

                return(stack);
            }
        private void InitalizeCarousel()
        {
            //For Now a set 10, but should get that number from backend
            int NumberOfwindows = 10;

            var myCarousel = new CarouselViewControl();

            myCarousel.ItemsSource = new ObservableCollection <int> {
                NumberOfwindows
            };
        }
Exemplo n.º 12
0
        public ItemDetailsPage(Item item)
        {
            _item = item;
            Title = "Item Photos";
            //Setup carousel
            DataTemplate it = new DataTemplate(typeof(ZoomableWebView));

            it.SetBinding(ZoomableWebView.SourceProperty, new Binding(".", converter: new ImageUrlHtmlValueConverter()));
            _carouselV = new CarouselViewControl {
                ShowIndicators   = true,
                ShowArrows       = false,
                InterPageSpacing = 10,
                ItemTemplate     = it
            };
            Content = _carouselV;
        }
Exemplo n.º 13
0
        private void Init()
        {
            ItemSource = new ObservableCollection <TabItem>();

            _headerContainerGrid = new Grid
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Start,
                // BackgroundColor = Color.White, // tab sepeartor color
                MinimumHeightRequest = 50,
                ColumnSpacing        = 0, // seperator thickness
            };

            _tabHeadersContainerSv = new ScrollView()
            {
                HorizontalScrollBarVisibility = ScrollBarVisibility.Never,
                Orientation       = ScrollOrientation.Horizontal,
                Content           = _headerContainerGrid,
                BackgroundColor   = HeaderBackgroundColor,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            _carouselView = new CarouselViewControl
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HeightRequest     = ContentHeight,
                ShowArrows        = false,
                ShowIndicators    = false,
                BindingContext    = this
            };

            _carouselView.PropertyChanged  += _carouselView_PropertyChanged;
            _carouselView.PositionSelected += _carouselView_PositionSelected;

            _mainContainerSL = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          = { _tabHeadersContainerSv, _carouselView },
                Spacing           = 0
            };

            Content = _mainContainerSL;
            ItemSource.CollectionChanged += ItemSource_CollectionChanged;
            SetPosition(SelectedTabIndex, true);
        }
Exemplo n.º 14
0
        public ResultsDetailsPage(NeuralNet neuralnet, MNISTDataManager mnistdata)
        {
            // Save parameters
            this.neuralnet = neuralnet;
            this.mnistdata = mnistdata;

            // Define GUI

            // Page properties
            Title           = "Details";
            BackgroundColor = Color.SteelBlue;
            Padding         = new Thickness(Application.Current.MainPage.Width * 0.05, Application.Current.MainPage.Height * 0.05);

            // Step 1: Generate initial collection of pictures from MNIST database (buffersize elements)
            pictures = new ObservableCollection <CarouselItem>();
            AddPictures(0);

            // Step 2: Generate data template (just a Image with data binding to CarouselItem class)
            DataTemplate template = new DataTemplate(() =>
            {
                Image image = new Image();
                image.SetBinding(Image.SourceProperty, "Picture");
                return(image);
            });

            // Step 3: Generate carousel view
            var myCarousel = new CarouselViewControl();

            myCarousel.Position          = 0; //default
            myCarousel.ItemsSource       = pictures;
            myCarousel.ItemTemplate      = template;
            myCarousel.InterPageSpacing  = 2;
            myCarousel.Orientation       = CarouselViewOrientation.Horizontal;
            myCarousel.ShowIndicators    = false;
            myCarousel.HorizontalOptions = LayoutOptions.FillAndExpand;
            myCarousel.VerticalOptions   = LayoutOptions.FillAndExpand;

            // Define labels
            labelheadline       = new Label();
            labeldigitcorrect   = new Label();
            labeldigitanswernet = new Label
            {
                HorizontalOptions     = LayoutOptions.FillAndExpand,
                HeightRequest         = Application.Current.MainPage.Height * 0.1,
                VerticalTextAlignment = TextAlignment.Center
            };
            SetLabels(0);

            // Step 4: Build page
            Content = new ScrollView
            {
                Content = new StackLayout
                {
                    Children = { labelheadline, labeldigitcorrect, myCarousel, labeldigitanswernet },
                    Spacing  = Application.Current.MainPage.Height * 0.05
                }
            };

            // Update page when image is swiped
            myCarousel.PositionSelected += (s, e) =>
            {
                // Add new pictures if user has reached end of carousel
                // KNOWN ERROR: When end is reached the wrong picture is displayed (first picture of uploaded data)
                // Warning: stepping through all MINST data may yield to memory problems
                if (myCarousel.Position == pictures.Count - 1)
                {
                    AddPictures(myCarousel.Position + 1);
                }

                // Update label
                SetLabels(myCarousel.Position);
            };
        }
Exemplo n.º 15
0
        public PerfilPage()
        {
            Title = "Perfil & Colaboradores";
            NavigationPage.SetBackButtonTitle(this, "");
            headerBackground = new Image()
            {
                Source = "headerPerfil.png",
                Aspect = Aspect.AspectFill
            };

            Contenido = new RelativeLayout();
            Contenido.Children.Add(headerBackground,
                                   xConstraint: Constraint.Constant(0),
                                   yConstraint: Constraint.Constant(0),
                                   widthConstraint: Constraint.RelativeToParent((parent) => { return(parent.Width); }),
                                   heightConstraint: Constraint.Constant(100)
                                   );

            tabs = new Grid
            {
                HeightRequest   = 40,
                RowSpacing      = 0,
                ColumnSpacing   = 0,
                Padding         = 0,
                BackgroundColor = Color.FromHex("23593A"),
                VerticalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions  =
                {
                    new RowDefinition {
                        Height = new GridLength(40, GridUnitType.Star)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            usuario = new Label
            {
                TextColor  = Color.FromHex("187041"),
                FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                Text       = "USUARIO",
                FontSize   = 12,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalOptions       = LayoutOptions.Center,
            };
            username = new Label
            {
                TextColor  = Color.FromHex("187041"),
                FontFamily = Device.OnPlatform("OpenSans", "OpenSans-Regular", null),
                FontSize   = 10,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.Center,
            };

            /*perfiles perfil = App.database.GetPerfil(Convert.ToInt32(Settings.session_idUsuario));
             * if ((perfil != null) || !string.IsNullOrEmpty(perfil.Short_Nm))
             * {
             *  if (perfil.Short_Nm.Length <= 3)
             *      username.Text = "(" + perfil.Short_Nm.ToUpper() + ")";
             *  else
             *      username.Text = "(" + perfil.Short_Nm.Substring(0, 3).ToUpper() + ")";
             * }
             * else
             *  username.Text = "(" + Settings.session_User_Nm.Substring(0, 3).ToUpper() + ")";*/
            cuenta = new Label
            {
                TextColor               = Color.White,
                FontFamily              = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                Text                    = "EMPRESA",
                FontSize                = 12,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
            };
            contrasenia = new Label
            {
                TextColor               = Color.White,
                FontFamily              = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                Text                    = "COLABORADORES",
                FontSize                = 12,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
            };

            Usuario = new StackLayout
            {
                Spacing           = 0,
                BackgroundColor   = Color.White,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new StackLayout {
                        VerticalOptions = LayoutOptions.CenterAndExpand, Spacing = 0, Children ={ usuario,                                                              username }
                    }
                }
            };
            Cuenta = new StackLayout
            {
                Spacing           = 0,
                BackgroundColor   = Color.FromHex("19164B"),
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          = { new StackLayout {
                                          VerticalOptions = LayoutOptions.CenterAndExpand, Spacing = 0, Children = { cuenta, new Label {
                                                                                                                         FontSize = 12
                                                                                                                     } }
                                      } }
            };
            Contrasenia = new StackLayout
            {
                Spacing           = 0,
                BackgroundColor   = Color.FromHex("19164B"),
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          = { new StackLayout {
                                          VerticalOptions = LayoutOptions.CenterAndExpand, Spacing = 0, Children = { contrasenia, new Label {
                                                                                                                         FontSize = 12
                                                                                                                     } }
                                      } }
            };

            tabs.Children.Add(Usuario, 0, 0);
            tabs.Children.Add(Cuenta, 1, 0);
            tabs.Children.Add(Contrasenia, 2, 0);

            TapGestureRecognizer UsuarioTAP     = new TapGestureRecognizer();
            TapGestureRecognizer CuentaTAP      = new TapGestureRecognizer();
            TapGestureRecognizer ContraseniaTAP = new TapGestureRecognizer();

            UsuarioTAP.Tapped += (sender, e) =>
            {
                if (CarouselContenido.Position != 0)
                {
                    CarouselContenido.Position = 0;
                }
            };
            CuentaTAP.Tapped += (sender, e) =>
            {
                if (CarouselContenido.Position != 1)
                {
                    CarouselContenido.Position = 1;
                }
            };
            ContraseniaTAP.Tapped += (sender, e) =>
            {
                if (CarouselContenido.Position != 2)
                {
                    CarouselContenido.Position = 2;
                }
            };
            Usuario.GestureRecognizers.Add(UsuarioTAP);
            Cuenta.GestureRecognizers.Add(CuentaTAP);
            Contrasenia.GestureRecognizers.Add(ContraseniaTAP);

            Contenido.Children.Add(tabs,
                                   xConstraint: Constraint.Constant(0),
                                   yConstraint: Constraint.Constant(90),
                                   widthConstraint: Constraint.RelativeToParent((parent) => { return(parent.Width); }) //,
                                                                                                                       //heightConstraint: Constraint.Constant(30)
                                   );

            CarouselContenido = new CarouselViewControl
            {
                ItemsSource = new List <int> {
                    1, 2, 3
                },
                ItemTemplate     = new PerfilDTViewModel(),
                InterPageSpacing = 10,
                //HeightRequest = 70,
                Orientation = CarouselViewOrientation.Horizontal,
            };
            CarouselContenido.PositionSelected += CarouselContenido_PositionSelected;

            Contenido.Children.Add(CarouselContenido,
                                   xConstraint: Constraint.Constant(0),
                                   yConstraint: Constraint.Constant(130),
                                   widthConstraint: Constraint.RelativeToParent((parent) => { return(parent.Width); }),
                                   heightConstraint: Constraint.RelativeToParent((parent) => { return(parent.Height - 130); })
                                   );
            Content = Contenido;
        }
 public void SetElement(CarouselViewControl element)
 {
     this.Element = element;
 }
Exemplo n.º 17
0
        public Wishlist(ObservableCollection <Property> properties)
        {
            InitializeComponent();

            if (Settings.Language == "ar")
            {
                if (properties.Count == 0)
                {
                    NoProperty.Text      = "لا يوجد اي عقار";
                    NoProperty.TextColor = Color.FromHex("#FF071D66");
                    NoProperty.IsVisible = true;
                }
                this.Title         = "المفضلة";
                this.FlowDirection = FlowDirection.RightToLeft;
            }
            else
            {
                if (properties.Count == 0)
                {
                    NoProperty.Text      = "No Properties Found";
                    NoProperty.TextColor = Color.FromHex("#FF071D66");
                    NoProperty.IsVisible = true;
                }
                this.Title         = "Wishlist";
                this.FlowDirection = FlowDirection.LeftToRight;
            }
            _properties    = new ObservableCollection <Property>();
            _properties    = properties;
            BindingContext = new AcquaintanceListDataViewModels();
            int x = 1;

            foreach (var item in properties)
            {
                PropertyModel propertyModel = new PropertyModel();
                propertyModel.Address = item.Address;
                propertyModel.SID     = item.SID;
                string SIDT = propertyModel.SID.Replace("ID: ", "");
                SIDT = SIDT.Replace(" ", "");
                if (Settings.Language == "ar")
                {
                    if (Application.Current.Properties["WishP"].ToString().Contains(SIDT))
                    {
                        propertyModel.Wishtext   = "حذف من المفضلة";
                        propertyModel.Wishtcolor = "White";
                        propertyModel.Wishcolor  = "wishiconblue.png";
                    }
                    else
                    {
                        propertyModel.Wishtext   = "اضافة الى المفضلة";
                        propertyModel.Wishcolor  = "wishicongray.png";
                        propertyModel.Wishtcolor = "#FF071D66";
                    }
                    if (Application.Current.Properties["ComP"].ToString().Contains(SIDT))
                    {
                        propertyModel.Coomtext   = "حذف من المقارنة";
                        propertyModel.Coomtcolor = "White";
                        propertyModel.Coomcolor  = "compareiconblue.png";
                    }
                    else
                    {
                        propertyModel.Coomtext   = "اضافة الى المقارنة";
                        propertyModel.Coomcolor  = "compareicongray.png";
                        propertyModel.Coomtcolor = "#FF071D66";
                    }
                }
                else
                {
                    if (Application.Current.Properties["WishP"].ToString().Contains(propertyModel.SID))
                    {
                        propertyModel.Wishtext   = "Remove From Wishlist";
                        propertyModel.Wishtcolor = "White";
                        propertyModel.Wishcolor  = "wishiconblue.png";
                    }
                    else
                    {
                        propertyModel.Wishtext   = "Add To Wishlist";
                        propertyModel.Wishcolor  = "wishicongray.png";
                        propertyModel.Wishtcolor = "#FF071D66";
                    }
                    if (Application.Current.Properties["ComP"].ToString().Contains(propertyModel.SID))
                    {
                        propertyModel.Coomtext   = "Remove From Compare";
                        propertyModel.Coomtcolor = "White";
                        propertyModel.Coomcolor  = "compareiconblue.png";
                    }
                    else
                    {
                        propertyModel.Coomtext   = "Add To Compare";
                        propertyModel.Coomcolor  = "compareicongray.png";
                        propertyModel.Coomtcolor = "#FF071D66";
                    }
                }
                if (Settings.Language == "ar")
                {
                    propertyModel.AddressLAng = item.Address.CityAR;
                    propertyModel.LeftArrow   = "rightarrow.png";
                    propertyModel.RightArrow  = "leftarrow.png";
                    propertyModel.Title       = "ID: " + item.SID + "  ";
                    propertyModel.SID         = "ID: " + item.SID + "  ";
                }
                else
                {
                    propertyModel.AddressLAng = item.Address.City;
                    propertyModel.RightArrow  = "rightarrow.png";
                    propertyModel.LeftArrow   = "leftarrow.png";
                    propertyModel.Title       = "ID: " + item.SID + "  ";
                    propertyModel.SID         = "ID: " + item.SID + "  ";
                }
                propertyModel.AddressID = item.AddressID;
                propertyModel.For       = item.For;
                propertyModel.ID        = item.ID;

                propertyModel.Price = item.Price;
                if (item.Reviews.FirstOrDefault()?.Rating.ToString() == null)
                {
                    propertyModel.Review = "N/A";
                }
                else
                {
                    propertyModel.Review = item.Reviews.FirstOrDefault()?.Rating.ToString();
                }
                propertyModel.Title = item.Title;
                if (propertyModel.For == For.Rent)
                {
                    if (Settings.Language == "ar")
                    {
                        propertyModel.StatusLang = "للايجار";
                    }
                    else
                    {
                        propertyModel.StatusLang = "Rent";
                    }
                    propertyModel.Color = "#F08C00";
                }
                else
                {
                    if (Settings.Language == "ar")
                    {
                        propertyModel.StatusLang = "للبيع";
                    }
                    else
                    {
                        propertyModel.StatusLang = "Sale";
                    }
                    propertyModel.Color = "#66A80F";
                }
                if (!(string.IsNullOrEmpty(App.Token)) && App.Token != "Guest")
                {
                    propertyModel.LogedIN = true;
                }
                else
                {
                    propertyModel.LogedIN = false;
                }
                propertyModel.AllPhotos              = item.Photos;
                propertyModel.OfType                 = item.OfType;
                propertyModel.Baths                  = item.Baths;
                propertyModel.CarSpaces              = item.CarSpaces;
                propertyModel.LandArea               = item.LandArea;
                propertyModel.Beds                   = item.Beds;
                propertyModel.LivingRooms            = item.LivingRooms;
                propertyModel.Status                 = item.Status;
                propertyModel.Kitchens               = item.Kitchens;
                propertyModel.NumberOfRooms          = item.NumberOfRooms;
                propertyModel.Seller                 = item.Seller;
                propertyModel.SellerAR               = item.SellerAR;
                propertyModel.AirConditioning        = item.AirConditioning;
                propertyModel.Balcony                = item.Balcony;
                propertyModel.Kitchens               = item.Kitchens;
                propertyModel.DryCleanRoom           = item.DryCleanRoom;
                propertyModel.Furnished              = item.Furnished;
                propertyModel.CoveredAreaMeasurement = item.CoveredAreaMeasurement;
                propertyModel.FloorNo                = item.FloorNo;
                propertyModel.NumberOfRooms          = item.NumberOfRooms;
                propertyModel.NumberOfRooms          = item.NumberOfRooms;
                propertyModel.Gym          = item.Gym;
                propertyModel.Pool         = item.Pool;
                propertyModel.Build        = item.Build;
                propertyModel.BuildingArea = item.BuildingArea;
                propertyModel.MaidsRoom    = item.MaidsRoom;
                propertyModel.StorageRoom  = item.StorageRoom;
                propertyModel.Phone        = item.Phone;
                propertyModel.IDName       = item.IDName;
                propertyModel.PhotosQ      = item.PhotosQ;
                propertyModel.PhotoQ       = item.PhotoQ;
                propertyModel.PhotoQ1      = item.PhotoQ1;
                propertyModel.PhotoQ2      = item.PhotoQ2;
                propertyModel.PhotoQ3      = item.PhotoQ3;
                propertyModel.PhotoQ4      = item.PhotoQ4;
                propertyModel.PhotoQ5      = item.PhotoQ5;
                propertyModel.PhotoQ6      = item.PhotoQ6;
                propertyModel.PhotoQ7      = item.PhotoQ7;
                propertyModel.PhotoQ8      = item.PhotoQ8;
                propertyModel.PhotoQ9      = item.PhotoQ9;
                propertyModel.PhotoQ10     = item.PhotoQ10;
                propertyModel.PhotoQ11     = item.PhotoQ11;
                propertyModel.PhotoQ12     = item.PhotoQ12;
                propertyModel.Ad           = false;

                if (propertyModel.Beds == 0 || propertyModel.Beds == null)
                {
                    propertyModel.Bed = false;
                }
                else
                {
                    propertyModel.Bed = true;
                }
                if (propertyModel.Baths == 0 || propertyModel.Baths == null)
                {
                    propertyModel.Bath = false;
                }
                else
                {
                    propertyModel.Bath = true;
                }
                if (propertyModel.FloorNo == 0 || propertyModel.FloorNo == null)
                {
                    propertyModel.Floor = false;
                }
                else
                {
                    propertyModel.Floor = true;
                }
                if (propertyModel.LivingRooms == 0 || propertyModel.LivingRooms == null)
                {
                    propertyModel.Living = false;
                }
                else
                {
                    propertyModel.Living = true;
                }
                if (propertyModel.LandArea == 0 || propertyModel.LandArea == null)
                {
                    propertyModel.Area = false;
                }
                else
                {
                    propertyModel.Area = true;
                }
                if (x == 3)
                {
                    propertyModel.Ad = true; x = 1;
                }
                else
                {
                    x = x + 1;
                }
                propertyListModel.Add(propertyModel);

                var maingrid = new Grid {
                };
                if (propertyModel.LogedIN == true)
                {
                    maingrid = new Grid
                    {
                        RowDefinitions =
                        {
                            new RowDefinition {
                                Height = new GridLength(1, GridUnitType.Star)
                            },
                            new RowDefinition {
                                Height = new GridLength(0.4, GridUnitType.Star)
                            },
                            new RowDefinition {
                                Height = new GridLength(0.2, GridUnitType.Star)
                            },
                            new RowDefinition {
                                Height = new GridLength(1, GridUnitType.Absolute)
                            },
                            new RowDefinition {
                                Height = new GridLength(0.4, GridUnitType.Star)
                            },
                            new RowDefinition {
                                Height = new GridLength(5, GridUnitType.Absolute)
                            }
                        },
                        BackgroundColor = Color.White,
                        HeightRequest   = 500,
                        RowSpacing      = 0,
                    };
                }
                else
                {
                    maingrid = new Grid
                    {
                        RowDefinitions =
                        {
                            new RowDefinition {
                                Height = new GridLength(1, GridUnitType.Star)
                            },
                            new RowDefinition {
                                Height = new GridLength(0.4, GridUnitType.Star)
                            },
                            new RowDefinition {
                                Height = new GridLength(0.2, GridUnitType.Star)
                            },
                            new RowDefinition {
                                Height = new GridLength(0.1, GridUnitType.Star)
                            },
                            new RowDefinition {
                                Height = new GridLength(5, GridUnitType.Absolute)
                            },
                            new RowDefinition {
                                Height = new GridLength(5, GridUnitType.Absolute)
                            }
                        },
                        BackgroundColor = Color.White,
                        HeightRequest   = 400,
                        RowSpacing      = 0,
                    };
                }
                var image = new Image
                {
                    Source = propertyModel.PhotosQ.UploadedTo,
                    Aspect = Aspect.Fill,
                };


                ObservableCollection <Image> images = new ObservableCollection <Image>();
                image = new Image
                {
                    Source = propertyModel.PhotosQ.UploadedTo,
                    Aspect = Aspect.Fill,
                };
                images.Add(image);

                CarouselViewControl myCarousel = new CarouselViewControl
                {
                    ItemsSource                   = images,
                    ItemTemplate                  = new DataTemplate(typeof(Image)),
                    IndicatorsTintColor           = Color.DarkGray,
                    CurrentPageIndicatorTintColor = Color.FromHex("#071d66"),
                    IndicatorsShape               = IndicatorsShape.Circle,
                    ShowIndicators                = true,
                    ShowArrows            = true,
                    IsSwipeEnabled        = true,
                    Orientation           = CarouselViewOrientation.Horizontal,
                    ArrowsBackgroundColor = Color.FromHex("#071d66"),
                    VerticalOptions       = LayoutOptions.Fill,
                    HorizontalOptions     = LayoutOptions.Fill,
                };

                var rategrid = new Grid
                {
                    RowDefinitions =
                    {
                        new RowDefinition {
                            Height = new GridLength(1, GridUnitType.Star)
                        },
                    },
                    HorizontalOptions = LayoutOptions.End,
                    VerticalOptions   = LayoutOptions.Start,
                };
                var rateimage = new Image
                {
                    Source = "Rate.png",
                    Aspect = Aspect.AspectFit,
                };
                var rlablegrid = new Grid
                {
                    RowDefinitions =
                    {
                        new RowDefinition {
                            Height = new GridLength(0.4, GridUnitType.Star)
                        },
                        new RowDefinition {
                            Height = new GridLength(1, GridUnitType.Star)
                        },
                    },
                };
                var ratelable = new Label
                {
                    Text     = propertyModel.Review,
                    FontSize = 8,
                };
                rategrid.Children.Add(rateimage);
                rategrid.Children.Add(ratelable);

                var pricegrid = new Grid
                {
                    RowDefinitions =
                    {
                        new RowDefinition {
                            Height = new GridLength(20, GridUnitType.Absolute)
                        },
                        new RowDefinition {
                            Height = new GridLength(40, GridUnitType.Absolute)
                        },
                        new RowDefinition {
                            Height = new GridLength(5, GridUnitType.Star)
                        },
                    },
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(15, GridUnitType.Absolute)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(105, GridUnitType.Absolute)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(105, GridUnitType.Absolute)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                    },
                    ColumnSpacing = 0,
                };
                var pricebox = new BoxView
                {
                    BackgroundColor = Color.FromHex("#FF071D66"),
                };
                var pricelable = new Label
                {
                    Text              = propertyModel.Price.ToString(),
                    TextColor         = Color.White,
                    FontSize          = 11,
                    VerticalOptions   = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.Center,
                };
                var saleorrentbox = new BoxView
                {
                    BackgroundColor = Color.FromHex(propertyModel.Color)
                };
                var saleorrentlable = new Label
                {
                    Text              = propertyModel.StatusLang,
                    TextColor         = Color.White,
                    FontSize          = 11,
                    VerticalOptions   = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.Center,
                };
                var idgrid = new Grid
                {
                    RowDefinitions =
                    {
                        new RowDefinition {
                            Height = new GridLength(15, GridUnitType.Absolute)
                        },
                        new RowDefinition {
                            Height = new GridLength(1, GridUnitType.Star)
                        },
                    },
                    VerticalOptions   = LayoutOptions.End,
                    HorizontalOptions = LayoutOptions.End,
                };
                var idlable = new Label
                {
                    Text            = propertyModel.SID,
                    TextColor       = Color.FromHex("#FF071D66"),
                    FontSize        = 11,
                    VerticalOptions = LayoutOptions.Center,
                };
                idgrid.Children.Add(idlable, 0, 1);
                pricegrid.Children.Add(pricebox, 1, 1);
                pricegrid.Children.Add(pricelable, 1, 1);
                pricegrid.Children.Add(saleorrentbox, 2, 1);
                pricegrid.Children.Add(saleorrentlable, 2, 1);
                pricegrid.Children.Add(idgrid, 3, 1);
                rategrid.Children.Add(pricegrid, 0, 1);
                var pricerategrid = new Grid
                {
                    RowDefinitions =
                    {
                        new RowDefinition {
                            Height = new GridLength(1, GridUnitType.Star)
                        },
                        new RowDefinition {
                            Height = new GridLength(40, GridUnitType.Absolute)
                        },
                    },
                };
                pricerategrid.Children.Add(rategrid, 0, 0);
                pricerategrid.Children.Add(pricegrid, 0, 1);

                var pnggrid = new Grid
                {
                    RowDefinitions =
                    {
                        new RowDefinition {
                            Height = new GridLength(40, GridUnitType.Absolute)
                        },
                        new RowDefinition {
                            Height = new GridLength(1, GridUnitType.Star)
                        },
                    },
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(70, GridUnitType.Absolute)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(70, GridUnitType.Absolute)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(70, GridUnitType.Absolute)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(70, GridUnitType.Absolute)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(70, GridUnitType.Absolute)
                        },
                    },
                    ColumnSpacing = 4,
                    RowSpacing    = 0
                };
                var areagrid = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                    },
                };
                var areaimage = new Image
                {
                    Source            = "area.png",
                    IsVisible         = propertyModel.Area.Value,
                    Scale             = 0.6,
                    HorizontalOptions = LayoutOptions.Start
                };
                var arealable = new Label
                {
                    Text              = propertyModel.LandArea.ToString(),
                    TextColor         = Color.FromHex("#FF071D66"),
                    FontSize          = 8,
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions   = LayoutOptions.Center,
                };
                areagrid.Children.Add(areaimage, 0, 0);
                areagrid.Children.Add(arealable, 1, 0);
                var bedgrid = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                    },
                };
                var bedimage = new Image
                {
                    Source            = "bedroom.png",
                    IsVisible         = propertyModel.Bed.Value,
                    Scale             = 0.6,
                    HorizontalOptions = LayoutOptions.Start
                };
                var bedlable = new Label
                {
                    Text              = propertyModel.Beds.ToString(),
                    TextColor         = Color.FromHex("#FF071D66"),
                    FontSize          = 8,
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions   = LayoutOptions.Center,
                };
                bedgrid.Children.Add(bedimage, 0, 0);
                bedgrid.Children.Add(bedlable, 1, 0);
                var bathgrid = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                    },
                };
                var bathimage = new Image
                {
                    Source            = "bathroom.png",
                    IsVisible         = propertyModel.Bath.Value,
                    Scale             = 0.6,
                    HorizontalOptions = LayoutOptions.Start
                };
                var bathlable = new Label
                {
                    Text              = propertyModel.Baths.ToString(),
                    TextColor         = Color.FromHex("#FF071D66"),
                    FontSize          = 8,
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions   = LayoutOptions.Center,
                };
                bathgrid.Children.Add(bathimage, 0, 0);
                bathgrid.Children.Add(bathlable, 1, 0);
                var livinggrid = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                    },
                };
                var livingimage = new Image
                {
                    Source            = "livingroom.png",
                    IsVisible         = propertyModel.Living.Value,
                    Scale             = 0.6,
                    HorizontalOptions = LayoutOptions.Start
                };
                var livinglable = new Label
                {
                    Text              = propertyModel.LivingRooms.ToString(),
                    TextColor         = Color.FromHex("#FF071D66"),
                    FontSize          = 8,
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions   = LayoutOptions.Center,
                };
                livinggrid.Children.Add(livingimage, 0, 0);
                livinggrid.Children.Add(livinglable, 1, 0);
                var floorgrid = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                    },
                };
                var floorimage = new Image
                {
                    Source            = "floor.png",
                    IsVisible         = propertyModel.Floor.Value,
                    Scale             = 0.6,
                    HorizontalOptions = LayoutOptions.Start
                };
                var floorlable = new Label
                {
                    Text              = propertyModel.FloorNo.ToString(),
                    TextColor         = Color.FromHex("#FF071D66"),
                    FontSize          = 8,
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions   = LayoutOptions.Center,
                };
                floorgrid.Children.Add(floorimage, 0, 0);
                floorgrid.Children.Add(floorlable, 1, 0);
                pnggrid.Children.Add(areagrid, 0, 1);
                pnggrid.Children.Add(bedgrid, 1, 1);
                pnggrid.Children.Add(bathgrid, 2, 1);
                pnggrid.Children.Add(livinggrid, 3, 1);
                pnggrid.Children.Add(floorgrid, 4, 1);
                var addressgrid = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(30, GridUnitType.Absolute)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                    },
                };
                var addressimage = new Image
                {
                    Source            = "TextLocation.png",
                    HorizontalOptions = LayoutOptions.End
                };
                var addresslable = new Label
                {
                    Text              = propertyModel.AddressLAng,
                    TextColor         = Color.FromHex("#FF071D66"),
                    FontSize          = 10,
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions   = LayoutOptions.Center,
                };
                addressgrid.Children.Add(addressimage, 0, 0);
                addressgrid.Children.Add(addresslable, 1, 0);
                var wishgrid = new Grid
                {
                    RowDefinitions =
                    {
                        new RowDefinition {
                            Height = new GridLength(1, GridUnitType.Star)
                        },
                        new RowDefinition {
                            Height = new GridLength(5, GridUnitType.Absolute)
                        },
                        new RowDefinition {
                            Height = new GridLength(25, GridUnitType.Absolute)
                        },
                    },
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(10, GridUnitType.Absolute)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                    },
                    IsVisible = propertyModel.LogedIN.Value,
                };
                var wishimage = new Image
                {
                    Source            = propertyModel.Wishcolor,
                    VerticalOptions   = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.Center,
                    Scale             = 1
                };
                var wishlable = new Label
                {
                    Text              = propertyModel.Wishtext,
                    VerticalOptions   = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.Center,
                    TextColor         = Color.FromHex("#FF071D66"),
                    FontSize          = 11,
                };
                wishgrid.Children.Add(wishimage, 1, 0);
                wishgrid.Children.Add(wishlable, 1, 2);
                TapGestureRecognizer wishtap = new TapGestureRecognizer();
                wishtap.Tapped += async(sender, e) =>
                {
                    PID = propertyModel.SID.Replace("ID: ", "");
                    PID = PID.Replace(" ", "");
                    UserDialogs.Instance.ShowLoading();
                    await Task.Delay(500);

                    var    uri         = "";
                    string addordelete = "";
                    string userid      = Application.Current.Properties["Token"].ToString().Replace("\"", "");
                    if (Application.Current.Properties["WishP"].ToString().Contains(PID))
                    {
                        uri = string.Format(Constantce.URL + "/api/properties/RemoveToWish?userid={0}&propertyid={1}", userid, PID);
                    }
                    else
                    {
                        uri = string.Format(Constantce.URL + "/api/properties/AddToWish?userid={0}&propertyid={1}", userid, PID);
                    }

                    HttpWebRequest request = WebRequest.Create(uri) as HttpWebRequest;
                    using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                    {
                        StreamReader reader = new StreamReader(response.GetResponseStream());
                        string       Data   = reader.ReadToEnd();
                        addordelete = Data.Replace("\"", "");
                    }
                    if (addordelete == "Added")
                    {
                        Application.Current.Properties["WishP"] = Application.Current.Properties["WishP"] + "," + PID;
                    }
                    else
                    {
                        string x1   = "," + PID;
                        string list = Application.Current.Properties["WishP"].ToString();
                        list = list.Replace(x1, "");
                        Application.Current.Properties["WishP"] = list;
                    }
                    this.Navigation.PopAsync();
                    await Navigation.PushModalAsync(new Wishlist(_properties));

                    await Task.Delay(500);

                    UserDialogs.Instance.HideLoading();
                };
                wishgrid.GestureRecognizers.Add(wishtap);
                var coomgrid = new Grid
                {
                    RowDefinitions =
                    {
                        new RowDefinition {
                            Height = new GridLength(1, GridUnitType.Star)
                        },
                        new RowDefinition {
                            Height = new GridLength(5, GridUnitType.Absolute)
                        },
                        new RowDefinition {
                            Height = new GridLength(25, GridUnitType.Absolute)
                        },
                    },
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(10, GridUnitType.Absolute)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                    },
                    IsVisible = propertyModel.LogedIN.Value,
                };
                var coomimage = new Image
                {
                    Source            = propertyModel.Coomcolor,
                    VerticalOptions   = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.Center,
                    Scale             = 1
                };
                var coomlable = new Label
                {
                    Text              = propertyModel.Coomtext,
                    VerticalOptions   = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.Center,
                    TextColor         = Color.FromHex("#FF071D66"),
                    FontSize          = 11,
                };
                coomgrid.Children.Add(coomimage, 1, 0);
                coomgrid.Children.Add(coomlable, 1, 2);
                TapGestureRecognizer coomtap = new TapGestureRecognizer();
                coomtap.Tapped += async(sender, e) =>
                {
                    PID = propertyModel.SID.Replace("ID: ", "");
                    PID = PID.Replace(" ", "");
                    UserDialogs.Instance.ShowLoading();
                    var    uri         = "";
                    string addordelete = "";
                    await Task.Delay(500);

                    string userid = Application.Current.Properties["Token"].ToString().Replace("\"", "");
                    if (Application.Current.Properties["ComP"].ToString().Contains(PID))
                    {
                        uri = string.Format(Constantce.URL + "/api/properties/RemoveToCompare?userid={0}&propertyid={1}", userid, PID);
                    }
                    else
                    {
                        uri = string.Format(Constantce.URL + "/api/properties/AddToCompare?userid={0}&propertyid={1}", userid, PID);
                    }
                    HttpWebRequest request = WebRequest.Create(uri) as HttpWebRequest;
                    using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                    {
                        StreamReader reader = new StreamReader(response.GetResponseStream());
                        string       Data   = reader.ReadToEnd();
                        addordelete = Data.Replace("\"", "");
                    }
                    if (addordelete == "Added")
                    {
                        Application.Current.Properties["ComP"] = Application.Current.Properties["ComP"] + "," + PID;
                    }
                    else
                    {
                        string x2   = "," + PID;
                        string list = Application.Current.Properties["ComP"].ToString();
                        list = list.Replace(x2, "");
                        Application.Current.Properties["ComP"] = list;
                    }
                    this.Navigation.PopAsync();
                    await Navigation.PushModalAsync(new Wishlist(_properties));

                    await Task.Delay(500);

                    UserDialogs.Instance.HideLoading();
                };
                coomgrid.GestureRecognizers.Add(coomtap);
                var coomwishgrid = new Grid
                {
                    RowDefinitions =
                    {
                        new RowDefinition {
                            Height = new GridLength(1, GridUnitType.Star)
                        },
                        new RowDefinition {
                            Height = new GridLength(.4, GridUnitType.Star)
                        },
                    },
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(10, GridUnitType.Absolute)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(10, GridUnitType.Absolute)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(10, GridUnitType.Absolute)
                        },
                    },
                };
                coomwishgrid.Children.Add(coomgrid, 1, 0);
                coomwishgrid.Children.Add(wishgrid, 3, 0);


                maingrid.Children.Add(myCarousel, 0, 0);
                maingrid.Children.Add(pricerategrid, 0, 0);
                maingrid.Children.Add(pnggrid, 0, 1);
                maingrid.Children.Add(addressgrid, 0, 2);
                maingrid.Children.Add(coomwishgrid, 0, 4);
                TapGestureRecognizer gridTap = new TapGestureRecognizer();
                gridTap.Tapped += (sender, e) =>
                {
                    Navigation.PushModalAsync(new PropertyProfile(propertyModel));
                };
                //maingrid.GestureRecognizers.Add(gridTap);

                ListLayout.Children.Add(maingrid);
            }
        }
Exemplo n.º 18
0
        public AjustesPage()
        {
            headerBackground = new Image()
            {
                Source = "headerConfiguracion.png",
                Aspect = Aspect.AspectFill
            };
            Title = "Configuraciones";

            Contenido = new RelativeLayout();
            Contenido.Children.Add(headerBackground,
                                   xConstraint: Constraint.Constant(0),
                                   yConstraint: Constraint.Constant(0),
                                   widthConstraint: Constraint.RelativeToParent((parent) => { return(parent.Width); }),
                                   heightConstraint: Constraint.Constant(100)
                                   );

            tabs = new Grid
            {
                HeightRequest   = 40,
                RowSpacing      = 0,
                ColumnSpacing   = 0,
                Padding         = 0,
                BackgroundColor = Color.FromHex("23593A"),
                VerticalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions  =
                {
                    new RowDefinition {
                        Height = new GridLength(40, GridUnitType.Star)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            usuario = new Label
            {
                TextColor  = Color.FromHex("187041"),
                FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                Text       = "APPS",
                FontSize   = 12,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalOptions       = LayoutOptions.Center,
            };
            username = new Label
            {
                TextColor  = Color.FromHex("187041"),
                FontFamily = Device.OnPlatform("OpenSans", "OpenSans-Regular", null),
                FontSize   = 10,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.Center,
            };
            cuenta = new Label
            {
                TextColor               = Color.White,
                FontFamily              = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                Text                    = "ACCIONES",
                FontSize                = 12,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
            };
            contrasenia = new Label
            {
                TextColor               = Color.White,
                FontFamily              = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                Text                    = "CONTRASEÑA",
                FontSize                = 12,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
            };

            Usuario = new StackLayout
            {
                Spacing           = 0,
                BackgroundColor   = Color.White,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new StackLayout {
                        VerticalOptions = LayoutOptions.CenterAndExpand, Spacing = 0, Children ={ usuario,                                                              username }
                    }
                }
            };
            Cuenta = new StackLayout
            {
                Spacing           = 0,
                BackgroundColor   = Color.FromHex("19164B"),
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          = { new StackLayout {
                                          VerticalOptions = LayoutOptions.CenterAndExpand, Spacing = 0, Children = { cuenta, new Label {
                                                                                                                         FontSize = 12
                                                                                                                     } }
                                      } }
            };
            Contrasenia = new StackLayout
            {
                Spacing           = 0,
                BackgroundColor   = Color.FromHex("19164B"),
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          = { new StackLayout {
                                          VerticalOptions = LayoutOptions.CenterAndExpand, Spacing = 0, Children = { contrasenia, new Label {
                                                                                                                         FontSize = 12
                                                                                                                     } }
                                      } }
            };

            tabs.Children.Add(Usuario, 0, 0);
            tabs.Children.Add(Cuenta, 1, 0);
            tabs.Children.Add(Contrasenia, 2, 0);

            TapGestureRecognizer UsuarioTAP     = new TapGestureRecognizer();
            TapGestureRecognizer CuentaTAP      = new TapGestureRecognizer();
            TapGestureRecognizer ContraseniaTAP = new TapGestureRecognizer();

            UsuarioTAP.Tapped += (sender, e) =>
            {
                if (CarouselContenido.Position != 0)
                {
                    CarouselContenido.Position = 0;
                }
            };
            CuentaTAP.Tapped += (sender, e) =>
            {
                if (CarouselContenido.Position != 1)
                {
                    CarouselContenido.Position = 1;
                }
            };
            ContraseniaTAP.Tapped += (sender, e) =>
            {
                if (CarouselContenido.Position != 2)
                {
                    CarouselContenido.Position = 2;
                }
            };
            Usuario.GestureRecognizers.Add(UsuarioTAP);
            Cuenta.GestureRecognizers.Add(CuentaTAP);
            Contrasenia.GestureRecognizers.Add(ContraseniaTAP);

            Contenido.Children.Add(tabs,
                                   xConstraint: Constraint.Constant(0),
                                   yConstraint: Constraint.Constant(90),
                                   widthConstraint: Constraint.RelativeToParent((parent) => { return(parent.Width); }) //,
                                                                                                                       //heightConstraint: Constraint.Constant(30)
                                   );

            CarouselContenido = new CarouselViewControl
            {
                ItemsSource = new List <int> {
                    1, 2, 3
                },
                ItemTemplate     = new AjustesDTViewModel(),
                InterPageSpacing = 10,
                //HeightRequest = 70,
                Orientation = CarouselViewOrientation.Horizontal,
            };
            CarouselContenido.PositionSelected += CarouselContenido_PositionSelected;

            Contenido.Children.Add(CarouselContenido,
                                   xConstraint: Constraint.Constant(0),
                                   yConstraint: Constraint.Constant(130),
                                   widthConstraint: Constraint.RelativeToParent((parent) => { return(parent.Width); }),
                                   heightConstraint: Constraint.RelativeToParent((parent) => { return(parent.Height - 130); })
                                   );

            Content = Contenido;
        }
Exemplo n.º 19
0
        public WildFlowerImagesPage(WildFlower plant, bool streaming)
        {
            System.GC.Collect();
            // Turn off navigation bar and initialize pageContainer
            NavigationPage.SetHasNavigationBar(this, false);
            AbsoluteLayout pageContainer = ConstructPageContainer();

            // Initialize grid for inner container
            Grid innerContainer = new Grid {
                Padding = new Thickness(0, Device.OnPlatform(10, 0, 0), 0, 0)
            };

            innerContainer.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });

            // Add header to inner container
            Grid navigationBar = ConstructNavigationBarMain(plant.genusSpeciesWeber);

            innerContainer.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(50)
            });
            innerContainer.Children.Add(navigationBar, 0, 0);

            CarouselViewControl carouselControl = new CarouselViewControl();

            try
            {
                carouselControl.ItemsSource = plant.Images;
            }
            catch (NullReferenceException e)
            {
                carouselControl.ItemsSource = null;
            }

            carouselControl.ShowIndicators = true;

            DataTemplate imageTemplate = new DataTemplate(() =>
            {
                Grid cell = new Grid {
                    BackgroundColor = Color.FromHex("88000000")
                };
                cell.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
                cell.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });

                // Add image
                var image = new ZoomImage {
                    Margin = new Thickness(10, 0, 10, 0)
                };

                string imageBinding = streaming ? "ImagePathStreamed" : "ImagePathDownloaded";

                var cachedImage = new CachedImage()
                {
                    HorizontalOptions    = LayoutOptions.Center,
                    VerticalOptions      = LayoutOptions.Center,
                    WidthRequest         = 300,
                    HeightRequest        = 300,
                    Aspect               = Aspect.AspectFill,
                    Margin               = new Thickness(10, 0, 10, 0),
                    CacheDuration        = System.TimeSpan.FromDays(30),
                    DownsampleToViewSize = true,
                    RetryCount           = 0,

                    RetryDelay          = 250,
                    TransparencyEnabled = false,
                    LoadingPlaceholder  = "loading.png",
                    ErrorPlaceholder    = "error.png",
                };



                image.SetBinding(Image.SourceProperty, new Binding(imageBinding));
                cachedImage.SetBinding(CachedImage.SourceProperty, new Binding(imageBinding));

                cell.Children.Add(image, 0, 0);

                return(cell);
            });

            carouselControl.ItemTemplate     = imageTemplate;
            carouselControl.Position         = 0;
            carouselControl.InterPageSpacing = 10;
            carouselControl.Orientation      = CarouselViewOrientation.Horizontal;

            innerContainer.RowDefinitions.Add(new RowDefinition {
            });
            innerContainer.Children.Add(carouselControl, 0, 1);

            // Add inner container to page container and set as page content
            pageContainer.Children.Add(innerContainer, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);

            Content = pageContainer;
            System.GC.Collect();
        }
        private void TemperatureForecast(ActualWeather weather)
        {
            try
            {
                Grid grid = new Grid
                {
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    Padding         = 5,
                    RowDefinitions  =
                    {
                        new RowDefinition {
                            Height = new GridLength(1, GridUnitType.Star)
                        },
                        new RowDefinition {
                            Height = new GridLength(1, GridUnitType.Star)
                        },
                    },
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(1, GridUnitType.Star)
                        }
                    }
                };

                tChart1 = new Chart();
                tChart1.Axes.Left.Increment               = 1;
                tChart1.Axes.Bottom.Labels.Font.Size      = 12;
                tChart1.Axes.Bottom.Ticks.Length          = 15;
                tChart1.Axes.Bottom.Ticks.Visible         = true;
                tChart1.Axes.Bottom.Title.Font.Size       = 15;
                tChart1.Axes.Bottom.Labels.Angle          = 90;
                tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd/MMM";
                tChart1.Axes.Left.Labels.Font.Size        = 12;
                tChart1.Axes.Left.Ticks.Visible           = true;
                tChart1.Axes.Left.Ticks.Length            = 15;
                tChart1.Axes.Left.Title.Font.Size         = 15;
                tChart1.Axes.Left.MinorTicks.Visible      = false;
                tChart1.Aspect.ColorPaletteIndex          = 20;
                tChart1.Aspect.View3D               = false;
                tChart1.Header.Visible              = true;
                tChart1.Panel.Pen.Visible           = true;
                tChart1.Walls.Back.Brush.Visible    = true;
                tChart1.Walls.Back.Transparent      = false;
                tChart1.Walls.Back.Gradient.Visible = false;
                tChart1.Walls.Back.Color            = Color.White;
                tChart1.Panel.Gradient.Visible      = false;
                tChart1.Panel.MarginBottom          = 5;
                tChart1.Panel.MarginLeft            = 5;
                tChart1.Panel.MarginRight           = 5;
                tChart1.Panel.MarginTop             = 15;
                tChart1.Panel.Color      = Color.FromHex("#81a9e8");
                tChart1.Panning.Allow    = ScrollModes.None;
                tChart1.Legend.Alignment = LegendAlignments.Bottom;
                tChart1.Legend.TextAlign = TextAlignment.Start;
                tChart1.Panel.Visible    = false;


                double min = weather.LstWeather[0].MinTemperature;
                double max = weather.LstWeather[0].MaxTemperature;

                var avTemp = new Line(tChart1.Chart);
                foreach (var item in weather.LstWeather)
                {
                    if (item.MaxTemperature > max)
                    {
                        max = item.MaxTemperature;
                    }
                    if (item.MinTemperature < min)
                    {
                        min = item.MinTemperature;
                    }
                    avTemp.Add(item.Date, item.Temperature);
                }

                tChart1.Axes.Left.SetMinMax((int)min - 5, (int)max + 5);

                avTemp.Color          = Color.FromHex("#0e661f");
                avTemp.Legend.Visible = false;
                avTemp.LinePen.Width  = 8;

                lineTemperature = new LineTemperaturePage(weather);

                CarouselViewControl myCarousel = new CarouselViewControl();
                int i = 0;
                myCarousel.ItemsSource  = lineTemperature.lstTemp;
                myCarousel.ItemTemplate = new DataTemplate(() =>
                {
                    if (i == lineTemperature.lstTemp.Count)
                    {
                        i = 0;
                    }
                    return(lineTemperature.lstTemp[i++]);
                });
                ChartView cv = ShowChart(tChart1);
                if (cv != null)
                {
                    grid.Children.Add(cv, 0, 0);
                }
                grid.Children.Add(myCarousel, 0, 1);
                Content = grid;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }
        }
Exemplo n.º 21
0
        public OnboardingPage()
        {
            var bgTop = new OrganicBubblesCanvasView()
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Start,
                Color             = Colors.OnboardingOrganicColor,
                Margin            = new Thickness(-300, -140, -30, 0),
                HeightRequest     = 300,
                RotationTime      = 10000,
                Rotation          = -20,
            };
            var bgBottom = new OrganicBubblesCanvasView()
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.End,
                Color             = Colors.OnboardingOrganicColor,
                Margin            = new Thickness(20, 0, -300, -200),
                HeightRequest     = 400,
                RotationTime      = 10000,
                Rotation          = -60,
            };

            var carousel = new CarouselViewControl()
            {
                AnimateTransition = false,
                ShowArrows        = false,
                IsSwipeEnabled    = false,
                Opacity           = 0, //until loaded
                Orientation       = CarouselViewOrientation.Vertical,
                InterPageSpacing  = 1,
                Margin            = new Thickness(30, -30, 30, 0),
                ItemTemplate      = new OnboardingDataTemplateSelector(),
            };

            carousel.SetBinding(CarouselViewControl.PositionProperty, nameof(ViewModel.CarouselPosition));
            carousel.SetBinding(CarouselViewControl.ItemsSourceProperty, nameof(ViewModel.Pages));

            var next = ButtonNext();

            next.HorizontalOptions = LayoutOptions.End;

            _indicators = new StackLayout()
            {
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.End,
                Orientation       = StackOrientation.Horizontal,
                Spacing           = 4,
                Margin            = 20,
            };

            Content = new Grid()
            {
                BackgroundColor = Colors.Background,
                RowDefinitions  = new RowDefinitionCollection()
                {
                    new RowDefinition()
                    {
                        Height = GridLength.Star
                    },
                    new RowDefinition()
                    {
                        Height = GridLength.Auto
                    },
                },
                Children =
                {
                    { bgTop,       0, 1, 0, 2 },
                    { bgBottom,    0, 1, 0, 2 },
                    { carousel,    0, 1, 0, 2 },
                    { _indicators, 0,0 },
                    { next,        0,1 },
                }
            };

            carousel.Effects.Add(new ViewLifeCycleEffect(loaded: (sender, args) =>
            {
                ViewModel.ViewLoaded(); // shows first page
                carousel.Opacity = 1f;  // makes view visible again
            }));
        }
Exemplo n.º 22
0
        public RecordPlayer(IEnumerable <Record> recList)
        {
            var f = new Frame();

            f.CornerRadius = 10;
            var grid = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(3, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            Content   = f;
            f.Content = (grid);

            Cvc              = new CarouselViewControl();
            Cvc.ItemsSource  = recList;
            Cvc.ItemTemplate = new DataTemplate(() =>
            {
                Label titleLabel = new Label {
                    FontSize = 18
                };
                titleLabel.SetBinding(Label.TextProperty, "Name");

                Label latitudeLabel = new Label {
                    FontSize = 12
                };
                latitudeLabel.SetBinding(Label.TextProperty, "Latitude");

                Label longitudeLabel = new Label {
                    FontSize = 12
                };
                longitudeLabel.SetBinding(Label.TextProperty, "Longitude");

                Label descLabel = new Label {
                    FontSize = 12
                };
                descLabel.SetBinding(Label.TextProperty, "Description");

                var rl = new RelativeLayout {
                    Padding = new Thickness(0, 5)
                };

                rl.Children.Add(latitudeLabel, Constraint.RelativeToParent((parent) => parent.Width - latitudeLabel.Text.Length * 4));
                rl.Children.Add(longitudeLabel, Constraint.RelativeToParent((parent) => latitudeLabel.X),
                                Constraint.RelativeToView(latitudeLabel, (par, view) => view.Height * 1.5));
                rl.Children.Add(titleLabel, Constraint.Constant(0), Constraint.Constant(0),
                                Constraint.RelativeToView(latitudeLabel, (par, view) => view.Width - 5));
                rl.Children.Add(descLabel, Constraint.Constant(0), Constraint.RelativeToParent((parent) => parent.Height / 2));
                return(new ContentView {
                    Content = rl
                });
            });
            grid.Children.Add(Cvc, 0, 0);
            Grid.SetColumnSpan(Cvc, 3);
            Cvc.PositionSelected += RecordSelected;
            var dislikeButton = new Button {
                Text = "Фу", BackgroundColor = Color.Red
            };
            var pauseButton = new Button {
                Text = "Пауза"
            };
            var likeButton = new Button {
                Text = "Нрав", BackgroundColor = Color.Green
            };

            grid.Children.Add(dislikeButton, 0, 1);
            grid.Children.Add(pauseButton, 1, 1);
            grid.Children.Add(likeButton, 2, 1);
            Player = CrossSimpleAudioPlayer.Current;
        }
Exemplo n.º 23
0
        public TutorialPage()
        {
            BackgroundColor   = Color.FromHex("312851");
            contenidoCarousel = new List <TutorialItem>();
            contenidoCarousel.Add(
                new TutorialItem
            {
                index   = 0,
                texto   = "EGuardian\r\nControla tu inversión",
                imagen  = "tutorialItem1.png",
                Padding = new Thickness(0, 50, 0, 0)
            });
            contenidoCarousel.Add(
                new TutorialItem
            {
                index   = 1,
                texto   = "¿Tiene idea de lo que hacen\r\nsus empleados?",
                imagen  = "tutorialItem2.png",
                Padding = 0    //new Thickness(0, 350, 0, 0)
            });
            contenidoCarousel.Add(
                new TutorialItem
            {
                index   = 2,
                texto   = "¿Está seguro de que su empleado\r\nAprovecha su inversión?",
                imagen  = "tutorialItem3.png",
                Padding = 0    //new Thickness(0, 350, 0, 0)
            });
            contenidoCarousel.Add(
                new TutorialItem
            {
                index   = 3,
                texto   = "¡Este al tanto en todo momento!",
                imagen  = "tutorialItem4.png",
                Padding = 0    //new Thickness(0, 350, 0, 0)
            });

            tutorialCarousel = new CarouselViewControl
            {
                ItemsSource       = contenidoCarousel,
                ItemTemplate      = new DataTemplate(typeof(TutorialViewModel)),
                InterPageSpacing  = 0,
                HeightRequest     = 70,
                Orientation       = CarouselViewOrientation.Horizontal,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };


            Indicator1 = new StackLayout
            {
                BackgroundColor   = Color.Transparent,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new Image
                    {
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        Source            = "indicator_fill"
                    }
                },
            };

            Indicator2 = new StackLayout
            {
                Spacing           = 0,
                BackgroundColor   = Color.Transparent,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new Image
                    {
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        Source            = "indicator_fill"
                    }
                }
            };
            Indicator3 = new StackLayout
            {
                Spacing           = 0,
                BackgroundColor   = Color.Transparent,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new Image
                    {
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        Source            = "indicator_fill"
                    }
                }
            };
            Indicator4 = new StackLayout
            {
                Spacing           = 0,
                BackgroundColor   = Color.Transparent,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new Image
                    {
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        Source            = "indicator_fill"
                    }
                }
            };

            TapGestureRecognizer tapIndicator1 = new TapGestureRecognizer();

            tapIndicator1.Tapped += (sender, e) =>
            {
                if (tutorialCarousel.Position != 0)
                {
                    tutorialCarousel.Position = 0;
                }
            };
            TapGestureRecognizer tapIndicator2 = new TapGestureRecognizer();

            tapIndicator2.Tapped += (sender, e) =>
            {
                if (tutorialCarousel.Position != 1)
                {
                    tutorialCarousel.Position = 1;
                }
            };
            TapGestureRecognizer tapIndicator3 = new TapGestureRecognizer();

            tapIndicator3.Tapped += (sender, e) =>
            {
                if (tutorialCarousel.Position != 2)
                {
                    tutorialCarousel.Position = 2;
                }
            };
            TapGestureRecognizer tapIndicator4 = new TapGestureRecognizer();

            tapIndicator4.Tapped += (sender, e) =>
            {
                if (tutorialCarousel.Position != 3)
                {
                    tutorialCarousel.Position = 3;
                }
            };

            Indicator1.GestureRecognizers.Add(tapIndicator1);
            Indicator2.GestureRecognizers.Add(tapIndicator2);
            Indicator3.GestureRecognizers.Add(tapIndicator3);
            Indicator4.GestureRecognizers.Add(tapIndicator4);

            indicadores = new Grid
            {
                HeightRequest   = 20,
                RowSpacing      = 0,
                ColumnSpacing   = 5,
                Padding         = 0,
                VerticalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions  =
                {
                    new RowDefinition {
                        Height = new GridLength(20, GridUnitType.Absolute)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(20, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(20, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(20, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(20, GridUnitType.Absolute)
                    }
                }
            };

            indicadores.Children.Add(Indicator1, 0, 0);
            indicadores.Children.Add(Indicator2, 1, 0);
            indicadores.Children.Add(Indicator3, 2, 0);
            indicadores.Children.Add(Indicator4, 3, 0);

            comenzar = new Button
            {
                Text              = "SIGUIENTE",
                AutomationId      = "comenzar",
                WidthRequest      = 300,
                HeightRequest     = 50,
                FontFamily        = Device.OnPlatform("OpenSans-ExtraBold", "OpenSans-ExtraBold", null),
                FontSize          = 20,
                TextColor         = Color.White,
                HorizontalOptions = LayoutOptions.Center,
                BackgroundColor   = Color.FromHex("F7B819")
            };
            comenzar.Clicked += Comenzar_Clicked;

            RelativeLayout Contenido = new RelativeLayout();

            Contenido.Children.Add(tutorialCarousel,
                                   Constraint.Constant(0),
                                   Constraint.Constant(0),
                                   Constraint.RelativeToParent((parent) => { return(parent.Width); }),
                                   Constraint.RelativeToParent((parent) => { return(parent.Height); })
                                   );

            Contenido.Children.Add(indicadores,
                                   Constraint.RelativeToParent((parent) => { return((parent.Width / 2) - 50); }),
                                   Constraint.RelativeToParent((parent) => { return(parent.Height - (parent.Height / 7.35) - 60); })
                                   );

            Contenido.Children.Add(comenzar,
                                   Constraint.RelativeToParent((parent) => { return((parent.Width / 2) - 150); }),
                                   Constraint.RelativeToParent((parent) => { return(parent.Height - (parent.Height / 7.35)); })
                                   );
            Content = Contenido;
            tutorialCarousel.PositionSelected += tutorialCarousel_PositionSelected;
        }
 public PageAdapter(CarouselViewControl element, ViewPager viewpager)
 {
     Element    = element;
     mViewPager = viewpager;
 }
 public PageAdapter(CarouselViewControl element)
 {
     Element = element;
 }
        public DiscountDetailPage(DiscountDetailData discountDetailData)
            : base(typeof(DiscountDetailViewModel), typeof(DiscountDetailContentUI))
        {
            BackgroundColor         = MainStyles.StatusBarColor.FromResources <Color>();
            Content.BackgroundColor = MainStyles.MainLightBackgroundColor.FromResources <Color>();

            var loadingColor = MainStyles.LoadingColor.FromResources <Color>();

            LoadingActivityIndicator.Color = loadingColor;
            LoadingActivityText.TextColor  = loadingColor;

            viewModel.SetDiscount(discountDetailData);

            var mainLayout = new AbsoluteLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            var appBar = new TitleBar(this, TitleBar.BarBtnEnum.bbBack)
            {
                BarColor   = Color.Transparent,
                BoxPadding =
                {
                    BackgroundColor = MainStyles.StatusBarColor.FromResources <Color>()
                },
                BtnBack =
                {
                    BackgroundColor = MainStyles.StatusBarColor.FromResources <Color>(),
                    Source          = contentUI.IconBack
                }
            };

            #region Label percent

            const int sizeImgLabel = 60;

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

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

            var spanDiscountPercent = new Span
            {
                Style = LabelStyles.LabelPercentStyle.FromResources <Style>()
            };
            spanDiscountPercent.SetBinding(Span.TextProperty, nameof(DiscountDetailViewModel.DiscountPercent));

            var spanDiscountType = new Span
            {
                Style = LabelStyles.LabelPercentSymbolStyle.FromResources <Style>()
            };
            spanDiscountType.SetBinding(Span.TextProperty, nameof(DiscountDetailViewModel.DiscountType));

            var txtPercent = new Label
            {
                Rotation      = -15,
                TranslationY  = -1,
                FormattedText = new FormattedString
                {
                    Spans =
                    {
                        spanDiscountPercent,
                        spanDiscountType
                    }
                }
            };

            AbsoluteLayout.SetLayoutFlags(txtPercent, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(txtPercent,
                                           new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            labelLayout.Children.Add(txtPercent);

            #endregion

            #region WebAddress & Category list

            var flexCategories = new FlexLayout
            {
                Direction      = FlexDirection.Row,
                Wrap           = FlexWrap.Wrap,
                JustifyContent = FlexJustify.Start,
                AlignItems     = FlexAlignItems.Center,
                AlignContent   = FlexAlignContent.Start,
                Margin         = new Thickness(20, 15, 15, 0)
            };

            const int sizeWebAddress = 40;

            foreach (var webAddress in viewModel.WebAddresses)
            {
                var imgWebAddress = new Image
                {
                    Source        = webAddress.Type.GetWebAddressIcon(),
                    Margin        = new Thickness(0, 0, 5, 5),
                    WidthRequest  = sizeWebAddress,
                    HeightRequest = sizeWebAddress
                };

                var tapWebAddress = new TapGestureRecognizer
                {
                    CommandParameter = webAddress.Url
                };
                tapWebAddress.Tapped += viewModel.TxtUrlAddress_Click;

                imgWebAddress.GestureRecognizers.Add(tapWebAddress);

                flexCategories.Children.Add(imgWebAddress);
            }

            var flexSeparator = new ContentView();
            FlexLayout.SetGrow(flexSeparator, 1);
            flexCategories.Children.Add(flexSeparator);

            foreach (var category in viewModel.Categories)
            {
                var categoryLayout = new CategoryItemTemplate
                {
                    Margin         = new Thickness(0, 0, 5, 5),
                    BindingContext = category
                };

                flexCategories.Children.Add(categoryLayout);
            }

            #endregion

            #region Carousel images

            var carouselView = new CarouselViewControl
            {
                Orientation  = CarouselViewOrientation.Horizontal,
                ItemTemplate = new DataTemplate(typeof(GalleryImageItemTemplate)),
                CurrentPageIndicatorTintColor = MainStyles.MainBackgroundColor.FromResources <Color>()
            };
            carouselView.SetBinding(CarouselViewControl.ItemsSourceProperty,
                                    nameof(DiscountDetailViewModel.GalleryImages));
            carouselView.SetBinding(CarouselViewControl.ShowIndicatorsProperty,
                                    nameof(DiscountDetailViewModel.HasGalleryImages));
            carouselView.SetBinding(CarouselViewControl.IsSwipeEnabledProperty,
                                    nameof(DiscountDetailViewModel.HasGalleryImages));

            var carouselLayout = new RelativeLayout
            {
                VerticalOptions = LayoutOptions.Start
            };

            carouselLayout.Children.Add(carouselView,
                                        Constraint.Constant(0),
                                        Constraint.Constant(0),
                                        Constraint.RelativeToParent(parent => parent.Width),
                                        Constraint.RelativeToParent(parent =>
                                                                    Device.Info.CurrentOrientation.IsPortrait() ? parent.Width * 0.5625 :
                                                                    Device.Idiom == TargetIdiom.Phone ? 200 : 400));

            carouselLayout.Children.Add(labelLayout,
                                        Constraint.RelativeToView(carouselView, (parent, view) => view.Width - sizeImgLabel - 5),
                                        Constraint.RelativeToView(carouselView, (parent, view) => view.Height - sizeImgLabel - 5));

            #endregion

            #region Name company

            var txtPartnerName = new Label
            {
                Style  = LabelStyles.DetailTitleStyle.FromResources <Style>(),
                Margin = new Thickness(20, 0)
            };
            txtPartnerName.SetBinding(Label.TextProperty, nameof(DiscountDetailViewModel.NameCompany));

            #endregion

            #region Description

            var txtDescription = new Label
            {
                Style         = LabelStyles.DescriptionStyle.FromResources <Style>(),
                Margin        = new Thickness(20, 10, 20, 0),
                LineBreakMode = LineBreakMode.WordWrap
            };
            txtDescription.SetBinding(Label.TextProperty, nameof(DiscountDetailViewModel.Description));

            #endregion

            #region Rating view

            var ratingView = new RatingView
            {
                Style = LabelStyles.RatingStyle.FromResources <Style>()
            };
            ratingView.SetBinding(RatingView.ValueProperty, nameof(DiscountDetailViewModel.UserRating));

            var ratingLabel = new Label
            {
                Style           = LabelStyles.DescriptionStyle.FromResources <Style>(),
                VerticalOptions = LayoutOptions.End
            };
            ratingLabel.SetBinding(Label.TextProperty, nameof(DiscountDetailViewModel.RatingString));
            ratingLabel.SetBinding(IsVisibleProperty, nameof(DiscountDetailViewModel.IsDiscountRatingAvailable));

            var activityIndicator = new ActivityIndicator
            {
                Color             = Color.FromHex("444"),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.End,
                WidthRequest      = 20,
                HeightRequest     = 20
            };
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, nameof(DiscountDetailViewModel.IsLoadingRating));
            activityIndicator.SetBinding(IsVisibleProperty, nameof(DiscountDetailViewModel.IsLoadingRating));

            var stackRating = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Margin      = new Thickness(20, 0),
                Spacing     = 10,
                Children    =
                {
                    ratingView,
                    ratingLabel,
                    activityIndicator
                }
            };

            #endregion

            var discountLayout = new StackLayout
            {
                Spacing     = 0,
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    carouselLayout,
                    flexCategories,
                    txtPartnerName,
                    stackRating,
                    txtDescription
                }
            };

            foreach (var brachItem in viewModel.BranchItems)
            {
                var view = new BranchInfoViewTemplate(contentUI, viewModel)
                {
                    BindingContext = brachItem
                };

                discountLayout.Children.Add(view);
            }

            var scrollDiscount = new ScrollView
            {
                Content = discountLayout
            };

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

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

            var safeAreaHelper = new SafeAreaHelper();
            safeAreaHelper.UseSafeArea(this, SafeAreaHelper.CustomSafeAreaFlags.Top);
            safeAreaHelper.UseSafeArea(appBar.BtnBack, SafeAreaHelper.CustomSafeAreaFlags.Left);
            safeAreaHelper.UseSafeArea(scrollDiscount, SafeAreaHelper.CustomSafeAreaFlags.Horizontal);

            ContentLayout.Children.Add(mainLayout);
        }