I am writing an application to copy a specific folder from a network resource to a local computer after copying a shortcut is created, everything works. But there is an idea to make the Progress bar display when copying and it was possible to copy several applications at the same time, please help in implementing the idea. My code below

public static void RA1112(string begin_dir1, string end_dir1) { Directory.CreateDirectory("C:\\APPS\\RA1112"); begin_dir1 = "W:\\Program\\DIS\\RS\\RA1112"; end_dir1 = "C:\\APPS\\RA1112"; //Π‘Π΅Ρ€Ρ‘ΠΌ Π½Π°ΡˆΡƒ ΠΈΡΡ…ΠΎΠ΄Π½ΡƒΡŽ ΠΏΠ°ΠΏΠΊΡƒ DirectoryInfo dir_inf = new DirectoryInfo(begin_dir1); //ΠŸΠ΅Ρ€Π΅Π±ΠΈΡ€Π°Π΅ΠΌ всС Π²Π½ΡƒΡ‚Ρ€Π΅Π½Π½ΠΈΠ΅ ΠΏΠ°ΠΏΠΊΠΈ foreach (DirectoryInfo dir in dir_inf.GetDirectories()) { //ΠŸΡ€ΠΎΠ²Π΅Ρ€ΡΠ΅ΠΌ - Ссли Π΄ΠΈΡ€Π΅ΠΊΡ‚ΠΎΡ€ΠΈΠΈ Π½Π΅ сущСствуСт, Ρ‚ΠΎ создаСм; if (Directory.Exists(end_dir1 + "C:\\APPS\\RA1112" + dir.Name) != true) { Directory.CreateDirectory(end_dir1 + "C:\\APPS\\RA1112" + dir.Name); } //РСкурсия (ΠΏΠ΅Ρ€Π΅Π±ΠΈΡ€Π°Π΅ΠΌ Π²Π»ΠΎΠΆΠ΅Π½Π½Ρ‹Π΅ ΠΏΠ°ΠΏΠΊΠΈ ΠΈ Π΄Π΅Π»Π°Π΅ΠΌ для Π½ΠΈΡ… Ρ‚ΠΎ-ΠΆΠ΅ самоС). RA1112(dir.FullName, end_dir1 + "C:\\APPS\\RA1112" + dir.Name); } //ΠŸΠ΅Ρ€Π΅Π±ΠΈΡ€Π°Π΅ΠΌ Ρ„Π°ΠΉΠ»Ρ‹ Π² ΠΏΠ°ΠΏΠΊΠ΅ источникС. foreach (string file in Directory.GetFiles(begin_dir1)) { //ΠžΠΏΡ€Π΅Π΄Π΅Π»ΡΠ΅ΠΌ (отдСляСм) имя Ρ„Π°ΠΉΠ»Π° с Ρ€Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΠ΅ΠΌ - Π±Π΅Π· ΠΏΡƒΡ‚ΠΈ (Π½ΠΎ с слСшСм "\"). string filik = file.Substring(file.LastIndexOf('\\'), file.Length - file.LastIndexOf('\\')); //ΠšΠΎΠΏΠΈΡ€ΡƒΠ΅ΠΌ Ρ„Π°ΠΉΠ» с ΠΏΠ΅Ρ€Π΅Π·Π°ΠΏΠΈΡΡŒΡŽ ΠΈΠ· источника Π² ΠΏΡ€ΠΈΡ‘ΠΌΠ½ΠΈΠΊ. File.Copy(file, end_dir1 + "\\" + filik, true); } var wsh = new WshShell(); var shortcut = wsh.CreateShortcut( Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\RA1112.lnk") as IWshShortcut; if (shortcut == null) return; // shortcut.Arguments = "c:\\app\\settings1.xml"; shortcut.TargetPath = "C:\\APPS\\RA1112\\COLVIR.exe"; // not sure about what this is for shortcut.WindowStyle = 1; shortcut.Description = "my shortcut description"; shortcut.WorkingDirectory = "C:\\APPS"; shortcut.IconLocation = "C:\\APPS\\RA1112\\COLVIR.exe"; shortcut.Save(); } 
  • Specify what exactly you want to do and what exactly is causing you difficulty in this? - Kromster
  • 7
    RA1112 is a terrible name for a method! ) - Kromster
  • 2
    I have a lot of methods and that would not be confused, he called it that way). - Pavel
  • 3
    My advice to you, let's make meaningful names for methods / functions, for enlightenment I advise you to pay attention, for example, to Clean Code - Bald
  • 2
    Usually not to be confused the methods are called according to what exactly they do. And do you know that methods can be called in Russian? - Pavel Mayorov

0