/// <summary> /// /// </summary> /// <param name="selectedProtocols"></param> /// <param name="selectedProtocolIDs"></param> /// <param name="sampleIDs"></param> /// <param name="sampleVolumes"></param> /// <returns></returns> public TimeSpan ScheduleRun(IProtocol[] selectedProtocols, int[] selectedProtocolIDs, int[] sampleIDs, double[] sampleVolumes) { LogFile.AddMessage(TraceLevel.Verbose, ">> Enter to (ScheduleRun)"); bIsSchedule = true; for (int numIDs = 0; numIDs < sampleIDs.Length; numIDs++) { string ReportIDs = string.Format("**************** Sample IDs : {0} ****************", sampleIDs[numIDs]); System.Diagnostics.Debug.WriteLine(ReportIDs); } TimeSpan estimatedTimeToCompletion = TimeSpan.Zero; try { if (IsConnectionEnabled) { // Prepare samples info XmlRpcSample[] samples = PrepareSampleInformation(selectedProtocols, selectedProtocolIDs, sampleIDs, sampleVolumes, null); // Schedule the run/calculate updated ETC LogFile.AddMessage(TraceLevel.Verbose, "Requesting ETC update (ScheduleRun)"); DateTime estimatedTimeOfCompletion = myXmlRpcProxy.ScheduleRun(samples); // Log the ETC DateTimeFormatInfo currentDateTimeFormatInfo = DateTimeFormatInfo.CurrentInfo; LogFile.AddMessage(TraceLevel.Verbose, string.Format("ETC update: {0}", estimatedTimeOfCompletion.ToString(currentDateTimeFormatInfo.SortableDateTimePattern))); // Calculate and report the time remaining (time to completion) CalculateEstimatedTimeToCompletion(estimatedTimeOfCompletion, ref estimatedTimeToCompletion); } } catch (Exception ex) { // Log the details of the exception LogException(ex, "ScheduleRun"); } Thread.Sleep(1000); bIsSchedule = false; LogFile.AddMessage(TraceLevel.Verbose, ">> Leave (ScheduleRun)"); return(estimatedTimeToCompletion); }