/////////////////////////////////////////////////////////////////////////////////////////// // Start Method public void StartMethod(string bravoMethodFileName, int repeatProtocolCount) { // bravoMethodFileName = the full path and filename of the VWorks protocol file to be executed // repeatProtocolCount = when starting a protocol in VWorks, it always asks how many times to repeat the protocol. This parameters answers that question. ShowVWorks(); m_protocolAborted = false; if (!File.Exists(bravoMethodFileName)) { PostVWorksCommand(VWORKS_COMMAND.Error, "VWorks Method File was not found", bravoMethodFileName); return; } m_bravoMethodFile = bravoMethodFileName; /////////////////////////////////// // Run the Method (launch the Bravo method) String runString = bravoMethodFileName + " : " + DateTime.Now.ToString(); PostVWorksCommand(VWORKS_COMMAND.Message, "", runString); // VWorks fires the LogMessage event while loading the protocol, which // in this simple example causes things to lock, because this client can't // respond to the event while waiting for RunProtocol to return, and RunProtocol // won't return unless the client responds to the event! // Temporarily unsubscribe from log events //VWorks_.LogMessage -= logEventHandler; // Start the protocol running m_protocolStartTime = DateTime.Now; VWorks_.RunProtocol(bravoMethodFileName, repeatProtocolCount); // Again subscribe to events //VWorks_.LogMessage += logEventHandler; }
/////////////////////////////////////////////////////////////////////////////////////////// // Start Method public void StartMethod(string bravoMethodFileName) { ShowVWorks(); m_protocolAborted = false; if (!File.Exists(bravoMethodFileName)) { PostVWorksCommand(VWORKS_COMMAND.Error, "VWorks Method File was not found", bravoMethodFileName); return; } m_bravoMethodFile = bravoMethodFileName; /////////////////////////////////// // Run the Method (launch the Bravo method) String runString = bravoMethodFileName + " : " + DateTime.Now.ToString(); PostVWorksCommand(VWORKS_COMMAND.Message, "", runString); // VWorks fires the LogMessage event while loading the protocol, which // in this simple example causes things to lock, because this client can't // respond to the event while waiting for RunProtocol to return, and RunProtocol // won't return unless the client responds to the event! // Temporarily unsubscribe from log events //VWorks_.LogMessage -= logEventHandler; // Start the protocol running m_protocolStartTime = DateTime.Now; VWorks_.RunProtocol(bravoMethodFileName, 1); // Again subscribe to events //VWorks_.LogMessage += logEventHandler; }