I am working on wpf application where so many UI screens are available and each UI contains lots of processing using multi threading, task await, dispatcher and, background worker. So now I have two buttons START and STOP. Now when I will click START button then whole application's process(long running process) need to run in while loop. Which causing application freeze. So now I want to transfer my process in another class in another normal application. which will contains only logic and I will need to send only single parameter to that application.
Now I want to achieve like when I will click on start button from my WPF application then another application(which contains only cs file there will be not any type of UI) need to run in while loop. And again when I will click STOP button then again that application need to stop it's work. I don't know about it's logic how to implement but I have an idea like I describe. So please can you guide me little bit that how can I implement that ?
For that like I have a WPF application and second one is console application. Now in my Console Application code is like :
public static void Main(string[] args)
{
startProcess("This is running");
}
public static void startProcess(string name)
{
StreamWriter log;
string filePath = @"D:\TimeLogFile.txt";
for (int i = 0; i <= 10; i++)
{
log = File.AppendText(filePath);
log.WriteLine(name);
log.Close();
}
}
now I need to pass string parameter from my WPF application and want to run this console application from my WPF application. So please can you guide me that how can I achive it ?
from WPF application when I will click Start button then I want to run console application with passing parameters. I have try below code which is running my console application but don't know how to pass parameter and fetch it on console application side.
using(System.Diagnostics.Process process = new System.Diagnostics.Process())
{
process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = @"D:\StockTest.exe";
process.StartInfo.CreateNoWindow = true;
process.Start();
}
it's running console application but I want to pass parameter also there. So how can I pass parameter to console application and run console application.