/// <summary> /// Invoke the command if there is one /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> private void Control_LongClick(object sender, global::Android.Views.View.LongClickEventArgs e) { Console.WriteLine("Invoking long click command"); var command = LongPressedEffect.GetCommand(Element); command?.Execute(LongPressedEffect.GetCommandParameter(Element)); }
private void Control_Click(object sender, EventArgs e) { var command = LongPressedEffect.GetCommand(Element); LongPressedEffect.SetCommandParameter(Element, LongPressedEffect.EffectType.RegularTap); command?.Execute(LongPressedEffect.GetCommandParameter(Element)); }
/// <summary> /// Invoke the command if there is one /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> private void Control_LongClick(object sender, Android.Views.View.LongClickEventArgs e) { var command = LongPressedEffect.GetCommand(Element); LongPressedEffect.SetCommandParameter(Element, LongPressedEffect.EffectType.LongPress); command?.Execute(LongPressedEffect.GetCommandParameter(Element)); }
/// <summary> /// Invoke the command if there is one /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> private void Control_LongClick(object sender, Android.Views.View.LongClickEventArgs e) { // System.Diagnostics.Debug.WriteLine("Invoking long click command"); var command = LongPressedEffect.GetCommand(Element); command?.Execute(LongPressedEffect.GetCommandParameter(Element)); }
private void HandleTap() { var command = LongPressedEffect.GetCommand(Element); LongPressedEffect.SetCommandParameter(Element, LongPressedEffect.EffectType.RegularTap); command?.Execute(LongPressedEffect.GetCommandParameter(Element)); }
/// <summary> /// Invoke the command if there is one /// </summary> private void HandleLongClick() { var command = LongPressedEffect.GetCommand(Element); command?.Execute(LongPressedEffect.GetCommandParameter(Element)); var action = LongPressedEffect.GetAction(Element); action?.Invoke(); }
/// <summary> /// Invoke the command if there is one /// </summary> private void HandleLongClick(UILongPressGestureRecognizer longPressGestureRecognizer) { if (longPressGestureRecognizer.State != UIGestureRecognizerState.Began) { return; } var command = LongPressedEffect.GetCommand(Element); LongPressedEffect.SetCommandParameter(Element, LongPressedEffect.EffectType.LongPress); command?.Execute(LongPressedEffect.GetCommandParameter(Element)); }
//https://stackoverflow.com/questions/7414065/android-scale-animation-on-view private void Container_Touch(object sender, Android.Views.View.TouchEventArgs e) { var command = LongPressedEffect.GetCommand(Element); //System.Console.WriteLine("ACTION:" + e.Event.Action + "|" + e.Event.Action.HasFlag(Android.Views.MotionEventActions.Cancel)); e.Handled = true; switch (e.Event.Action) { case Android.Views.MotionEventActions.ButtonPress: break; case Android.Views.MotionEventActions.ButtonRelease: if (isHolding) { Cancel(); command?.Execute(LongPressedEffect.GetCommandParameter(Element)); } break; case Android.Views.MotionEventActions.Cancel: Cancel(); e.Handled = true; break; case Android.Views.MotionEventActions.Down: OnPress?.Invoke(id, EventArgs.Empty); lastX = e.Event.RawX; lastY = e.Event.RawY; Start(); break; case Android.Views.MotionEventActions.HoverEnter: break; case Android.Views.MotionEventActions.HoverExit: Cancel(); break; case Android.Views.MotionEventActions.HoverMove: break; case Android.Views.MotionEventActions.Mask: break; case Android.Views.MotionEventActions.Move: if (!autoCancel) { if (System.MathF.Sqrt(System.MathF.Pow(e.Event.RawX - lastX, 2) + System.MathF.Pow(e.Event.RawY - lastY, 2)) > 5) { Cancel(); } else if (!IsViewInBounds(s, (int)e.Event.RawX, (int)e.Event.RawY)) { Cancel(); } } /*if (!((Android.Views.View)sender).ClipBounds.Contains(new Android.Graphics.Rect(x - 1, y + 1, x - 1, y - 1))) { * Cancel(); * }*/ break; case Android.Views.MotionEventActions.Outside: Cancel(); break; case Android.Views.MotionEventActions.Up: if (isHolding) { Cancel(); e.Handled = true; command?.Execute(LongPressedEffect.GetCommandParameter(Element)); } break; case Android.Views.MotionEventActions.Scroll: Cancel(); break; default: break; } }
/// <summary> /// Invoke the command if there is one. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">Event arguments.</param> private void Control_LongClick(object sender, View.LongClickEventArgs e) { var command = LongPressedEffect.GetCommand(Element); command?.Execute(LongPressedEffect.GetCommandParameter(Element)); }
void UpdateBookmarks() { try { int height = 150; Bookmarks.HeightRequest = height; string[] keys = App.GetKeys <string>(App.BOOKMARK_DATA); List <string> data = new List <string>(); bookmarkPosters = new List <BookmarkPoster>(); Bookmarks.Children.Clear(); updateLabels.Clear(); IsBookmarked.Clear(); int index = 0; bool allDone = false; for (int i = 0; i < keys.Length; i++) { string __key = keys[i]; if (__key == "") { continue; } string name = FindHTML(__key, "Name=", "|||"); string posterUrl = FindHTML(__key, "PosterUrl=", "|||"); posterUrl = ConvertIMDbImagesToHD(posterUrl, 182, 268); string id = FindHTML(__key, "Id=", "|||"); if (name != "" && posterUrl != "" && id != "") { if (CheckIfURLIsValid(posterUrl)) { IsBookmarked.Add(id, true); string posterURL = ConvertIMDbImagesToHD(posterUrl, 76, 113, 1.75); if (CheckIfURLIsValid(posterURL)) { Grid stackLayout = new Grid() { VerticalOptions = LayoutOptions.Start, }; stackLayout.Effects.Add(Effect.Resolve("CloudStreamForms.LongPressedEffect")); var _b = new BookmarkPoster() { id = id, name = name, posterUrl = posterUrl }; bookmarkPosters.Add(_b); LongPressedEffect.SetCommand(stackLayout, new Command(() => { PushPageFromUrlAndName(_b.id, _b.name); })); var ff = new FFImageLoading.Forms.CachedImage { Source = posterURL, HeightRequest = RecPosterHeight, WidthRequest = RecPosterWith, BackgroundColor = Color.Transparent, VerticalOptions = LayoutOptions.Start, InputTransparent = true, Transformations = { // new FFImageLoading.Transformations.RoundedTransformation(10,1,1.5,10,"#303F9F") new FFImageLoading.Transformations.RoundedTransformation(10, 1, 1.5, 0, "#303F9F") }, // InputTransparent = true, }; // ================================================================ RECOMMENDATIONS CLICKED ================================================================ //stackLayout.SetValue(XamEffects.BorderView.CornerRadiusProperty, 20); /* * var brView = new BorderView() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, CornerRadius = 5 }; * * brView.SetValue(XamEffects.TouchEffect.ColorProperty, Color.White); * Commands.SetTap(brView, new Command((o) => { * var z = (BookmarkPoster)o; * PushPageFromUrlAndName(z.id, z.name); * })); * Commands.SetTapParameter(brView, _b);*/ // var _color = Settings.BlackColor + 5; Frame boxView = new Frame() { BackgroundColor = Settings.ItemBackGroundColor, // Color.FromRgb(_color, _color, _color), // InputTransparent = true, CornerRadius = 5, HeightRequest = RecPosterHeight + bookmarkLabelTransY, TranslationY = 0, WidthRequest = RecPosterWith, HasShadow = true, }; stackLayout.Children.Add(boxView); stackLayout.Children.Add(ff); //stackLayout.Children.Add(imageButton); stackLayout.Children.Add(new Label() { Text = name, VerticalOptions = LayoutOptions.Start, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.Center, Padding = 1, TextColor = Color.White, MaxLines = 2, ClassId = "OUTLINE", TranslationY = RecPosterHeight }); //stackLayout.Children.Add(brView); if (Settings.ShowNextEpisodeReleaseDate) { CloudStreamCore.NextAiringEpisodeData?nextData = App.GetKey <NextAiringEpisodeData?>(App.NEXT_AIRING, id, null); if (nextData.HasValue) { var nextAir = nextData.Value; string nextTxt = GetAirDate(nextAir.airingAt); var btt = new Button() { //BackgroundColor = new Color(0.188, 0.247, 0.623, 0.8) BackgroundColor = new Color(0, 0, 0, 0.4), Text = nextTxt, ClassId = "CUST", TextColor = Color.White, InputTransparent = true, HeightRequest = 20, FontSize = 11, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.End, CornerRadius = 1, Padding = 2, Margin = 0, Scale = 1, TranslationX = 1, WidthRequest = 60 }; updateLabels.Add(new UpdateLabel() { label = btt, id = id }); stackLayout.Children.Add(btt); } } stackLayout.Opacity = 0; async void WaitUntillComplete() { stackLayout.Opacity = 0; while (!allDone) { await Task.Delay(50); } await stackLayout.FadeTo(1, (uint)(200 + index * 50), Easing.Linear); } WaitUntillComplete(); index++; //slay.Children.Add(stackLayout); Bookmarks.Children.Add(stackLayout); /* * Grid stackLayout = new Grid(); * * * var ff = new FFImageLoading.Forms.CachedImage { * Source = posterUrl, * HeightRequest = height, * WidthRequest = 87, * BackgroundColor = Color.Transparent, * VerticalOptions = LayoutOptions.Start, * Transformations = { * new FFImageLoading.Transformations.RoundedTransformation(1,1,1.5,0,"#303F9F") * }, * InputTransparent = true, * }; * * //Source = p.posterUrl * * stackLayout.Children.Add(ff); * // stackLayout.Children.Add(imageButton); * bookmarkPosters.Add(new BookmarkPoster() { id = id, name = name, posterUrl = posterUrl }); * Grid.SetColumn(stackLayout, Bookmarks.Children.Count); * Bookmarks.Children.Add(stackLayout); * * // --- RECOMMENDATIONS CLICKED ----- * stackLayout.SetValue(XamEffects.TouchEffect.ColorProperty, Color.White); * Commands.SetTap(stackLayout, new Command((o) => { * int z = (int)o; * PushPageFromUrlAndName(bookmarkPosters[z].id, bookmarkPosters[z].name); * })); * Commands.SetTapParameter(stackLayout, i);*/ } } // data.Add(App.GetKey("BookmarkData")) } //await Task.Delay(100); //MScroll.HeightRequest = keys.Count > 0 ? 130 : 0; } allDone = true; hasBookmarks = bookmarkPosters.Count > 0; UpdateNoBookmarks(); /*if (ImdbTypePicker.SelectedIndex == -1) { * ImdbTypePicker.SelectedIndex = bookmarkPosters.Count > 0 ? 0 : 2; // SET TO POPULAR BY DEAFULT * }*/ SetRecs(); } catch (Exception _ex) { error(_ex); } ChangeSizeOfTabs(); }
void UpdateNextEpisode() { var epis = App.GetKeys <CloudStreamCore.CachedCoreEpisode>(nameof(CloudStreamCore.CachedCoreEpisode)).OrderBy(t => - t.createdAt.Ticks).ToArray(); bool hasTxt = epis.Length > 0; UpdateHasNext(hasTxt); NextEpisode.Children.Clear(); var pSource = App.GetImageSource("nexflixPlayBtt.png"); for (int i = 0; i < Math.Min(epis.Length, 5); i++) { var ep = epis[i]; Grid stack = new Grid() { }; var ff = new FFImageLoading.Forms.CachedImage { Source = ep.poster, HeightRequest = FastPosterHeight, WidthRequest = FastPosterWith, BackgroundColor = Color.Transparent, VerticalOptions = LayoutOptions.Start, InputTransparent = true, Transformations = { // new FFImageLoading.Transformations.RoundedTransformation(10,1,1.5,10,"#303F9F") new FFImageLoading.Transformations.RoundedTransformation(10, 1.78, 1, 0, "#303F9F") }, // InputTransparent = true, }; const double textAddSpace = 20; Frame boxView = new Frame() { BackgroundColor = Settings.ItemBackGroundColor, // Color.FromRgb(_color, _color, _color), // InputTransparent = true, CornerRadius = 5, HeightRequest = FastPosterHeight + textAddSpace, TranslationY = 0, WidthRequest = FastPosterWith, HasShadow = true, }; const double playSize = 30; var playBtt = new FFImageLoading.Forms.CachedImage { Source = pSource, HeightRequest = playSize, WidthRequest = playSize, TranslationY = -textAddSpace / 2, BackgroundColor = Color.Transparent, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, InputTransparent = true, }; ProgressBar progress = new ProgressBar() { HorizontalOptions = LayoutOptions.Fill, ProgressColor = Color.FromHex("#829eff"), VerticalOptions = LayoutOptions.End, BackgroundColor = Color.Transparent, Progress = ep.progress, WidthRequest = FastPosterWith, TranslationY = -(4 + textAddSpace / 2), }; /* * var brView = new BorderView() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, CornerRadius = 5 }; * * brView.SetValue(XamEffects.TouchEffect.ColorProperty, Color.White); * Commands.SetTap(brView, new Command((o) => { * //PushPageFromUrlAndName(z.id, z.name); * }));*/ stack.Children.Add(boxView); stack.Children.Add(ff); stack.Children.Add(playBtt); stack.Children.Add(progress); bool isMovie = ep.season <= 0 || ep.episode <= 0; stack.Children.Add(new Label() { Text = (isMovie ? "" : $"S{ep.season}:E{ep.episode} ") + $"{ep.episodeName}", VerticalOptions = LayoutOptions.Start, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.Center, Padding = 1, TextColor = Color.White, MaxLines = 1, ClassId = "OUTLINE", TranslationY = FastPosterHeight, WidthRequest = FastPosterWith }); stack.Effects.Add(Effect.Resolve("CloudStreamForms.LongPressedEffect")); LongPressedEffect.SetCommand(stack, new Command(async() => { var res = new MovieResult(ep.state); await Navigation.PushModalAsync(res, false); await res.LoadLinksForEpisode(new EpisodeResult() { Episode = ep.episode, Season = ep.season, Id = ep.episode - 1, Description = ep.description, IMDBEpisodeId = ep.imdbId, OgTitle = ep.episodeName }); })); NextEpisode.Children.Add(stack, i, 0); } }
/// <summary> /// Invoke the command if there is one /// </summary> private void HandleLongClick() { var command = LongPressedEffect.GetCommand(Element); command?.Execute(LongPressedEffect.GetCommandParameter(Element)); }
public GenEventSelectableCell() { cellHolder = new StackLayout { Orientation = StackOrientation.Horizontal, Padding = 0, Margin = 0, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, }; checkBox = new BoxView { IsVisible = false, WidthRequest = 12, HeightRequest = 12, Color = Color.DarkRed }; dataLayout = new Grid { ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(5 - (GlobalVars.fontSizeAdjustment * .5), GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } }, RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } }, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(6, 0, 6, 0) }; //var MinWidthSize = GenListSize.Width / 3; //StackLayout wholeLayout = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Padding = 2, Spacing = 0 }; //StackLayout firstLine = new StackLayout { Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 0), Spacing = 0 }; //StackLayout moneyAndAvailableLayout = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.EndAndExpand, Padding = 0, Spacing = 6, IsClippedToBounds = false, MinimumWidthRequest = MinWidthSize }; eventNameLabel = new Label { Text = "Event Name Goes Here", LineBreakMode = LineBreakMode.TailTruncation, FontSize = GlobalVars.sizeLarge + GlobalVars.fontSizeAdjustment, FontAttributes = FontAttributes.Bold, VerticalTextAlignment = TextAlignment.Center //HorizontalTextAlignment = TextAlignment.Start }; //eventNameLabel.SetBinding(Label.TextProperty, "Title"); dataLayout.Children.Add(eventNameLabel, 0, 0); priceLabel = new Label { Text = "$-1", FontSize = GlobalVars.sizeLarge + GlobalVars.fontSizeAdjustment, LineBreakMode = LineBreakMode.NoWrap, TextColor = GlobalVars.colorMoney, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center }; //priceLabel.SetBinding(Label.TextProperty, "FormattedCost"); dataLayout.Children.Add(priceLabel, 1, 0); staticTicketNumbersPreface = new Label { Text = "Avail:", FontSize = GlobalVars.sizeMedium + GlobalVars.fontSizeAdjustment, LineBreakMode = LineBreakMode.NoWrap, VerticalTextAlignment = TextAlignment.Center //VerticalOptions = LayoutOptions.EndAndExpand }; dataLayout.Children.Add(staticTicketNumbersPreface, 2, 0); ticketNumbersLabel = new Label { Text = "-999", FontSize = GlobalVars.sizeLarge + GlobalVars.fontSizeAdjustment, LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center }; //ticketNumbersLabel.SetBinding(Label.TextProperty, "AvailableTickets"); //ticketNumbersLabel.SetBinding(Label.TextColorProperty, new Binding("AvailableTickets", converter: new AvailableAmountConverter())); dataLayout.Children.Add(ticketNumbersLabel, 3, 0); //wholeLayout.SetBinding(Layout.BackgroundColorProperty, new Binding("AvailableTickets", converter: new AvailableAmountBackgroundConverter())); //moneyAndAvailableLayout.Children.Add(priceLabel); //moneyAndAvailableLayout.Children.Add(staticTicketNumbersPreface); //moneyAndAvailableLayout.Children.Add(ticketNumbersLabel); //firstLine.Children.Add(eventNameLabel); //firstLine.Children.Add(moneyAndAvailableLayout); //StackLayout secondLine = new StackLayout { Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 0), Spacing = 0 }; descriptionLabel = new Label { Text = "Event Game, Event Game Edition, Etc Information", FontSize = GlobalVars.sizeSmall + GlobalVars.fontSizeAdjustment, LineBreakMode = LineBreakMode.TailTruncation, VerticalTextAlignment = TextAlignment.Center }; //descriptionLabel.SetBinding(Label.TextProperty, "Description"); dataLayout.Children.Add(descriptionLabel, 0, 1); //secondLine.Children.Add(descriptionLabel); timeLabel = new Label { Text = "Wed@10:00(2hrs)", FontSize = GlobalVars.sizeSmall + GlobalVars.fontSizeAdjustment, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center //MinimumWidthRequest = MinWidthSize }; //timeLabel.SetBinding(Label.TextProperty, "FormattedDate"); dataLayout.Children.Add(timeLabel, 1, 1); Grid.SetColumnSpan(timeLabel, 3); //secondLine.Children.Add(timeLabel); //wholeLayout.Children.Add(firstLine); //wholeLayout.Children.Add(secondLine); //wholeLayout.SetBinding(Layout.BackgroundColorProperty, new Binding("BackgroundColor")); //SetupCell(true); cellHolder.Children.Add(checkBox); cellHolder.Children.Add(dataLayout); var longPressedEffect = Effect.Resolve("ConventionMobile.LongPressedEffect"); LongPressedEffect.SetCommand(cellHolder, new Command((object args) => { if (BindingContext != null) { var currentEvent = (GenEvent)BindingContext; var tapType = args as LongPressedEffect.EffectType?; if (tapType != null && (LongPressedEffect.EffectType)tapType == LongPressedEffect.EffectType.LongPress) { currentEvent.IsLongPressSelected = !currentEvent.IsLongPressSelected; } else { currentEvent.IsTapped = true; } //currentEvent.IsSelected &= currentEvent.IsLongPressSelected; } })); cellHolder.Effects.Add(longPressedEffect); View = cellHolder; }
private void ShowBasketList() { #region 네트워크 상태 확인 var current_network = Connectivity.NetworkAccess; // 현재 네트워크 상태 if (current_network != NetworkAccess.Internet) // 네트워크 연결 불가 { basketList = null; } #endregion #region 네트워크 연결 가능 else { basketList = SH_DB.PostSearchBasketListToID(basketID); // 사용자 아이디 } #endregion BasketGridList.Clear(); Basketlist_Grid.Children.Clear(); Basketlist_Grid.RowDefinitions.Clear(); #region 네트워크 연결 불가 if (basketList == null) { CustomLabel alert = new CustomLabel { Text = "네트워크에 연결할 수 없습니다. 다시 시도해 주세요.", Size = 18, HorizontalOptions = LayoutOptions.Center, }; Basketlist_Grid.Children.Add(alert); return; } #endregion int row = 0; for (int i = 0; i < basketList.Count; i++) { Basketlist_Grid.RowDefinitions.Add(new RowDefinition { Height = 100 }); Basketlist_Grid.RowDefinitions.Add(new RowDefinition { Height = 3 }); Grid inGrid = new Grid { ColumnDefinitions = { new ColumnDefinition { Width = 100 }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = 30 } }, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.FillAndExpand, Margin = new Thickness(0, 5, 0, 5), RowSpacing = 0, ColumnSpacing = 0, }; BasketGridList.Add(inGrid); // 장바구니에 추가되는 리스트를 관리하기 위한 그리드 리스트(x버튼으로 삭제 관리를 위함) #region 장바구니 상품 이미지 CachedImage product_image = new CachedImage { LoadingPlaceholder = Global.LoadingImagePath, ErrorPlaceholder = Global.NotFoundImagePath, Source = basketList[i].SH_BASKET_IMAGE, BackgroundColor = Color.White, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, Aspect = Aspect.AspectFill, }; #endregion #region 상품 설명 Labellist 그리드 Grid product_label_grid = new Grid { Margin = new Thickness(10, 0, 0, 0), VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowSpacing = 0, ColumnSpacing = 0, RowDefinitions = { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = 10 }, new RowDefinition { Height = GridLength.Auto } }, }; #region 상품 제목 Label CustomLabel pro_label = new CustomLabel { Text = basketList[i].SH_BASKET_NAME, Size = 18, TextColor = Color.Black, }; #endregion #region 상품 종류 Label (사이즈, 색상, 추가옵션) CustomLabel type_label = new CustomLabel { Text = "색상 : " + basketList[i].SH_BASKET_COLOR + ", 사이즈 : " + basketList[i].SH_BASKET_SIZE + ", " + basketList[i].SH_BASKET_COUNT + "개", Size = 14, TextColor = Color.DarkGray, }; #endregion #region 가격 내용 Label 및 장바구니 담은 날짜 CustomLabel price_label = new CustomLabel { Text = basketList[i].SH_BASKET_PRICE.ToString("N0") + "원 / " + basketList[i].SH_BASKET_DATE, Size = 14, TextColor = Color.Gray, }; #endregion //상품 설명 라벨 그리드에 추가 product_label_grid.Children.Add(pro_label, 0, 0); product_label_grid.Children.Add(type_label, 0, 1); product_label_grid.Children.Add(price_label, 0, 3); #endregion #region 상품권 그리드 자식 추가 inGrid.Children.Add(product_image, 0, 0); inGrid.Children.Add(product_label_grid, 1, 0); #endregion // 카테고리 길게 클릭시 해당 상품 페이지로 넘어갈 수 있는 이벤트 LongPressedEffect.SetCommand(inGrid, new Command(execute: async() => { if (await Application.Current.MainPage.DisplayAlert("안내", "해당 페이지로 이동하시겠습니까?", "확인", "취소")) { int tempIndex = 0; for (int j = 0; j < basketList.Count; j++) { if (basketList[j].SH_BASKET_NAME == pro_label.Text) // 리스트에 저장된 이름과 라벨에 저장된 이름을 비교해서 페이지로 이동시킴 { tempIndex = basketList[j].SH_HOME_INDEX; } } await Navigation.PushAsync(new ShopMainPage(tempIndex)); } })); #region 장바구니 삭제 버튼 Grid deleteGrid = new Grid { RowDefinitions = { new RowDefinition { Height = new GridLength(2, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(8, GridUnitType.Star) }, } }; Image deleteImage = new Image { Source = "x.png", HeightRequest = 40, WidthRequest = 40, }; deleteGrid.Children.Add(deleteImage, 0, 0); inGrid.Children.Add(deleteGrid, 2, 0); // X버튼 누를시에 해당 리스트 삭제 이벤트 deleteImage.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(async() => { bool check = await App.Current.MainPage.DisplayAlert("삭제", "장바구니 항목을 삭제하시겠습니까?", "확인", "취소"); if (check == false) { return; } // 그리드 리스트에서 일치하는 그리드 탐색 int index = SearchIndexInGrid(inGrid); if (SH_DB.PostDeleteBasketListToBasket(basketList[index].SH_BASKET_INDEX.ToString()) == false) { await App.Current.MainPage.DisplayAlert("에러", "삭제하는 도중 문제가 발생했습니다. 다시 시도해주십시오.", "확인"); return; } await App.Current.MainPage.DisplayAlert("알림", "정상적으로 삭제되었습니다.", "확인"); System.Diagnostics.Debug.WriteLine("갱신@@"); ShowBasketList(); PriceUpdate(); }) }); #endregion //장바구니 리스트 그리드에 추가 Basketlist_Grid.Children.Add(inGrid, 0, row); row++; // 구분선 BoxView gridline = new BoxView { BackgroundColor = Color.FromHex("#f4f2f2"), VerticalOptions = LayoutOptions.End, HorizontalOptions = LayoutOptions.FillAndExpand }; Basketlist_Grid.Children.Add(gridline, 0, row); row++; } PriceUpdate(); }