Exemplo n.º 1
0
        } // end of InitializeGUI()

        /// <summary>
        /// Make a Cat!
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMakeACat_Click(object sender, EventArgs e)
        {
            // Validate the Input
            if (!ValidateInput())
            {
                MessageBox.Show("Please Enter Cat Details", "Error");
                return;
            }

            // Assemble the Cat Attributes from the Form
            string     name   = txtName.Text;
            int        age    = (int)numAge.Value;
            CatBreed   breed  = (CatBreed)Enum.Parse(typeof(CatBreed), cmbBreed.Text);
            GenderType gender = (GenderType)Enum.Parse(typeof(GenderType), cmbGender.Text);

            // Make a Proxy to the Service
            MakeACatServiceClient proxy = new MakeACatServiceClient();

            // Call the Service
            Cat cat = proxy.MakeACat(name, breed, gender, age);

            // Add to the Master Cat List
            mycats.Add(cat);

            // Update the GUI
            UpdateGUI();
        } // end of method
Exemplo n.º 2
0
        } // end of UpdateGUI()

        /// <summary>
        /// Get Five Cats
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMakeCats_Click(object sender, EventArgs e)
        {
            // Make a Proxy to the Service
            MakeACatServiceClient proxy = new MakeACatServiceClient();

            // Call the Service
            CatList cats = proxy.MakeCats();

            // Add to the Master Cat List
            foreach (Cat cat in cats)
            {
                mycats.Add(cat);
            }

            // Update the GUI
            UpdateGUI();
        } // end of method