Esempio n. 1
0
 private void btnThucHien_Click(object sender, EventArgs e)
 {
     try {
         Timer1.Start();
         ProgressBar1.Visible = true;
         TKBUS.Restore(txtTen.Text);
     } catch (Exception ex) {
         Timer1.Stop();
         ProgressBar1.Visible = false;
         btnThucHien.Visible  = true;
         btnHoanThanh.Visible = false;
         Interaction.MsgBox(ex.Message, MsgBoxStyle.Critical, "Lỗi Restore");
         this.labelthanhcong.Text = "(*) Phục hồi thất bại!";
         this.labelform.Text      = "";
     }
 }
        // tạo button thực hiện đè lên button hoàn thành để khi ta chọn xong file để backup thì button thực hiện sẽ xuất hiện
        // khi progressbar chạy xong thì button sẽ chuyển thành hoàn thành và khi click vào nó thì sẽ thoát

        public void btnThucHien_Click(object sender, EventArgs e)
        {
            try
            {
                timer1.Start();
                ProgressBar1.Visible = true;
                TKBUS.Restore(Convert.ToString(txtTen.Text));
            }
            catch (Exception ex)
            {
                timer1.Stop();
                ProgressBar1.Visible = false;
                btnThucHien.Visible  = true;
                btnHoanThanh.Visible = false;
                MessageBox.Show(ex.Message, "Lỗi Restore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.labelthanhcong.Text = "(*) Phục hồi thất bại!";
                this.labelform.Text      = "";
            }
        }