private static void BeginEmergencyExitChute(string pipeID) { try { _client = IPCClientFactory.Create(); _client.VerbosityLevel = 1; _client.Initialize <IFLExService>("FLExEndpoint" + pipeID, _waitObject, CleanupHost); _client.RemoteCall("BridgeWorkOngoing", SignalCompletion); } catch (Exception) { CleanupHost(); } }
private bool _runStandAlone; // debug mode, run with message boxes instead of connection to FLEx. #endif /// <summary> /// Initialize the helper, setting up the local service endpoint and opening. /// </summary> /// <param name="commandLineArgs">The entire FieldWorks project folder path is in the '-p' option, if not 'obtain' operation. /// Must include the project folder and project name with "fwdata" extension. /// Empty is OK if not send_receive command.</param> public bool Init(Dictionary <string, string> commandLineArgs) { #if DEBUG // this command line argument is only for debugging. if (commandLineArgs.ContainsKey("-runStandAlone")) { _runStandAlone = true; MessageBox.Show("connection opened"); return(true); } #else if (commandLineArgs.ContainsKey("-runStandAlone")) { throw new InvalidOperationException("The '-runStandAlone' command line option is not supported in a Release build."); } #endif HostOpened = true; // The pipeID as set by FLEx to be used in setting the communication channels var pipeId = commandLineArgs["-pipeID"]; _host = IPCHostFactory.Create(); _host.VerbosityLevel = 1; var hostIsInitialized = _host.Initialize <FLExService, IFLExService>("FLExEndpoint" + pipeId, null, null); if (!hostIsInitialized) { HostOpened = false; // display messagebox and quit MessageBox.Show(CommonResources.kAlreadyRunning, CommonResources.kFLExBridge, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return(false); } //open host ready for business _client = IPCClientFactory.Create(); _client.VerbosityLevel = 1; _client.Initialize <IFLExBridgeService>("FLExBridgeEndpoint" + pipeId, FLExService.WaitObject, null); if (!_client.RemoteCall("BridgeReady")) { _client = null; //FLEx isn't listening. } return(true); }