public void RateOnClick(Object sender, EventArgs e) { this.ToolbarItems.Clear(); this.ToolbarItems.Add(submitItem); this.ToolbarItems.Add(cancelItem); RatingLayout.IsVisible = true; RatingLayout.TranslateTo(0, 50); }
//private StackLayout MakePointOfSaleStackLayout(PointOfSale pointOfSale) //{ // StackLayout MainStack = new StackLayout() // { // BackgroundColor = Color.White, // Margin = new Thickness(0, 0, 0, 7), // }; // Grid MainGrid = new Grid(); // MainGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Star }); // MainGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(5, GridUnitType.Star) }); // MainGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(3, GridUnitType.Star) }); // StackLayout gridFirstStackChild = new StackLayout() { Padding = new Thickness(20, 0, 0, 0) }; // StackLayout s1 = new StackLayout() // { // Orientation = StackOrientation.Horizontal // }; // s1.Children.Add(new Label() { Text = "Adresse:", FontSize = 15, FontAttributes = FontAttributes.Bold, TextColor = Color.Black, WidthRequest = 70 }); // s1.Children.Add(new Label() { Text = pointOfSale.Address.ToString(), FontSize = 15, TextColor = Color.Black }); // StackLayout s2 = new StackLayout() // { // Orientation = StackOrientation.Horizontal // }; // s2.Children.Add(new Label() { Text = "Parking:", FontSize = 15, FontAttributes = FontAttributes.Bold, TextColor = Color.Black, WidthRequest = 70 }); // s2.Children.Add(new Label() { Text = pointOfSale.Parking.ToString(), FontSize = 15, TextColor = Color.Black }); // StackLayout s3 = new StackLayout() // { // Orientation = StackOrientation.Horizontal // }; // s3.Children.Add(new Label() { Text = "Date de creation:", FontSize = 15, FontAttributes = FontAttributes.Bold, TextColor = Color.Black, WidthRequest = 70 }); // s3.Children.Add(new Label() { Text = pointOfSale.CreationDate.Day + "/" + pointOfSale.CreationDate.Month + "/" + pointOfSale.CreationDate.Year, FontSize = 15, TextColor = Color.Black }); // StackLayout s4 = new StackLayout(); // StackLayout s4Child = new StackLayout() { Padding = new Thickness(10, 0, 0, 0) }; // foreach (PhoneNumber ph in pointOfSale.PhoneNumbers) // { // s4Child.Children.Add(new Label() { Text = ph.Number + " " + ph.PhoneNumberType.Type, FontSize = 15, TextColor = Color.Black }); // } // s4.Children.Add(new Label() { Text = "Numéro de telephones:", FontSize = 15, FontAttributes = FontAttributes.Bold, TextColor = Color.Black, HeightRequest = 20 }); // s4.Children.Add(s4Child); // gridFirstStackChild.Children.Add(s1); // gridFirstStackChild.Children.Add(s2); // gridFirstStackChild.Children.Add(s3); // gridFirstStackChild.Children.Add(s4); // StackLayout gridSecondStackChild = new StackLayout() // { // Padding = new Thickness(0, 0, 0, 10), // }; // Grid TimeTitelGrid = new Grid(); // TimeTitelGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); // TimeTitelGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); // TimeTitelGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(4, GridUnitType.Star) }); // TimeTitelGrid.Children.Add(new Label() { Text = "Jours", FontSize = 12, FontAttributes = FontAttributes.Bold, TextColor = Color.Black }, 0, 0); // TimeTitelGrid.Children.Add(new Label() { Text = "Heures", FontSize = 12, FontAttributes = FontAttributes.Bold, TextColor = Color.Black }, 1, 0); // gridSecondStackChild.Children.Add(TimeTitelGrid); // foreach (WorkDay w in pointOfSale.WorkDays) // { // StackLayout WorkDayStack = new StackLayout(); // Grid WorkDayGrid = new Grid(); // WorkDayGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); // WorkDayGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); // WorkDayGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(4, GridUnitType.Star) }); // StackLayout HoursStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; // HoursStack.Children.Add(new Label() { Text = TimeSpanToTime(w.OpenTime), FontSize = 15, TextColor = Color.Green }); // HoursStack.Children.Add(new Label() { Text = "-", FontSize = 13, TextColor = Color.Green }); // HoursStack.Children.Add(new Label() { Text = TimeSpanToTime(w.CloseTime), FontSize = 13, TextColor = Color.Green }); // WorkDayGrid.Children.Add(new Label() { Text = DayNumberToDayName(w.Day), FontSize = 13, TextColor = Color.Black }, 0, 0); // WorkDayGrid.Children.Add(HoursStack, 1, 0); // WorkDayStack.Children.Add(WorkDayGrid); // gridSecondStackChild.Children.Add(WorkDayStack); // } // MainGrid.Children.Add(gridFirstStackChild, 0, 0); // MainGrid.Children.Add(gridSecondStackChild, 1, 0); // MainStack.Children.Add(MainGrid); // return MainStack; //} //private string TimeSpanToTime(TimeSpan time) //{ // return time.Hours + "h" + time.Minutes; //} //private string DayNumberToDayName(int Day) //{ // switch (Day) // { // case 1: // return "Lun."; // case 2: // return "Mar."; // case 3: // return "Mer."; // case 4: // return "Jeu."; // case 5: // return "Ven."; // case 6: // return "Sam."; // case 7: // return "Dim."; // } // return null; //} public async void ResetToolbar() { await RatingLayout.TranslateTo(0, 0); RatingLayout.IsVisible = false; ToolbarItems.Clear(); ToolbarItems.Add(RateItem); ToolbarItems.Add(ProductList); ToolbarItems.Add(PointOfSalesItem); starIndex = 0; var lsi = RatingStack.Children; foreach (Image i in lsi) { i.Source = "emptyStar.png"; } ReactionLabel.Text = ""; }
private DataTemplate GetDataTemplate() { return(new DataTemplate(() => { Label author = new CustomLabel(); author.SetBinding(Label.TextProperty, "Author"); author.TextColor = Props.ButtonInfoPageColor; author.FontSize = 20; author.FontFamily = UIUtils.FONT_BEBAS_REGULAR; author.Margin = new Thickness(20, 0, 20, 0); var ratingLayout = new RatingLayout(); ratingLayout.HeightRequest = 20; ratingLayout.SetBinding(RatingLayout.RatingProperty, "Rating"); ratingLayout.HorizontalOptions = LayoutOptions.EndAndExpand; ratingLayout.Margin = new Thickness(0, 0, 20, 0); var top = new StackLayout { Orientation = StackOrientation.Horizontal, Margin = new Thickness(0, 20, 0, 0), Children = { author, ratingLayout } }; var review = new CustomLabel(); review.SetBinding(Label.TextProperty, "Description"); review.TextColor = Color.Black; review.HorizontalOptions = LayoutOptions.Fill; review.FontFamily = UIUtils.FONT_SFUIDISPLAY_LIGHT; review.Margin = new Thickness(20, 0, 20, 0); var layout = new StackLayout(); layout.Children.Add(top); layout.Children.Add(review); var viewCell = new ViewCell(); viewCell.View = layout; return viewCell; })); }
private void BuildReviews(JArray reviewArr) { infoLayout.Children.RemoveAt(infoLayout.Children.Count - 1); infoLayout.Children.Add(UIUtils.MakeSeparator(true)); foreach (var review in reviewArr) { var reviewLabel = new CustomLabel() { Text = "REVIEW:", FontSize = 22, TextColor = Color.Black, VerticalOptions = LayoutOptions.Center, FontFamily = UIUtils.FONT_BEBAS_REGULAR, HorizontalOptions = LayoutOptions.FillAndExpand }; var rating = new RatingLayout() { Rating = (int)review["Rating"], IsEditable = false, HeightRequest = 30, HorizontalOptions = LayoutOptions.End }; var row1 = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Fill, Margin = new Thickness(20, 20, 20, 10), Children = { reviewLabel, rating } }; infoLayout.Children.Add(row1); var reviewText = new CustomLabel() { Text = (string)review["Description"], TextColor = Color.Black, FontSize = 14, HorizontalOptions = LayoutOptions.FillAndExpand, FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR, Margin = new Thickness(20, 0, 20, 20) }; infoLayout.Children.Add(reviewText); } }
private void BuildReview() { reviewEntry = UIUtils.MakeEntry("Write a review", UIUtils.FONT_SFUIDISPLAY_REGULAR); reviewEntry.BackgroundColor = Color.Transparent; reviewEntry.VerticalOptions = LayoutOptions.CenterAndExpand; reviewEntry.HorizontalOptions = LayoutOptions.FillAndExpand; reviewEntry.HeightRequest = 40; reviewEntry.FontSize = 15; var sendButton = new Button(); sendButton.BackgroundColor = Color.Transparent; sendButton.Text = "SEND"; sendButton.WidthRequest = 100; sendButton.VerticalOptions = LayoutOptions.CenterAndExpand; sendButton.TextColor = Props.ButtonColor; sendButton.FontFamily = UIUtils.FONT_BEBAS_REGULAR; sendButton.FontSize = 18; sendButton.Margin = new Thickness(0, 0, 20, 0); sendButton.HorizontalOptions = LayoutOptions.EndAndExpand; sendButton.Clicked += OnSendReviewClick; reviewRating = new RatingLayout() { Rating = 0, IsEditable = true, Margin = new Thickness(20, 5, 0, 0), HeightRequest = 40, HorizontalOptions = LayoutOptions.Fill }; var sendLayout = new StackLayout() { Orientation = StackOrientation.Vertical, BackgroundColor = Props.GrayColor, IsVisible = CanSendReview, Children = { reviewRating, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { reviewEntry, sendButton } } } }; if (mua.Reviews == null || mua.Reviews.Count == 0) { var stackLayout = new StackLayout(); stackLayout.Children.Add(sendLayout); stackLayout.VerticalOptions = LayoutOptions.End; mainContent.Content = stackLayout; } else { double averageValue = mua.Reviews.Select(s => s.Rating).Average(); var averageLabel = new CustomLabel(); averageLabel.Text = "AVERAGE REVIEW:"; averageLabel.TextColor = Props.ButtonInfoPageColor; averageLabel.FontFamily = UIUtils.FONT_BEBAS_REGULAR; averageLabel.FontSize = 20; averageLabel.VerticalOptions = LayoutOptions.CenterAndExpand; averageLabel.Margin = new Thickness(20, 0, 20, 0); var line = MakeSeparateLine(); var starsLayout = new RatingLayout(); starsLayout.HeightRequest = 20; starsLayout.Rating = averageValue; starsLayout.HorizontalOptions = LayoutOptions.EndAndExpand; starsLayout.VerticalOptions = LayoutOptions.CenterAndExpand; starsLayout.Margin = new Thickness(0, 0, 20, 0); var averageLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Margin = new Thickness(0, 20, 0, 20), Children = { averageLabel, starsLayout } }; var header = new StackLayout { Children = { averageLayout, line } }; var reviewList = new ListView(); reviewList.ItemTemplate = GetDataTemplate(); reviewList.ItemSelected += (s, args) => { reviewList.SelectedItem = null; }; reviewList.ItemsSource = mua.Reviews; reviewList.SeparatorColor = Props.GrayColor; //reviewList.RowHeight = 70; reviewList.Header = header; var stackLayout = new StackLayout(); reviewList.HasUnevenRows = true; stackLayout.Children.Add(reviewList); stackLayout.Children.Add(sendLayout); mainContent.Content = stackLayout; } }
private DataTemplate GetDataTemplate() { return(new DataTemplate(() => { CustomLabel address = new CustomLabel(); address.SetBinding(Label.TextProperty, "Address"); address.LetterSpacing = 0.15f; address.FontSize = 14; address.TextColor = Color.FromHex("#4A4A4A"); address.LineBreakMode = LineBreakMode.TailTruncation; address.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR; address.Margin = new Thickness(10, 0, 5, 0); CustomLabel mainText = new CustomLabel(); mainText.SetBinding(Label.TextProperty, "BusinessName"); mainText.LetterSpacing = 0.25f; mainText.FontSize = 21; mainText.TextColor = Color.FromHex("#4A4A4A"); mainText.FontFamily = UIUtils.FONT_BEBAS_BOOK; mainText.Margin = new Thickness(5, 0, 0, 0); CustomLabel price = new CustomLabel(); price.SetBinding(Label.TextProperty, "Price"); price.LetterSpacing = 0.1f; price.FontSize = 14; price.TextColor = Color.FromHex("#4A4A4A"); price.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR; CustomLabel nameMua = new CustomLabel(); nameMua.SetBinding(Label.TextProperty, "FullName"); nameMua.LetterSpacing = 0.15f; nameMua.FontSize = 16; nameMua.TextColor = Color.FromHex("#4A4A4A"); nameMua.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR; nameMua.Margin = new Thickness(5, 0, 0, 0); var imageBackground = new Image(); imageBackground.SetBinding(UIUtils.TagProperty, "Pictures"); imageBackground.SetValue(UIUtils.Tag2Property, 0); imageBackground.Aspect = Aspect.AspectFill; imageBackground.SetBinding(Image.SourceProperty, "PictureSourse"); var leftImg = new Image(); leftImg.Source = ImageSource.FromResource("TiroApp.Images.goToMua.png"); leftImg.HeightRequest = 40; leftImg.WidthRequest = leftImg.HeightRequest; leftImg.GestureRecognizers.Add(new TapGestureRecognizer((v) => { ShowNextBgImage(imageBackground, -1); })); var rightImg = new Image(); rightImg.Source = ImageSource.FromResource("TiroApp.Images.goToMua.png"); rightImg.Rotation = 180; rightImg.HeightRequest = 40; rightImg.WidthRequest = rightImg.HeightRequest; rightImg.GestureRecognizers.Add(new TapGestureRecognizer((v) => { ShowNextBgImage(imageBackground, 1); })); var location = new Image(); location.Source = ImageSource.FromResource("TiroApp.Images.location_black.png"); location.HeightRequest = 20; //location.WidthRequest = rightImg.HeightRequest; var ratingLayout = new RatingLayout(); ratingLayout.HeightRequest = 20; ratingLayout.SetBinding(RatingLayout.RatingProperty, "Rating"); var infoImage = new Image(); infoImage.Source = ImageSource.FromResource("TiroApp.Images.muaListRectangle.png"); infoImage.Aspect = Aspect.Fill; //infoImage.HeightRequest = 70; //infoImage.WidthRequest = App.ScreenWidth; //var infoFrame = new Frame(); //infoFrame.Content = infoImage; //infoFrame.OutlineColor = Color.FromHex("#979797"); var layout = new RelativeLayout(); layout.Children.Add(imageBackground, Constraint.Constant(0), Constraint.Constant(0) , Constraint.RelativeToParent(p => p.Width) , Constraint.RelativeToParent(p => p.Height - 70)); layout.Children.Add(leftImg , Constraint.RelativeToParent(p => p.Width - Utils.GetControlSize(leftImg).Width - 10) , Constraint.RelativeToParent(p => (p.Height - 70) / 2 - Utils.GetControlSize(leftImg).Height / 2)); layout.Children.Add(rightImg , Constraint.Constant(10) , Constraint.RelativeToParent(p => (p.Height - 70) / 2 - Utils.GetControlSize(rightImg).Height / 2)); layout.Children.Add(infoImage , Constraint.Constant(0) , Constraint.RelativeToParent(p => p.Height - 70) , Constraint.RelativeToParent(p => p.Width) , Constraint.Constant(75)); layout.Children.Add(mainText , Constraint.Constant(3) , Constraint.RelativeToParent(p => p.Height - 65)); layout.Children.Add(nameMua , Constraint.Constant(3) , Constraint.RelativeToParent(p => p.Height - Utils.GetControlSize(nameMua).Height - Utils.GetControlSize(location).Height - 4)); layout.Children.Add(location , Constraint.Constant(8) , Constraint.RelativeToParent(p => p.Height - Utils.GetControlSize(location).Height - 2)); layout.Children.Add(address , Constraint.RelativeToParent(p => Utils.GetControlSize(location).Width + 4) , Constraint.RelativeToParent(p => p.Height - Utils.GetControlSize(address).Height - 2) , Constraint.RelativeToParent(p => Utils.GetControlSize(address).Width) , Constraint.RelativeToParent(p => Utils.GetControlSize(address).Height)); layout.Children.Add(ratingLayout , Constraint.RelativeToParent(p => p.Width - Utils.GetControlSize(ratingLayout).Width - 5) , Constraint.RelativeToParent(p => p.Height - 65)); layout.Children.Add(price , Constraint.RelativeToParent(p => p.Width - Utils.GetControlSize(price).Width - 5) , Constraint.RelativeToParent(p => p.Height - 40)); layout.Margin = new Thickness(0, 0, 0, 25); var viewCell = new ViewCell(); viewCell.View = layout; return viewCell; })); }
private DataTemplate GetDataTemplate() { return(new DataTemplate(() => { Label address = new CustomLabel(); address.SetBinding(Label.TextProperty, "Address"); address.TextColor = Color.White; address.LineBreakMode = LineBreakMode.TailTruncation; address.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR; Label mainText = new CustomLabel(); mainText.SetBinding(Label.TextProperty, "BusinessName"); mainText.FontSize = 21; mainText.TextColor = Color.White; mainText.FontFamily = UIUtils.FONT_BEBAS_BOOK; Label price = new CustomLabel(); price.SetBinding(Label.TextProperty, "Price"); price.TextColor = Color.White; price.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR; Label nameMua = new CustomLabel(); nameMua.SetBinding(Label.TextProperty, "FullName"); nameMua.TextColor = Color.White; nameMua.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR; var imageBackground = new Image(); imageBackground.SetBinding(UIUtils.TagProperty, "Pictures"); imageBackground.SetValue(UIUtils.Tag2Property, 0); imageBackground.Aspect = Aspect.AspectFill; imageBackground.SetBinding(Image.SourceProperty, "PictureSourse"); var leftImg = new Image(); leftImg.Source = ImageSource.FromResource("TiroApp.Images.goToMua.png"); leftImg.HeightRequest = 40; leftImg.WidthRequest = leftImg.HeightRequest; leftImg.GestureRecognizers.Add(new TapGestureRecognizer((v) => { ShowNextBgImage(imageBackground, -1); })); var rightImg = new Image(); rightImg.Source = ImageSource.FromResource("TiroApp.Images.goToMua.png"); rightImg.Rotation = 180; rightImg.HeightRequest = 40; rightImg.WidthRequest = rightImg.HeightRequest; rightImg.GestureRecognizers.Add(new TapGestureRecognizer((v) => { ShowNextBgImage(imageBackground, 1); })); var location = new Image(); location.Source = ImageSource.FromResource("TiroApp.Images.location.png"); location.HeightRequest = 20; location.WidthRequest = rightImg.HeightRequest; var ratingLayout = new RatingLayout(); ratingLayout.HeightRequest = 20; ratingLayout.SetBinding(RatingLayout.RatingProperty, "Rating"); var layout = new RelativeLayout(); layout.BackgroundColor = Color.Black;//TEMP layout.Children.Add(imageBackground, Constraint.Constant(0), Constraint.Constant(0) , Constraint.RelativeToParent(p => p.Width) , Constraint.RelativeToParent(p => p.Height)); layout.Children.Add(price , Constraint.Constant(10) , Constraint.Constant(10)); layout.Children.Add(mainText , Constraint.Constant(10) , Constraint.RelativeToParent(p => p.Height - p.Height / 3 - Utils.GetControlSize(mainText).Height + 20)); layout.Children.Add(nameMua , Constraint.Constant(10) , Constraint.RelativeToParent(p => p.Height - p.Height / 3 + 20)); layout.Children.Add(leftImg , Constraint.RelativeToParent(p => p.Width - Utils.GetControlSize(leftImg).Width - 10) , Constraint.RelativeToParent(p => p.Height / 2 - Utils.GetControlSize(leftImg).Height / 2)); layout.Children.Add(rightImg , Constraint.Constant(10) , Constraint.RelativeToParent(p => p.Height / 2 - Utils.GetControlSize(rightImg).Height / 2)); layout.Children.Add(location , Constraint.Constant(0) , Constraint.RelativeToParent(p => p.Height - Utils.GetControlSize(location).Height - 15)); layout.Children.Add(address , Constraint.Constant(40) , Constraint.RelativeToParent(p => p.Height - Utils.GetControlSize(address).Height - 15) , Constraint.RelativeToParent(p => p.Width - Utils.GetControlSize(ratingLayout).Width - 60) , Constraint.RelativeToParent(p => Utils.GetControlSize(address).Height)); layout.Children.Add(ratingLayout , Constraint.RelativeToParent(p => p.Width - Utils.GetControlSize(ratingLayout).Width - 15) , Constraint.RelativeToParent(p => p.Height - Utils.GetControlSize(ratingLayout).Height - 15)); var viewCell = new ViewCell(); viewCell.View = layout; return viewCell; })); }