コード例 #1
0
        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;
            }
        }