Example #1
0
        private void decryptButton_Click(object sender, EventArgs e)
        {
            if (encryptLbl.Text != "Encrypted Text")                                           //if text has been encrypted yet
            {
                String str = encryptLbl.Text;                                                  //store string
                encryptLbl.Text = "Encrypted Text";                                            //reset label

                EncryptionService.ServiceClient proxy = new EncryptionService.ServiceClient(); //open the client
                String decryptedStr = proxy.Decrypt(str);                                      //decrypt the string

                decryptTextBox.Text = decryptedStr;                                            //display the decrypted string

                proxy.Close();                                                                 //close the client
            }
        }
Example #2
0
        private void encryptButton_Click(object sender, EventArgs e)
        {
            if (decryptTextBox.Text != "")                                                     //if user has inputted a string yet
            {
                String str = decryptTextBox.Text;                                              //store string
                decryptTextBox.Text = "";                                                      //clear text box

                EncryptionService.ServiceClient proxy = new EncryptionService.ServiceClient(); //open the client
                String encryptedStr = proxy.Encrypt(str);                                      //encrypt the string

                encryptLbl.Text = encryptedStr;                                                //display the encrypted string

                proxy.Close();                                                                 //close the client
            }
        }