daily pastebin goal
27%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var fd = new OpenFileDialog
  2. {
  3.     Multiselect = true,
  4.     Title = "Open Image",
  5.     Filter = "Image|*.jpg"
  6. };
  7.  
  8. using (fd)
  9. {
  10.     if (fd.ShowDialog() == DialogResult.OK)
  11.     {
  12.        int i = 1;                
  13.        foreach (String file in fd.FileNames)
  14.        {
  15.            if (i <= 10) {
  16.                i++;
  17.                Console.WriteLine(i + ";" + file);
  18.                Task task = new Task(() =>
  19.                {
  20.                    // do some stuff
  21.                });
  22.                task.Start();
  23.            }
  24.            else
  25.            {
  26.                Task.WaitAll();
  27.                i = 1;
  28.            }
  29.        }  
  30.     }
  31. }
  32. Console.WriteLine("Wait for Tasks");
  33. Task.WaitAll();
  34. Console.WriteLine("Waited);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top