コード例 #1
0
        public void nameNotFoundDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            LoadFullSQL.SQLremove(true, Globals.personboat[0].name);
            MainPage a = new MainPage();

            a.clearname();
        }
コード例 #2
0
 private void enterbutton1_Click_1(object sender, RoutedEventArgs e)
 {
     LoadFullSQL.SQLAddboat(Globals.personboat[0].name, boatnameauto.Text, int.Parse(boatnumberbox.Text));
     boatnameauto.Visibility  = Visibility.Collapsed;
     boatnumberbox.Visibility = Visibility.Collapsed;
     enterbutton1.Visibility  = Visibility.Collapsed;
     autoSuggest.Focus(FocusState.Keyboard);
     autoSuggest.Text = "";
     dropdown.Items.Clear();
 }
コード例 #3
0
        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
            {
            }
        }
コード例 #4
0
        private async void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            if (args.ChosenSuggestion != null)
            {
                dropdown.Items.Clear();
                //NoBoats.Visibility = Visibility.Collapsed;

                //Program1.hello(NameBox.Text);
                LoadFullSQL db1 = new LoadFullSQL();
                //Boats personboat = db1.GetBoat(person);
                Globals.personboat = db1.GetBoat(autoSuggest.Text);
                //Radio1.Visibility = Visibility.Collapsed;
                var       i           = 0;
                Thickness myThickness = new Thickness();
                myThickness.Bottom = 474;
                myThickness.Left   = 171;
                myThickness.Right  = 0;
                myThickness.Top    = 00;
                //cboxitem.Content = "Created with C#";
                //dropdown.Items.Add(cboxitem);
                //dropdown.ItemsSource = "hi";
                foreach (Boats item in Globals.personboat)
                {
                    ComboBoxItem cboxitem = new ComboBoxItem();
                    cboxitem.Content = item.boatName + " " + item.boatNumber;
                    dropdown.Items.Add(cboxitem);


                    i++;
                }
                ComboBoxItem cboxitem1 = new ComboBoxItem();
                cboxitem1.Content = "new boat";
                dropdown.Items.Add(cboxitem1);

                if (i == 0)
                {
                    ContentDialog nameNotFoundDialog = new ContentDialog()
                    {
                        Title           = "Your name is not contained in my records",
                        Content         = "Add yourself and try again",
                        CloseButtonText = "Ok"
                    };
                    await nameNotFoundDialog.ShowAsync();
                }
            }
            else
            {
            }
        }
コード例 #5
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;
            }
        }