0

I'm working on one application which is using ASP.Net with C# in which I have one method with two parameters and I want to start it using Thread, to keep track either method execution is completed or not.

scenario:

Below is the method which I want to call in thread:

private long CreateAJobCopy(long jobID, long userID)
    {
        JobManagementClient jobManagementClient = new JobManagementClient();
        long newJobID=0;

        try
        {
            JobResultEntity jobResultEntity = jobManagementClient.CreateJobCopy(Common.AuthenticationToken, jobID, userID);
            if (jobResultEntity.Job != null)
                newJobID = jobResultEntity.Job.JobID;
            return newJobID;
        }
        catch (Exception ex)
        {
            ExceptionLogger.LogException(ex, Common.AuthenticationToken);
            return 0;
        }
    }

I want to display message to User that job is being created:

lblCreateJobCopyMessage.Text = "Please wait while new job is being created!";

when the method execution is completed I want to redirect to new page.

Dhaval Panchal
  • 612
  • 4
  • 12
  • 32
  • What technology are you working with here - ASP, Winforms, WPF, other? – Dan Puzey Sep 16 '13 at 13:24
  • 1
    Create `Started` and `Finished` events. Fire them when entering thread and leaving/terminating them. – Sinatr Sep 16 '13 at 13:26
  • @NicolasTyler: I have read that post but can't help. I have updated the question above. – Dhaval Panchal Sep 16 '13 at 13:29
  • 1
    I see the method returns a value, you're better off using a Task here as they can give you return values as-well as let you wait on the thread completion – caesay Sep 16 '13 at 13:35

0 Answers0