private void OnSearchCaregoryClick(View v) { if (isFreeMakeover) { ConfirmDialog.Show(this.ParentPage, "Services other than Free Makeover will not be free", new List <string> { "Go Back", "Continue" }, (bIndex) => { if (bIndex == 1) { isFreeMakeover = false; filtersLayout.IsVisible = true; } }); return; } filtersLayout.IsVisible = !filtersLayout.IsVisible; }
public static void Show(ContentPage page, string text, IEnumerable <string> buttons, Action <int> callback) { RelativeLayout rl = null; try { var cd = new ConfirmDialog(text, buttons); rl = new RelativeLayout(); rl.BackgroundColor = Props.BlackoutColor; rl.Children.Add(cd.view, Constraint.RelativeToParent(p => ((p.Width - Utils.GetControlSize(cd.view).Width) / 2)), Constraint.RelativeToParent(p => ((p.Height - Utils.GetControlSize(cd.view).Height) / 2))); if (page.Content is RelativeLayout) { ((RelativeLayout)page.Content).Children.Add(rl, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent(p => p.Width), Constraint.RelativeToParent(p => p.Height)); } else if (page.Content is AbsoluteLayout) { ((AbsoluteLayout)page.Content).Children.Add(rl, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.SizeProportional); } else { //?? } cd.OnSelect += (s, a) => { ((Layout <View>)page.Content).Children.Remove(rl); callback?.Invoke(a); }; } catch { try { ((Layout <View>)page.Content).Children.Remove(rl); } catch { } } }