This may be a strange question, and it really is for my educational purpose, so I can apply it in future scenarios that may arise.
I am using C #.
I am stressed, so this is not exactly production code.
I upload data to my server through a web service.
I start the service using Run.Task.
I check if the task is completed before allowing the next Run.Task to run.
This is done in a loop.
However, since I am using a modular declared task, will the result not be affected? I could declare a local variable Task.Run, but I want to see how far I can get this question. 1.
If Task.Run can raise an event to say that it has completed, may this not be a problem?
This is my code:
// module declaration:
private static Task webTask = Task.Run(() => { System.Windows.Forms.Application.DoEvents(); });
// ,
if (webTask.IsCompleted)
{
}
webTask = Task.Run(() =>
{
try
{
wcf.UploadMotionDynamicRaw(bytes);
}
catch (Exception ex)
{
}
);