Exemplo n.º 1
0
 /// <summary>
 /// Xoa file duoc chon
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (listView.SelectedItems.Count != 0)
     {
         string     originPath = listView.Items[listView.FocusedItem.Index].SubItems[2].Text;
         string     path       = Application.StartupPath + "\\Quarantine\\" + Path.GetFileName(originPath) + ".VScan";
         frmXoaFile deleteFile = new frmXoaFile(path);
         deleteFile.ShowDialog();
         if (deleteFile.DeleteFileComplete)
         {
             for (int i = listView.SelectedItems.Count; i > 0; i--)
             {
                 ListViewItem item = listView.SelectedItems[i - 1];
                 App.DB.CachLy.Rows[item.Index].Delete();
                 listView.Items[item.Index].Remove();
             }
             App.DB.AcceptChanges();
             App.DB.WriteXml(string.Format("{0}/.dat", Application.StartupPath));
         }
     }
     else
     {
         MyMessageBox.ShowMessage("Bạn chưa chọn tệp cần xóa !", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Xoa file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            frmXoaFile deleteFile = new frmXoaFile(_path);

            deleteFile.ShowDialog();
            if (deleteFile.DeleteFileComplete)
            {
                Close();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Xoa tat ca
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDeleteAll_Click(object sender, EventArgs e)
        {
            frmXoaFile deleteFiles = new frmXoaFile(_dsPath, _dsVirusName, "");

            deleteFiles.ShowDialog();
            if (deleteFiles.DeleteAllFilesComplete)
            {
                Close();
            }
            else
            {
                listView.Items.Clear();
                for (int i = 0; i < deleteFiles.DsError.Count; i++)
                {
                    listView.Items.Add(new ListViewItem(new string[] { deleteFiles.DsVirusError[i], deleteFiles.DsFileNameError[i], deleteFiles.DsError[i] }));
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Xoa file duoc chon
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (listView.SelectedItems.Count != 0)
     {
         frmXoaFile deleteFile = new frmXoaFile(_dsPath[listView.FocusedItem.Index]);
         deleteFile.ShowDialog();
         if (deleteFile.DeleteFileComplete)
         {
             _dsPath.RemoveAt(listView.FocusedItem.Index);
             for (int i = listView.SelectedItems.Count; i > 0; i--)
             {
                 ListViewItem item = listView.SelectedItems[i - 1];
                 listView.Items[item.Index].Remove();
             }
         }
     }
     else
     {
         MyMessageBox.ShowMessage("Bạn chưa chọn tệp cần xóa !", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }