Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
private static void Main()
{
var oApp = Process.GetProcessesByName("AppName");
if(oApp.Length == 0)
{
Process.Start(@"C:\......\App.exe");
// Need Progress Bar While Process Loading
}
}

What I have tried:

Need Progress Bar While Process Loading
Posted
Updated 7-Jan-20 23:15pm

1 solution

You can use an asynchronous approach to Process.Start (the default one is synchronous and doesn't wait for the process to start, it returns before that) and show a progress bar until the Task object completes.

See this thread for that, c# - Is there any async equivalent of Process.Start? - Stack Overflow[^].

Quote:
Need Progress Bar While Process Loading
This depends on the framework that you are using. Are you using WPF, WinForms, or any other front-end framework to render the controls. You will need to show the progress bar for that specific framework.

ProgressBar Class (System.Windows.Controls) | Microsoft Docs[^]
ProgressBar Control (Windows Forms) | Microsoft Docs[^]

The rest of the step is just the async/await application before the Process.Start and calling the function with await applied. Once the await is done, you can hide the ProgressBar and continue with the process that just started.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900