예제 #1
0
        /// <summary>
        ///
        /// </summary>
        public void Halt()
        {
            bool haltResult = false, unsubscribeResult = false;

            try
            {
                if (IsConnectionEnabled)
                {
                    // Tell the XML-RPC server to shut down its "RoboSep" command handling
                    haltResult = myXmlRpcProxy.Halt();

                    // Disconnect from the XML-RPC server
                    unsubscribeResult = myXmlRpcProxy.Unsubscribe(
                        RemotingInfo.GetInstance().IcsEventSinkURL);
                }
            }
            catch (WebException wex)
            {
                if (wex.Status != WebExceptionStatus.ConnectionClosed)
                {
                    // Log the details of the exception
                    LogException(wex, "Halt1");
                }
            }
            catch (Exception ex)
            {
                // Log the details of the exception
                LogException(ex, "Halt2");
            }
            finally
            {
                LogFile.AddMessage(TraceLevel.Verbose,
                                   "Instrument Control API Halt() returned " +
                                   haltResult.ToString());

                LogFile.AddMessage(TraceLevel.Verbose,
                                   "Instrument Control API Unsubscribe() returned " +
                                   unsubscribeResult.ToString());

                DisableConnection();
            }
        }