Esempio n. 1
0
        //Precondition: click
        //Postcondition: Show Address Form, Add address to upv AddressList
        public void addressToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddressForm  AF = new AddressForm();                    //create an AddressForm object
            DialogResult result;                                    //holds result of the AddressForm button (OK/Cancel)

            result = AF.ShowDialog();                               //Shows the form as a modal dialog box

            if (result == DialogResult.OK && AF.ValidateChildren()) //if Result is OK, then Add an Address to the UserParcelView AddressList
            {
                //Precondition: ValidateChildren() must return true
                //Postcondition: Add Address to UserParcelView Address list
                upv.AddAddress(AF.NameValue, AF.AddressValue, AF.AddressValue1, AF.CityValue, AF.StateValue, AF.ZipValue);
            }
            else
            if (result == DialogResult.Cancel)    //Dispose of resources if result == cancel
            {
                AF.Dispose();
            }
        }