using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Helper; namespace WindowsApplication_OTSI_Encriptar { public partial class frmEncriptador : Form { public frmEncriptador() { InitializeComponent(); } private void encriptarToolStripMenuItem_Click(object sender, EventArgs e) { lblOriginal.Text = "Texto Original"; lblEncriptado.Text = "Texto Encriptado"; btnAceptar.Text = "Encriptar"; txtEncriptado.Text = ""; txtOriginal.Text = ""; } private void desencriptarToolStripMenuItem_Click(object sender, EventArgs e) { lblOriginal.Text = "Texto Encriptado"; lblEncriptado.Text = "Texto Original"; btnAceptar.Text = "Desencriptar"; txtEncriptado.Text = ""; txtOriginal.Text = ""; } private void btnAceptar_Click(object sender, EventArgs e) { try { Helper.CryptographyManager cmManager = new Helper.CryptographyManager(); if (lblOriginal.Text == "Texto Original") { txtEncriptado.Text = cmManager.Encriptar(txtOriginal.Text); } else { txtEncriptado.Text = cmManager.Desencriptar(txtOriginal.Text); } } catch (Exception ex) { MessageBox.Show("Error en el proceso: " + ex.Message,"Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void btnLimpiar_Click(object sender, EventArgs e) { txtEncriptado.Text = ""; txtOriginal.Text = ""; } } }