From 58904b7d9b781c9a7eb18183392b3a565fdbcd51 Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Sat, 8 Jul 2023 23:26:39 +0200 Subject: Removed public folder --- public/non-blocking-shell-exec-csharp.html | 36 ------------------------------ 1 file changed, 36 deletions(-) delete mode 100755 public/non-blocking-shell-exec-csharp.html (limited to 'public/non-blocking-shell-exec-csharp.html') diff --git a/public/non-blocking-shell-exec-csharp.html b/public/non-blocking-shell-exec-csharp.html deleted file mode 100755 index 3a4ebe9..0000000 --- a/public/non-blocking-shell-exec-csharp.html +++ /dev/null @@ -1,36 +0,0 @@ -Execute not blocking async shell command in C#

Execute not blocking async shell command in C#

May 22, 2023

Execute a shell command in async in C# while not blocking the UI thread.

private async Task executeCopyCommand()
-{
-  await Task.Run(() =>
-  {
-    var processStartInfo = new ProcessStartInfo("cmd", "/c dir")
-    {
-      RedirectStandardOutput = true,
-      UseShellExecute = false,
-      CreateNoWindow = true
-    };
-
-    var process = new Process
-    {
-      StartInfo = processStartInfo
-    };
-
-    process.Start();
-    process.WaitForExit();
-  });
-}
-

Make sure that async is present in the function definition and await is used -in the method that calls executeCopyCommand().

private async void button_Click(object sender, EventArgs e)
-{
-  await executeCopyCommand();
-}
-
\ No newline at end of file -- cgit v1.2.3