示例#1
0
 /// <summary>
 /// Returns an InstrumentBlocksType runtime object containing the CFX system status of all connected instruments,
 /// along with any associated service or instrument error reports.
 /// </summary>
 /// <returns>List of InstrumentStatus objects containing the statuses of all connected CFX systems.</returns>
 public List <InstrumentStatus> GetInstrumentStatus()
 {
     try
     {
         m_MasterMessage.Item = m_InstrumentStatus_Item;
         return(BlocksType2StatusList(XML2BlocksType(CFXManagerClient.SendServiceRequest(Message2XML(m_MasterMessage)))));
     }
     catch (Exception ex)
     {
         OnClientError(new ClientErrorEventArgs(new ErrorRecord(ex, System.Reflection.MethodBase.GetCurrentMethod().Name)));
     }
     return(null);
 }
示例#2
0
 /// <summary>
 /// Unregister the underlying client with CFX Manager API service. Called by the consumer facing CloseClient()
 /// method. It is important that the client unregister with the service before closing since the service uses
 /// the registration to enforce its single client policy.
 ///
 /// Wraps CFXManagerClient:SendServiceRequest() in the local exception handling framework
 /// </summary>
 /// <returns>true IFF no exceptions occurred during the operation</returns>
 private InstrumentBlocksType Unregister()
 {
     try
     {
         m_MasterMessage.Item = m_Unregister_Item;
         return(XML2BlocksType(CFXManagerClient.SendServiceRequest(Message2XML(m_MasterMessage))));
     }
     catch (Exception ex)
     {
         OnClientError(new ClientErrorEventArgs(new ErrorRecord(ex, System.Reflection.MethodBase.GetCurrentMethod().Name)));
     }
     return(null);
 }
示例#3
0
 /// <summary>
 ///  The ClientError Event Handler
 /// </summary>
 public virtual void OnClientError(ClientErrorEventArgs e)
 {
     try
     {
         CFXManagerClient.AbortClient();
     }
     catch
     {
         ;
     }
     if (ClientError != null)
     {
         ClientError(m_lock_object, e);
     }
 }
示例#4
0
 /// <summary>
 /// Ping method to verify an open and active service channel is currently established between
 /// the client and the service.
 ///
 /// Wraps CFXManagerClient:IsConnected() in the local exception handling framework
 /// </summary>
 /// <returns>true IFF the client is open and connected to the API service</returns>
 public bool ClientIsConnected()
 {
     lock (m_lock_object)
     {
         try
         {
             return(CFXManagerClient.IsConnected());
         }
         catch (Exception ex)
         {
             OnClientError(new ClientErrorEventArgs(new ErrorRecord(ex, System.Reflection.MethodBase.GetCurrentMethod().Name)));
         }
         return(false);
     }
 }
示例#5
0
 /// <summary>
 /// Shutdown the CFX Manager application hosting the service. This should be used by consumer applications to
 /// shut-down server mode (no UI) instances of the CFX Manager application which they have explcitly started.
 /// If this command is not used to shut down such instances (the application is shut-down by simply killing
 /// the process, for example) then there is a high likelyhood that certain associated independent processes
 /// will remain running and prevent any further normal operation of CFX Manager until host system reboot.
 /// </summary>
 public void ShutDown()
 {
     try
     {
         //We know we will probably get a time-out here because the service will be closed during the shut-down,
         //so set the time-out to 1 second be sure we don't have to wait any longer than that at the send command.
         CFXManagerClient.SetResponseTimeOut(1);
         m_MasterMessage.Item = m_ShutDown_Item;
         CFXManagerClient.SendServiceRequest(Message2XML(m_MasterMessage));
     }
     catch
     {
         ;
         //an expected time-out will often occur here because the shut-down sequence closes the service
         //pretty quicky, usually before a response can be generated.
     }
 }
示例#6
0
 /// <summary>
 ///Close the client. Must be called by the consumer application prior to exiting to ensure that the client
 ///unregisters from the service, and that all client related resources are freed. Failure to call this
 ///method will at the very least prevent any future client connections from being established with the API
 ///service during the current CFX Manager session.
 ///
 ///Wraps CFXManagerClient:CloseClient() in the local exception handling framework
 /// </summary>
 public void CloseClient()
 {
     lock (m_lock_object)
     {
         try
         {
             if (CFXManagerClient.IsConnected())
             {
                 Unregister();
             }
             CFXManagerClient.AbortClient();
         }
         catch (Exception ex)
         {
             OnClientError(new ClientErrorEventArgs(new ErrorRecord(ex, System.Reflection.MethodBase.GetCurrentMethod().Name)));
         }
     }
 }
示例#7
0
 /// <summary>
 /// Generate PDF report from the specified data file
 /// </summary>
 /// <param name="dataFile">The data file from which to generate the report</param>
 /// <param name="templateFile">The report template file to be use to generate the report</param>
 /// <param name="outputFile">
 /// Fully qualified file name of the report file will be written.
 /// If empty or null then the name of the data file will be used with the filename extention replaced according to the report file type.
 /// </param>
 /// <list type="">
 /// <item>Portable data format ("PDF").</item>
 /// <item>Mime-type HTML ("mHTML").</item>
 /// <item>Plain Text ("text").</item>
 /// </list>
 /// <returns>List of InstrumentStatus objects containing the status of all connected instruments</returns>
 public List <InstrumentStatus> GenerateReport(
     string dataFile,
     string templateFile,
     string outputFile
     )
 {
     try
     {
         m_GenerateReport_Item.DataFile     = dataFile;
         m_GenerateReport_Item.OutputFile   = outputFile;
         m_GenerateReport_Item.TemplateFile = templateFile;
         m_GenerateReport_Item.Type         = ReportTypes.pdf;
         m_MasterMessage.Item = m_GenerateReport_Item;
         return(BlocksType2StatusList(XML2BlocksType(CFXManagerClient.SendServiceRequest(Message2XML(m_MasterMessage)))));
     }
     catch (Exception ex)
     {
         OnClientError(new ClientErrorEventArgs(new ErrorRecord(ex, System.Reflection.MethodBase.GetCurrentMethod().Name)));
     }
     return(null);
 }
