private async void autoSuggestCrew_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args) { if (args.ChosenSuggestion != null) { //NoBoats.Visibility = Visibility.Collapsed; //Program1.hello(NameBox.Text); LoadFullSQL db1 = new LoadFullSQL(); //Boats personboat = db1.GetBoat(person); // Globals.personboat = db1.GetBoat(autoSuggestCrew.Text); //Radio1.Visibility = Visibility.Collapsed; var i = 0; //cboxitem.Content = "Created with C#"; //dropdown.Items.Add(cboxitem); //dropdown.ItemsSource = "hi"; Boats boat1 = new Boats(args.ChosenSuggestion.ToString(), Globals.personboat[g].boatName, Globals.personboat[g].boatNumber); try { LoadFullSQL.SQLaddnewracer(boat1, 1); ContentDialog outputDialog = new ContentDialog() { Title = "You have been added to the race!", Content = "You are sailing a(n) " + Globals.personboat[g].boatName, CloseButtonText = "Ok" }; await outputDialog.ShowAsync(); autoSuggestCrew.Visibility = Visibility.Collapsed; crew.Visibility = Visibility.Collapsed; crew.IsChecked = false; autoSuggest.Text = ""; } catch { ContentDialog nameNotFoundDialog = new ContentDialog() { Title = "Your crew name is not contained in my records", Content = "Add yourself and try again, could already be added?", CloseButtonText = "Ok" }; await nameNotFoundDialog.ShowAsync(); } } else { } }
private async void enterButton_Click(object sender, RoutedEventArgs e) { g = dropdown.SelectedIndex; /* * if (LoadFullSQL.SQLcheckcrew(Globals.personboat[dropdown.SelectedIndex].boatName) == 1) * crew.Visibility = Visibility.Visible; */ try { if (dropdown.SelectedValue != null && dropdown.SelectedValue != "") { try { /* * if (crew.IsChecked.Equals(true)) * { */ LoadFullSQL.SQLaddnewracer(Globals.personboat[dropdown.SelectedIndex], 0); if (LoadFullSQL.SQLcheckcrew(Globals.personboat[dropdown.SelectedIndex].boatName) == 1) { crew.Visibility = Visibility.Visible; } //} ContentDialog outputDialog = new ContentDialog() { Title = "You have been added to the race!", Content = "You are sailing a(n) " + Globals.personboat[dropdown.SelectedIndex].boatName, CloseButtonText = "Ok" }; await outputDialog.ShowAsync(); dropdown.Items.Clear(); } catch { //string hi = nameNotFoundDialog.ShowAsync(); nameNotFoundDialog nameNotFoundDialog = new nameNotFoundDialog(); await nameNotFoundDialog.ShowAsync(); //if ( == nameNotFoundDialog.PrimaryButtonClick) //LoadFullSQL.SQLremove(true, personboat[0].name); dropdown.Items.Clear(); } } else { ContentDialog nameNotFoundDialog = new ContentDialog() { Title = "You must input somethin", Content = "Write something and try again", CloseButtonText = "Ok" }; await nameNotFoundDialog.ShowAsync(); } } catch (ArgumentOutOfRangeException) { boatnameauto.Visibility = Visibility.Visible; boatnumberbox.Visibility = Visibility.Visible; //a = Visibility.Visible; } }