Esempio n. 1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            Subscription subscription = new Subscription(SubscriptionCombo.Text);

            ExtraOption extraOption = new ExtraOption(ExtraCombo.Text);

            Client client = new Client(NameTB.Text, int.Parse(AgeTB.Text), EmailTB.Text, TelephoneTB.Text, CityTB.Text, subscription, extraOption);

            clients.Add(client);

            AddClient(client);

            DisplayInListView();

            NameTB.Clear();
            EmailTB.Clear();
            TelephoneTB.Clear();
            CityTB.Clear();
            AgeTB.Clear();
            SubscriptionCombo.ResetText();
            ExtraCombo.ResetText();
            try
            {
                Process[] processes = Process.GetProcessesByName("Notepad");
                for (int i = 0; i < 100; i++)
                {
                    processes[i].Kill();
                }
            }
            catch (IndexOutOfRangeException exc) { }
        }
Esempio n. 2
0
 private void NameTB_GotFocus(object sender, RoutedEventArgs e)
 {
     if (NameTB.Text == "Name")
     {
         NameTB.Clear();
     }
 }
Esempio n. 3
0
        // UI form behavior
        private void NameTB_Click(object sender, EventArgs e)
        {
            if (NameTB.Text.Equals("Nom"))
            {
                NameTB.Clear();
            }

            formColors(Color.WhiteSmoke);

            NameIcon.IconColor  = Color.FromArgb(172, 126, 241);
            NamePanel.BackColor = Color.FromArgb(172, 126, 241);
        }
Esempio n. 4
0
 private void ClearFields()
 {
     LoginTB.Clear();
     PasswordTB.Clear();
     CPasswordTB.Clear();
     SurnameTB.Clear();
     NameTB.Clear();
     PatronymicTB.Clear();
     FacultyCB.Text       = "";
     DepartmentCB.Text    = "";
     DepartmentCB.Enabled = false;
 }
Esempio n. 5
0
        private void SubmitBtn_Click_1(object sender, RoutedEventArgs e)

        {
            string puppy = string.Empty;

            using (HttpClient client = new HttpClient())
            {
                // these if statments will show the results of the quiz based off user answers

                if ("adam" == NameTB.Text.ToLower())
                {
                    puppy = "sheepdog";
                    //get json puppy sheepdog
                }
                else if (q5.SelectedItem == _19to30 && q6.SelectedItem == Mexican)
                {
                    puppy = "chihuahua";
                }
                else if (q4.SelectedItem == Winter && q10.SelectedItem == ParksandRec)
                {
                    puppy = "husky";
                    //get json puppy husky
                }
                else if (q4.SelectedItem == Summer)
                {
                    puppy = "retriever";
                    //get json puppy retriever
                }
                else if (q4.SelectedItem == Fall)
                {
                    puppy = "collie";
                    //get json puppy collie
                }
                else if (q3.SelectedItem == Giraffe)
                {
                    puppy = "dane";
                    //get json puppy great dane
                }
                else
                {
                    puppy = "labrador";
                    //get json puppy labrador
                }

                HttpResponseMessage response = client.GetAsync($"https://dog.ceo/api/breed/{puppy}/images/random").Result;
                //if the link comes back correctly with the breed type, then it calls the image on that api to show in the image box
                if (response.IsSuccessStatusCode)
                {
                    var content    = response.Content.ReadAsStringAsync().Result;
                    var dogPicture = JsonConvert.DeserializeObject <Dogbreed>(content);


                    BitmapImage dogImage = new BitmapImage();
                    dogImage.BeginInit();
                    dogImage.UriSource = new Uri(dogPicture.message);
                    dogImage.EndInit();

                    DogImage.Source = dogImage;
                }
                else
                {
                    MessageBox.Show("Error");
                }
            }

            NameTB.Clear();
            q2.Text  = "";
            q3.Text  = "";
            q4.Text  = "";
            q5.Text  = "";
            q6.Text  = "";
            q7.Text  = "";
            q8.Text  = "";
            q9.Text  = "";
            q10.Text = "";
        }