void ChoiceTapped(object sender, EventArgs e) { if (sender != null) { SelectColorChoice choice = sender as SelectColorChoice; if (choice != null) { if (choice.Box != null) { boxTapped.Type = choice.Box.Type; TupleKey index = new TupleKey(Column, 8 - Row); try { var RefBox = ParentPage.BoxsToSolve[index]; ParentPage.BoxsToSolve[index] = boxTapped.Type; } catch (KeyNotFoundException) { ParentPage.BoxsToSolve.Add(index, boxTapped.Type); } ParentPage.IsChange = true; ParentPage.IsHasSolution = false; Navigation.PopModalAsync(); } } else { return; } } else { return; } }
protected override void OnAppearing() { base.OnAppearing(); if (IsAppearingFirstTime) { IsAppearingFirstTime = false; //TapGestureRecognizer popuplayoutTapGestureRecognizer = new TapGestureRecognizer(); //popuplayoutTapGestureRecognizer.Tapped += (s, e) => //{ // Navigation.PopModalAsync(); //}; //popuplayout.GestureRecognizers.Add(popuplayoutTapGestureRecognizer); foreach (BoxType boxtype in (BoxType[])Enum.GetValues(typeof(BoxType))) { SelectColorChoice Choice = new SelectColorChoice(boxtype); TapGestureRecognizer boxTapGestureRecognizer = new TapGestureRecognizer(); boxTapGestureRecognizer.Tapped += (s, e) => { ChoiceTapped(s, e); }; Choice.GestureRecognizers.Add(boxTapGestureRecognizer); Choice.VerticalOptions = LayoutOptions.End; popuplayout.Children.Add(Choice); } } }