Пример #1
0
 //The function is called by the EAWS Service. This in turn calls the Test Client SendUpdate() function
 public void SendUpdate(EAWSTestApp.EAWSService.JobResponseType resp)
 {
     m_MainWindow.SendUpdate(resp);
 }
Пример #2
0
        //This function gets called by EAWSCallBackSolid object when it receives a call back from EAWS Service.
        //Any call to the EAWSService will get a response via this call back plus on running poll status
        //and completed job status of any running job will be sent via this call back
        //It receives a EAWSService.JobResponseType which can be tested and cast to determine
        //the required repspnse.
        public void SendUpdate(EAWSService.JobResponseType resp)
        {
            try
            {
                lock (lockThis)
                {
                    if (resp == null)
                    {
                        IDC_RESULT_TEXT.Text += "\n Service Update Failure!!";
                        return;
                    }

                    if (m_JobsRunning.ContainsKey(resp.itemIDRef) == false)
                    {
                        IDC_RESULT_TEXT.Text += "\n Service Update Failure. Task GUID not found!!";
                        IDC_RESULT_TEXT.Text += resp.Status.comment; //Might be exception thrown.
                        return;
                    }

                    //Poll status or Completed Job Update
                    if (resp is EAWSService.TaskCompletionResponse)
                    {
                        EAWSService.TaskCompletionResponse rTaskCompletionRepsonse = resp as EAWSService.TaskCompletionResponse;

                        //Call to RequestTaskStatus() was successful when:
                        //rTaskStatusResponse is not NULL
                        //rTaskStatusResponse is marked with success and
                        //GUID of rTaskStatusResponse and rTaskStatusRequest matches
                        if (rTaskCompletionRepsonse.Success)
                        {
                            if (rTaskCompletionRepsonse.Finished == true)
                            {
                                IDC_RESULT_TEXT.Text += "\n Task: " + rTaskCompletionRepsonse.TaskName
                                                        + " Master Guid: " + resp.masterIDRef.ToString()
                                                        + " Guid: " + resp.itemIDRef.ToString() + " is Complete."
                                                        + "\n" + resp.Status.comment;
                                m_JobsRunning.Remove(resp.itemIDRef);

                                if (rTaskCompletionRepsonse.OutputLocation.Length > 0)
                                {
                                    IDC_RESULT_TEXT.Text += "\nOutput Location: " + rTaskCompletionRepsonse.OutputLocation;
                                }
                            }
                            else
                            {
                                IDC_RESULT_TEXT.Text += "\n Task: " + rTaskCompletionRepsonse.TaskName
                                                        + " Master Guid: " + resp.masterIDRef.ToString()
                                                        + " Guid: " + resp.itemIDRef.ToString() + " is Running.";
                            }
                        }
                        else
                        {
                            IDC_RESULT_TEXT.Text += "\n Unable to get status update for Task: "
                                                    + rTaskCompletionRepsonse.TaskName + " Guid: " + rTaskCompletionRepsonse.itemIDRef.ToString();
                        }
                    }
                    else if (resp is EAWSService.StartTaskResponse)
                    {
                        EAWSService.StartTaskResponse rStartTaskResponse = resp as EAWSService.StartTaskResponse;

                        //Call to RequestStartTask() was successful when:
                        //rStartTaskResponse is marked with success
                        if (rStartTaskResponse.Success)
                        {
                            IDC_RESULT_TEXT.Text += "\n Task: " + rStartTaskResponse.TaskName
                                                    + " Master Guid: " + resp.masterIDRef.ToString()
                                                    + " Guid: " + rStartTaskResponse.itemIDRef.ToString()
                                                    + " " + rStartTaskResponse.Status.comment;
                        }
                        else
                        {
                            IDC_RESULT_TEXT.Text += "\n Unable to start Task: "
                                                    + " Master Guid: " + resp.masterIDRef.ToString()
                                                    + rStartTaskResponse.TaskName + " Guid: " + rStartTaskResponse.itemIDRef.ToString();
                        }
                    }
                    else if (resp is EAWSService.StopTaskResponse)
                    {
                        EAWSService.StopTaskResponse rStopTaskResponse = resp as EAWSService.StopTaskResponse;

                        //Call to RequestStopTask() was successful when:
                        //rStartTaskResponse is marked with success
                        if (rStopTaskResponse.Success)
                        {
                            IDC_RESULT_TEXT.Text += "\n Task: " + rStopTaskResponse.TaskName
                                                    + " Master Guid: " + resp.masterIDRef.ToString()
                                                    + " Guid: " + rStopTaskResponse.itemIDRef.ToString()
                                                    + " " + rStopTaskResponse.Status.comment;
                        }
                        else
                        {
                            IDC_RESULT_TEXT.Text += "\n Unable to stop Task: "
                                                    + " Master Guid: " + resp.masterIDRef.ToString()
                                                    + rStopTaskResponse.TaskName + " Guid: " + rStopTaskResponse.itemIDRef.ToString();
                        }
                    }
                    else if (resp is EAWSService.DeleteTaskResponse)
                    {
                        EAWSService.DeleteTaskResponse rDeleteTaskResponse = resp as EAWSService.DeleteTaskResponse;

                        //Call to RequestDeleteTask() was successful when:
                        //rDeleteTaskResponse is marked with success
                        if (rDeleteTaskResponse.Success)
                        {
                            IDC_RESULT_TEXT.Text += "\n Task: " + rDeleteTaskResponse.TaskName
                                                    + " Master Guid: " + resp.masterIDRef.ToString()
                                                    + " Guid: " + rDeleteTaskResponse.itemIDRef.ToString()
                                                    + " " + rDeleteTaskResponse.Status.comment;
                        }
                        else
                        {
                            IDC_RESULT_TEXT.Text += "\n Unable to delete Task: "
                                                    + " Master Guid: " + resp.masterIDRef.ToString()
                                                    + rDeleteTaskResponse.TaskName + " Guid: " + rDeleteTaskResponse.itemIDRef.ToString();
                        }
                    }
                    else if (resp is EAWSService.TaskStatusResponse)
                    {
                        EAWSService.TaskStatusResponse rTaskStatusResponse = resp as EAWSService.TaskStatusResponse;

                        //Call to RequestTaskStatus() was successful when:
                        //rTaskStatusResponse is not NULL
                        //rTaskStatusResponse is marked with success and
                        //GUID of rTaskStatusResponse and rTaskStatusRequest matches
                        if (rTaskStatusResponse.Success)
                        {
                            m_JobsRunning.Remove(resp.itemIDRef);
                            IDC_RESULT_TEXT.Text += "\n Task: " + rTaskStatusResponse.TaskName
                                                    + " Master Guid: " + resp.masterIDRef.ToString()
                                                    + " Guid: " + rTaskStatusResponse.itemIDRef.ToString();

                            //Access the Number of warnings, Errors, Outstanding pieces of work and
                            //Merge activities of running task.
                            //If Outstanding pieces of work is zero then task is finished
                            IDC_RESULT_TEXT.Text += "\n Succeeded: " + rTaskStatusResponse.NumSucceeded.ToString()
                                                    + " Warnings: " + rTaskStatusResponse.NumWarning.ToString()
                                                    + " Errors: " + rTaskStatusResponse.NumError.ToString()
                                                    + " Outstanding: " + rTaskStatusResponse.NumOutStanding.ToString()
                                                    + " To Merge: " + rTaskStatusResponse.NumAwaitingMerge.ToString()
                                                    + rTaskStatusResponse.Status.comment;
                        }
                        else
                        {
                            IDC_RESULT_TEXT.Text += "\n Unable to get status update for Task: "
                                                    + " Master Guid: " + resp.masterIDRef.ToString()
                                                    + rTaskStatusResponse.TaskName + " Guid: " + rTaskStatusResponse.itemIDRef.ToString();
                        }
                    }
                    else if (resp is EAWSService.EditTaskRegionResponse)
                    {
                        EAWSService.EditTaskRegionResponse rEditTaskRegionResponse = resp as EAWSService.EditTaskRegionResponse;

                        //Call to RequestEditTaskRegion() was successful when:
                        //rEditTaskRegionResponse is marked with success
                        if (rEditTaskRegionResponse.Success)
                        {
                            IDC_RESULT_TEXT.Text += "\n Task: " + rEditTaskRegionResponse.TaskName
                                                    + " Master Guid: " + resp.masterIDRef.ToString()
                                                    + " Guid: " + rEditTaskRegionResponse.itemIDRef.ToString()
                                                    + " " + rEditTaskRegionResponse.Status.comment;
                        }
                        else
                        {
                            IDC_RESULT_TEXT.Text += "\n Unable to edit region for Task: "
                                                    + " Master Guid: " + resp.masterIDRef.ToString()
                                                    + rEditTaskRegionResponse.TaskName + " Guid: " + rEditTaskRegionResponse.itemIDRef.ToString();
                        }
                    }
                    else if (resp is EAWSService.EditTaskFiltersResponse)
                    {
                        EAWSService.EditTaskFiltersResponse rEditTaskFiltersResponse = resp as EAWSService.EditTaskFiltersResponse;

                        //Call to RequestEditTaskFilters() was successful when:
                        //rEditTaskFiltersResponse is marked with success
                        if (rEditTaskFiltersResponse.Success)
                        {
                            IDC_RESULT_TEXT.Text += "\n Task: " + rEditTaskFiltersResponse.TaskName
                                                    + " Master Guid: " + resp.masterIDRef.ToString()
                                                    + " Guid: " + rEditTaskFiltersResponse.itemIDRef.ToString()
                                                    + " " + rEditTaskFiltersResponse.Status.comment;
                        }
                        else
                        {
                            IDC_RESULT_TEXT.Text += "\n Unable to edit region for Task: "
                                                    + " Master Guid: " + resp.masterIDRef.ToString()
                                                    + rEditTaskFiltersResponse.TaskName + " Guid: " + rEditTaskFiltersResponse.itemIDRef.ToString();
                        }
                    }
                    else if (resp is EAWSService.AllSchemaNamesResponse)
                    {
                        //Call RequestAllSchemaNames passing rAllSchemaNamesRequest as a parameter
                        //It gets a AllSchemaNamesResponse as a return parameter
                        EAWSService.AllSchemaNamesResponse rAllSchemaNamesResponse = resp as EAWSService.AllSchemaNamesResponse;

                        //Call to RequestAllSchemaNames() was successful when:
                        //rAllSchemaNamesResponse is marked with success and
                        //rAllSchemaNamesResponse.AllSchemaNames is not empty as this holds list of all schemas
                        if (rAllSchemaNamesResponse.Success && rAllSchemaNamesResponse.AllSchemaNames != null)
                        {
                            //Extract each schema from rAllSchemaNamesResponse.AllSchemaNames
                            this.IDC_SCHEMA_COMBO.Items.Clear();
                            foreach (string taskname in rAllSchemaNamesResponse.AllSchemaNames)
                            {
                                this.IDC_SCHEMA_COMBO.Items.Add(taskname);
                            }
                        }
                        else
                        {
                            IDC_RESULT_TEXT.Text += "\n Unable to get list of schemas.";
                        }
                    }
                    else if (resp is EAWSService.AllSchemaTaskNamesResponse)
                    {
                        EAWSService.AllSchemaTaskNamesResponse rAllSchemaTaskNamesResponse = resp as EAWSService.AllSchemaTaskNamesResponse;

                        //Call to RequestAllTaskNames() was successful when:
                        //rAllSchemaTaskNamesResponse is marked with success and
                        //rAllSchemaTaskNamesResponse.AllTaskNames is not empty as this holds list of all tasks
                        if (rAllSchemaTaskNamesResponse.Success && rAllSchemaTaskNamesResponse.AllTaskNames != null)
                        {
                            //Extract each task from rAllSchemaNamesResponse.AllTaskNames
                            this.IDC_TASK_COMBO.Items.Clear();
                            foreach (string taskname in rAllSchemaTaskNamesResponse.AllTaskNames)
                            {
                                this.IDC_TASK_COMBO.Items.Add(taskname);
                            }
                        }
                        else
                        {
                            IDC_RESULT_TEXT.Text += "\n Unable to get list of tasks for schema: "
                                                    + rAllSchemaTaskNamesResponse.SchemaName;
                        }
                    }
                }
                IDC_RESULT_TEXT.ScrollToEnd();
            }
            catch (Exception eException)
            {
                MessageBox.Show(eException.Message);
            }
        }