Beispiel #1
0
        private void btnAccept_Click(object sender, EventArgs e)
        {
            if (this.ValidateForm())
            {
                using (posb.Config con = new posb.Config())
                {
                    var path = Path.GetDirectoryName(this.txtPath.Text);

                    if (Directory.Exists(path))
                    {
                        if (!con.BackUp(this.txtPath.Text))
                        {
                            this.Alert(con.ErrorMessage);
                        }
                        else
                        {
                            if (this.Confirm("El respaldo se creo correctamente, ¿Deseas abrir la carpeta?"))
                            {
                                Process.Start(path);
                            }

                            this.Close();
                        }
                    }
                    else
                    {
                        this.Alert("La carpeta no existe");
                        this.txtPath.Clear();
                        this.txtPath.Focus();
                    }
                }
            }
        }