private void CreateThreadForGetAllJobs(object dummy)
 {
     try
     {
         string result = "";
         IEnumerable <TranslationJobInfo> jobs;
         result += "All jobs: Current Users \n";
         jobs    = TranslationJobStatus.GetAllJobs(cc);
         cc.ExecuteQuery();
         foreach (TranslationJobInfo allJobInfo in jobs)
         {
             result += "JobId:" + allJobInfo.JobId + ", JobName: " + allJobInfo.Name +
                       ", Submitted:" + allJobInfo.SubmittedTime + ", Cancel Time:" + allJobInfo.CancelTime +
                       ", Canceled:" + allJobInfo.Canceled + ", PartiallySubmitted: " + allJobInfo.PartiallySubmitted + "\n";
         }
         DispatcherOperation dop = Dispatcher.BeginInvoke(new Action <string>(PrintResult), result);
     }
     catch (Exception e)
     {
         DispatcherOperation dop = Dispatcher.BeginInvoke(new Action <string>(PrintResult), e.ToString());
     }
 }
    /// <summary>
    /// Print 4 types of jobs
    ///     1.All active jobs of all users
    ///     2.All active jobs of the current user
    ///     3.All jobs of all users
    ///     4.All jobs of the current user
    /// </summary>
    static void GetJobStatus()
    {
        ReadOnlyCollection <TranslationJobInfo> activeJobs;

        Console.WriteLine("=====Active jobs: All Users=====================");
        activeJobs = TranslationJobStatus.GetAllActiveJobs(sc, TranslationJobUserScope.AllUsers);
        foreach (TranslationJobInfo activeJobInfo in activeJobs)
        {
            Console.WriteLine("JobId:" + activeJobInfo.JobId + ", JobName: " + activeJobInfo.Name +
                              ", Submitted:" + activeJobInfo.SubmittedTime + ", Canceled:" + activeJobInfo.CancelTime);
        }

        Console.WriteLine("=====Active jobs: Current Users=====================");
        activeJobs = TranslationJobStatus.GetAllActiveJobs(sc, TranslationJobUserScope.CurrentUser);
        foreach (TranslationJobInfo activeJobInfo in activeJobs)
        {
            Console.WriteLine("JobId:" + activeJobInfo.JobId + ", JobName: " + activeJobInfo.Name +
                              ", Submitted:" + activeJobInfo.SubmittedTime + ", Canceled:" + activeJobInfo.CancelTime);
        }
        ReadOnlyCollection <TranslationJobInfo> allJobs;

        Console.WriteLine("=====All jobs: All Users=====================");
        allJobs = TranslationJobStatus.GetAllJobs(sc, TranslationJobUserScope.AllUsers);
        foreach (TranslationJobInfo allJobInfo in allJobs)
        {
            Console.WriteLine("JobId:" + allJobInfo.JobId + ", JobName: " + allJobInfo.Name +
                              ", Submitted:" + allJobInfo.SubmittedTime + ", Canceled:" + allJobInfo.CancelTime);
        }
        Console.WriteLine("=====All jobs: Current Users=====================");
        allJobs = TranslationJobStatus.GetAllJobs(sc, TranslationJobUserScope.CurrentUser);
        foreach (TranslationJobInfo allJobInfo in allJobs)
        {
            Console.WriteLine("JobId:" + allJobInfo.JobId + ", JobName: " + allJobInfo.Name +
                              ", Submitted:" + allJobInfo.SubmittedTime + ", Canceled:" + allJobInfo.CancelTime);
        }
    }
        static void TranslationJobStatusGetJob()
        {
            IEnumerable <TranslationJobInfo> jobs;

            Console.WriteLine("Active jobs: Current Users");
            jobs = TranslationJobStatus.GetAllActiveJobs(cc);
            cc.ExecuteQuery();
            foreach (TranslationJobInfo activeJobInfo in jobs)
            {
                Console.WriteLine("JobId:" + activeJobInfo.JobId + ", JobName: " + activeJobInfo.Name +
                                  ", Submitted:" + activeJobInfo.SubmittedTime + ", Cancel Time:" + activeJobInfo.CancelTime +
                                  ", Canceled:" + activeJobInfo.Canceled + ", PartiallySubmitted: " + activeJobInfo.PartiallySubmitted);
            }

            Console.WriteLine("All jobs: Current Users");
            jobs = TranslationJobStatus.GetAllJobs(cc);
            cc.ExecuteQuery();
            foreach (TranslationJobInfo allJobInfo in jobs)
            {
                Console.WriteLine("JobId:" + allJobInfo.JobId + ", JobName: " + allJobInfo.Name +
                                  ", Submitted:" + allJobInfo.SubmittedTime + ", Cancel Time:" + allJobInfo.CancelTime +
                                  ", Canceled:" + allJobInfo.Canceled + ", PartiallySubmitted: " + allJobInfo.PartiallySubmitted);
            }
        }