Exemplo n.º 1
0
        //Precondition: User clicks "letter" menu item
        //Postcondition: A letter form is created and is sent the
        //               addresses from the upv object
        private void letterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Prog2.LetterForm letterForm = new Prog2.LetterForm(upv.addresses);
            DialogResult     result;          //Result from dialog - OK / Cancel ?

            result = letterForm.ShowDialog(); // Show dialog box form - modal, waits for OK/Cancel
                                              // Even after user dismisses, the form still exists
                                              // and can be interacted with using me
        }
Exemplo n.º 2
0
        // Precondition: letterToolStripMenuItem has been clicked
        // Postcondition: LetterForm has appeared
        private void letterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult letterResult;

            Prog2.LetterForm letterObject = new Prog2.LetterForm();
            letterResult = letterObject.ShowDialog();
            decimal cost;

            if (letterResult == DialogResult.OK)
            {
                cost = decimal.Parse(letterObject.Cost);
                upv.AddLetter(letterObject.OriginCombo, letterObject.DestCombo, cost);
            }
        }