// eseguito una volta conclusa la creazione di un tavolo private void Popup_Terminated(object sender, EventArgs e) { CreateTablePopup tabPop = (CreateTablePopup)sender; Table tab = tabPop.table; int x = Convert.ToInt32(tab.Coordinates.X); int y = Convert.ToInt32(tab.Coordinates.Y); Label label = addTableLabel(tab, x, y); SelectedPlace[x, y] = tab; selectedImage.Source = "table"; }
// se ho cliccato un tavolo private async void B_Clicked(object sender, EventArgs e) { Image im = (Image)sender; Tuple <int, int> t = (Tuple <int, int>)im.BindingContext; if (SelectedPlace[t.Item1, t.Item2] == null) { selectedImage = im; Table tab = new Table { Coordinates = new Point(t.Item1, t.Item2) }; var popup = new CreateTablePopup(tab); popup.Terminated += Popup_Terminated; await Navigation.PushPopupAsync(popup); } else // se clicco un tavolo gia' creato lo rimuovo { im.Source = "tableWhite"; Grid.Children.Remove(showedLabel[t]); SelectedPlace[t.Item1, t.Item2] = null; } }