In DocumentViewerControl
in WPF I want to delete the file after closing the control in closed event handler. I tried to delete it but VS told me that it is used by another process. How can I delete it?
TextBlock tb = (TextBlock)e.TabItem.Header;
int index = Convert.ToInt32(tb.Text.Split(' ')[1]) - 2;
string path = GlobalStaticVariables.store_item_content[index].Split('-')[1];
Process temp = Process.GetCurrentProcess();
temp.Dispose();
System.IO.File.Delete(path);