Previous:

private void emptyLocationToolStripMenuItem1_Click(object sender, EventArgs e)
{
Directory.Delete(txtFolderLocn2.Text, true);
lblFolder2Size.Text = "calculating...";
while (!bWorkerFolder2Size.IsBusy)
bWorkerFolder2Size.RunWorkerAsync(oFolderSync.diDirInfoLocn2);

}

After:
private void emptyLocationToolStripMenuItem1_Click(object sender, EventArgs e)
{
Directory.Delete(txtFolderLocn2.Text, true);
lblFolder2Size.Text = "calculating...";
while (!bWorkerFolder2Size.IsBusy)
bWorkerFolder2Size.RunWorkerAsync(oFolderSync.diDirInfoLocn2);

Directory.CreateDirectory(txtFolderLocn2.Text);
}

So what has changed. As you can see, a new line now appears Directory.CreateDirectory(txtFolderLocn2.Text); But why do we need this.

So what used to happen was when we use the Context Menu "Empty Location", it used to delete the folder specified by txtFolderLocn2.Text and its subfolders. Since it was already validated, I thought its makes sense that the folder shoudl exist, hence I create in the same function

Last edited Jun 3, 2009 at 7:51 PM by gouravdas, version 1

Comments

No comments yet.