示例#8
0
 /// <summary>
 /// Start a protocol run using the given parameters on the specified CFX system.
 /// </summary>
 /// <param name="serialNumber">
 /// Serial number of CFX system base
 /// </param>
 /// <param name="protocolFile">
 /// Fully qualified protocol, LIMS, or PrimePCR file name
 /// </param>
 /// <param name="plateFile">
 /// Full path to plate file if protocolFile is a real-time protocol(.pcrd) file.
 /// Null if protocolFile is a conventional protocol, a LIMS(.csv) file, or PrimePCR(.plrn) file.
 /// </param>
 /// <param name="runNote">
 /// Text to appear as Notes in the report file
 /// </param>
 /// <param name="runID">
 /// Text to appear as Run ID, (typically a plate barcode), in the report file
 /// </param>
 /// <param name="DataFileName">
 /// Fully qualified file name of the data file to be created, or empty to use CFX manager default settings
 /// </param>
 /// <param name="LockInstrumentPanel">
 /// Locking the instrument front panel during the run? True to lock
 /// </param>
 /// <param name="GenerateReport">
 /// Generate report after the run? True to generate report
 /// </param>
 /// <param name="ReportTemplate">
 /// Full path to report template file to be used to create reports or empty to use default template
 /// </param>
 /// <param name="ReportFileName">
 /// Fully qualified file name of the data file to be created, or empty to use CFX manager default settings
 /// </param>
 /// <param name="EmailAddresses">
 /// Comma seperated Email addresses to send data files and reports to at run completion.
 /// </param>
 /// <returns>
 /// InstrumentBlocksType runtime object containing the status of the target instrument and any errors that occurred during the operation
 /// </returns>
 public List <InstrumentStatus> RunProtocol(
     string serialNumber,
     string protocolFile,
     string plateFile,
     string runNote,
     string runID,
     string DataFileName,
     bool LockInstrumentPanel,
     bool GenerateReport,
     string ReportTemplate,
     string ReportFileName,
     string EmailAddresses)
 {
     try
     {
         m_RunProtocol_Item.SerialNumber               = serialNumber;
         m_RunProtocol_Item.ProtocolFile               = protocolFile;
         m_RunProtocol_Item.PlateFile                  = plateFile;
         m_RunProtocol_Item.Note                       = runNote == null ? string.Empty : runNote;
         m_RunProtocol_Item.RunId                      = runID == null ? string.Empty : runID;
         m_RunProtocol_Item.DataFile                   = DataFileName;
         m_RunProtocol_Item.LockInstrumentPanel        = LockInstrumentPanel;
         m_RunProtocol_Item.GenerateReportEndOfRun     = GenerateReport;
         m_RunProtocol_Item.GenerateReportTemplateFile = ReportTemplate;
         m_RunProtocol_Item.GenerateReportOutputFile   = ReportFileName;
         m_RunProtocol_Item.EmailAddresses             = EmailAddresses;
         m_RunProtocol_Item.GenerateReportType         = ReportTypes.pdf;
         m_MasterMessage.Item = m_RunProtocol_Item;
         return(BlocksType2StatusList(XML2BlocksType(CFXManagerClient.SendServiceRequest(Message2XML(m_MasterMessage)))));
     }
     catch (Exception ex)
     {
         OnClientError(new ClientErrorEventArgs(new ErrorRecord(ex, System.Reflection.MethodBase.GetCurrentMethod().Name)));
     }
     return(null);
 }
示例#9
0
 /// <summary>
 /// Register the underlying client with the CFX Manager API service. Called by the consumer facing OpenClient()
 /// method to register the underlying client with the service once the connection is established.
 ///
 /// The registration ID aquired by this request is required by all other service requests. This class hides the
 /// registration ID and its associated role in service transactions from consuming applications.
 ///
 /// Wraps CFXManagerClient:SendServiceRequest() in the local exception handling framework
 /// </summary>
 /// <returns>true IFF no exceptions occurred during the operation</returns>
 private bool Register()
 {
     m_registrationID = string.Empty;
     try
     {
         m_MasterMessage.Item           = m_Register_Item;
         m_MasterMessage.RegistrationID = string.Empty;
         InstrumentBlocksType response = XML2BlocksType(CFXManagerClient.SendServiceRequest(Message2XML(m_MasterMessage)));
         m_registrationID = response.RegistrationID;
         m_MasterMessage.RegistrationID = m_registrationID;
     }
     catch (Exception ex)
     {
         OnClientError(new ClientErrorEventArgs(new ErrorRecord(ex, System.Reflection.MethodBase.GetCurrentMethod().Name)));
     }
     if (string.IsNullOrEmpty(m_registrationID))
     {
         OnClientError(new ClientErrorEventArgs(
                           new ErrorRecord(ErrorRecord.c_NoCode,
                                           "Registration with the CFX Manager API service failed. A previously connected client may have exited without unregistering. Try re-starting CFX Manager",
                                           System.Reflection.MethodBase.GetCurrentMethod().Name)));
     }
     return(!string.IsNullOrEmpty(m_registrationID));
 }