示例#1
0
 /// <summary>
 /// Handles the get status event for the local and remote host.
 /// <para>When remote host, it also retrieves the latest runtime settings of the remote host and displays them.</para>
 /// </summary>
 /// <param name="context">Indicates whether the event came from local or remote host</param>
 /// <returns>The status string</returns>
 public string Status(object context)
 {
     // If it is the local host
     if (context == null && _localTpe != null)
     {
         // get the status
         localTpeStatus.Status = _localTpe.Status();
         // verify that the display settings match watch is actually
         // assigned to the controls.
         if (_daMgr != null && _daMgr.loggingMgr != null)
         {
             localTpeStatus.DisplayTraceLevelState(_daMgr.loggingMgr.TraceLevel);
         }
         if (_localTpe.EngineStatus == TaskProcessing.TaskProcessingEngine.EngineStatusEnum.Paused)
         {
             localTpeStatus.DisplayPausedState();
         }
         else if (_localTpe.EngineStatus == TaskProcessing.TaskProcessingEngine.EngineStatusEnum.Running)
         {
             localTpeStatus.DisplayResumedState();
         }
         else if (_localTpe.EngineStatus == TaskProcessing.TaskProcessingEngine.EngineStatusEnum.Stopped)
         {
             localTpeStatus.DisplayDisconnectedState();
         }
         localTpeStatus.DisplayMaxTasks(_localTpe.MaxTasks);
     }
     // otherwise, if it was a remote host event
     // request status from the remote host
     else if (context != null && _remoteTpe != null)
     {
         // response lets us know if there was a communication failure
         RemoteHostResponseString response = _remoteTpe.Status(context.ToString());
         if (response.Success)
         {
             // dynamic settings provide us with the runtime settings of the configuration settings
             Dictionary <string, string> dynamicSettings
                 = (Dictionary <string, string>)Core.Functions.Deserialize <Dictionary <string, string> >
                       (response.ReturnValue.ToString());
             string engineStatus = dynamicSettings[TaskProcessing.Constants.EngineStatus];
             if (engineStatus == TaskProcessing.TaskProcessingEngine.EngineStatusEnum.Paused.ToString())
             {
                 remoteTpeStatus.DisplayPausedState();
             }
             else
             {
                 remoteTpeStatus.DisplayResumedState();
             }
             remoteTpeStatus.Status = dynamicSettings[TaskProcessing.Constants.StatusMsg];;
             remoteTpeStatus.DisplayTraceLevelState(ILoggingManagement.Constants.ToTraceLevel(
                                                        dynamicSettings[ILoggingManagement.Constants.TraceLevel]));
             remoteTpeStatus.DisplayMaxTasks(Convert.ToInt32(dynamicSettings[TaskProcessing.Constants.MaxTasksInParallel]));
         }
         else
         {
             HostConnectionAborted(response.ErrorMsg);
         }
     }
     return(string.Empty);
 }