示例#1
0
        void ListBoxHistorialDoubleClick(object sender, EventArgs e)
        {
            try {
                EscribirDiario ventana = new EscribirDiario();

                ventana = new EscribirDiario();
                ventana.save.Visible           = false;
                ventana.textBoxConfirm.Visible = false;
                ventana.label1.Visible         = false;
                ventana.textBoxNombre.Visible  = false;
                ventana.labelNoimbre.Visible   = false;

                if (ventana.ShowDialog() == DialogResult.OK)
                {
                    String ruta;

                    ruta  = @"Documentos\" + listBoxHistorial.Text;
                    str   = System.IO.File.ReadAllText(ruta);
                    llave = ventana.textBoxPass.Text;

                    str = Encriptar(str, llave, true);
                    textBoxDiario.Text = str;
                }
            } catch (Exception) {
            }
        }
示例#2
0
        void ButtonAbrirClick(object sender, EventArgs e)
        {
            try {
                DialogResult resultado;
                resultado = openFileDialog1.ShowDialog();
                EscribirDiario ventana = new EscribirDiario();


                if (resultado == DialogResult.OK)
                {
                    ventana = new EscribirDiario();
                    ventana.save.Visible           = false;
                    ventana.textBoxConfirm.Visible = false;
                    ventana.label1.Visible         = false;
                    ventana.textBoxNombre.Visible  = false;
                    ventana.labelNoimbre.Visible   = false;

                    if (ventana.ShowDialog() == DialogResult.OK)
                    {
                        String ruta;

                        ruta  = openFileDialog1.FileName;
                        str   = System.IO.File.ReadAllText(ruta);
                        llave = ventana.textBoxPass.Text;

                        str = Encriptar(str, llave, true);
                        textBoxDiario.Text = str;
                    }
                }
            } catch (Exception) {
            }
        }
示例#3
0
        void MostrsrToolStripMenuItemClick(object sender, EventArgs e)
        {
            try {
                if (listBoxHistorial.SelectedItems.Count != 0)
                {
                    EscribirDiario ventana = new EscribirDiario();

                    ventana = new EscribirDiario();
                    ventana.save.Visible           = false;
                    ventana.textBoxConfirm.Visible = false;
                    ventana.label1.Visible         = false;
                    ventana.textBoxNombre.Visible  = false;
                    ventana.labelNoimbre.Visible   = false;

                    if (ventana.ShowDialog() == DialogResult.OK)
                    {
                        String ruta;

                        ruta  = @"Documentos\" + listBoxHistorial.Text;
                        str   = System.IO.File.ReadAllText(ruta);
                        llave = ventana.textBoxPass.Text;

                        str = Encriptar(str, llave, true);
                        textBoxDiario.Text = str;
                    }
                }
                else
                {
                    MessageBox.Show("Debe seleccionar un item", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            } catch (Exception) {
            }
        }
示例#4
0
        void GuardarClick(object sender, EventArgs e)
        {
            StreamWriter sw    = File.AppendText(@"historial.txt");
            String       fecha = labelFecha.Text;

            try {
                EscribirDiario ventana = new EscribirDiario();
                ventana.buttonOK.Visible = false;
                if (ventana.ShowDialog() == DialogResult.OK)
                {
                    String nombreArchivo = ventana.textBoxNombre.Text + " A " + fecha.Substring(0, 2) + " DE " + fecha.Substring(3, 2) + " DEL " + fecha.Substring(6, 4) + ".txt";


                    String ruta = @"Documentos\" + nombreArchivo;

                    str   = textBoxDiario.Text;
                    llave = ventana.textBoxConfirm.Text;
                    str   = Encriptar(str, llave, false);



                    System.IO.File.WriteAllText(ruta, str);

                    textBoxDiario.Text = "";
                    //

                    sw.WriteLine(Path.GetFileName(ruta));
                    listBoxHistorial.Items.Add(Path.GetFileName(ruta));

                    MessageBox.Show("Se guardo correctamente", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            } catch (Exception) {
            }
            sw.Close();
        }