private void btnUpload_Click(object sender, EventArgs e) { if (txtPathUpload.Text.Trim().Equals("")) { MessageBox.Show("BẠN CHƯA CHỌN FILE", "FILE NOT FOUND", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string File_Name = Get_FileName_FromPath(txtPathUpload.Text); DialogResult dr = MessageBox.Show("BẠN CÓ MUỐN UPDATE VỚI TÊN: " + File_Name, "CẢNH BÁO", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.No) { return; } api.GoogleDriveAPI gg_api = new api.GoogleDriveAPI(); Thread thread_lazy = new Thread(new ThreadStart(Open_WaitingFrm)); thread_lazy.Start(); gg_api.Upload_to_Root(File_Name, txtPathUpload.Text, name_token); load_TreeView(); frmWait.Invoke(new MethodInvoker(delegate() { frmWait.Close(); })); MessageBox.Show("UPLOAD THÀNH CÔNG", "", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btnSave_Click(object sender, EventArgs e) { Thread thread_lazy = new Thread(new ThreadStart(Open_WaitingFrm)); thread_lazy.Start(); int result = download_File(); frmWait.Invoke(new MethodInvoker(delegate() { frmWait.Close(); })); if (result == 1) { MessageBox.Show("DOWNLOAD THÀNH CÔNG", "", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { DialogResult dr = MessageBox.Show("DOWNLOAD FAILED", "", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); if (dr == DialogResult.Retry) { btnSave_Click(sender, e); } else { this.Close(); } } }