public void DeleteTorrents()
{
DataGridViewSelectedRowCollection dr = dv.SelectedRows;
DataGridViewSelectedCellCollection dc = dv.SelectedCells;
if (dr.Count > 0)
{
int total = dr.Count;
double progress = 0;
double count = 0;
lock (obj)
{
foreach (DataGridViewRow r in dr)
{
if (r.Index >= 0 && r.Index <= dr.Count)
{
try
{
dv.Rows.Remove(r);
}
catch (Exception rowremoveerror)
{
string message = rowremoveerror.Message;
}
}
progress = (++count / total) * 100;
if (progress <= 100 && progress >= 0)
this.ReportProgress((int)progress);
}
}
Save();
}
else if (dc.Count > 0)
{
foreach (DataGridViewCell c in dc)
{
if (!(c.ReadOnly))
{
c.Value = "";
}
}
Save();
}
}