示例#1
0
        // Get Carrier Route
        private void button2_Click(object sender, EventArgs e)
        {
            List <string> userInput = new List <string>();

            userInput.Clear();

            // Get User Input
            string Street  = textBox2.Text;
            string City    = textBox1.Text;
            string State   = textBox3.Text;
            string ZipCode = textBox4.Text;

            // Make list of User Input
            userInput.Add(Street);
            userInput.Add(City);
            userInput.Add(State);
            userInput.Add(ZipCode);

            // Create object for AddressValidation() and CarrierRoute()
            API_abstractHandler addValid  = new AddressValidation();
            API_abstractHandler carrRoute = new CarrierRoute();

            addValid.SetNextObject(carrRoute);                                               //create chain link
            carrRoute = new add_API_Name(carrRoute);                                         //add decorator

            string output = ClientRequest.ClientInput(carrRoute, "carrierRoute", userInput); //get results of address validation + decorator

            textBox6.Text = string.Empty;                                                    //clear textbox
            textBox6.AppendText(output);                                                     //output to textbox
        }