private async void DownloadItem(object sender, RoutedEventArgs e, string path) { Console.WriteLine("Copying started"); await Task.Delay(5); Console.WriteLine("Copying started after timer"); Console.WriteLine(path); var destn = Properties.Settings.Default["Path"].ToString(); List <string> sources = path.Split('\\').ToList <string>(); string sourcePath = ""; foreach (string source in sources) { if (source.Length > 0) { sourcePath += "\\\"" + source + "\""; } } sourcePath = "\\" + sourcePath; Console.WriteLine(sourcePath); if (Directory.Exists(destn)) { System.Threading.Thread copyFile = new System.Threading.Thread(() => Scan.CopyFiles(sourcePath, destn)); copyFile.Start(); copyFile.Join(); System.Windows.Forms.MessageBox.Show("Successfully downloaded files"); } else { System.Windows.Forms.MessageBox.Show("Invalid path or path not set go to settings"); } }