Exemple #1
0
        private void showErrorForException(wPlcException ex)
        {
            int clientErrorCode = (ex.errorCode >> 20) & 0xFFF;
            string clientError = String.Empty;
            if (clientErrorCode != 0)
                clientError = wDictionary.clientErrorCodes[clientErrorCode] + System.Environment.NewLine;

            int isoErrorCode = (ex.errorCode >> 16) & 0xF;
            string isoError = String.Empty;
            if (isoErrorCode != 0)
                isoError = wDictionary.isoTcpErrorCodes[isoErrorCode] + System.Environment.NewLine;

            int tcpErrorCode = (ex.errorCode) & 0xFFFF;
            string tcpError = String.Empty;
            System.Net.Sockets.SocketError se;
            if (tcpErrorCode != 0)
            {
                se = (System.Net.Sockets.SocketError)tcpErrorCode;
                tcpError = se.ToString() + System.Environment.NewLine;
            }

            string error = ex.Message + System.Environment.NewLine;
            error = error + clientError + isoError + tcpError;

            Console.WriteLine(error + ex.errorCode.ToString("X8") + System.Environment.NewLine);

            //TODO Center this dialog in parent
            MessageBox.Show(error);
        }
Exemple #2
0
        private void showErrorForException(wPlcException ex)
        {
            int    clientErrorCode = (ex.errorCode >> 20) & 0xFFF;
            string clientError     = String.Empty;

            if (clientErrorCode != 0)
            {
                clientError = wDictionary.clientErrorCodes[clientErrorCode] + System.Environment.NewLine;
            }

            int    isoErrorCode = (ex.errorCode >> 16) & 0xF;
            string isoError     = String.Empty;

            if (isoErrorCode != 0)
            {
                isoError = wDictionary.isoTcpErrorCodes[isoErrorCode] + System.Environment.NewLine;
            }

            int    tcpErrorCode = (ex.errorCode) & 0xFFFF;
            string tcpError     = String.Empty;

            System.Net.Sockets.SocketError se;
            if (tcpErrorCode != 0)
            {
                se       = (System.Net.Sockets.SocketError)tcpErrorCode;
                tcpError = se.ToString() + System.Environment.NewLine;
            }

            string error = ex.Message + System.Environment.NewLine;

            error = error + clientError + isoError + tcpError;

            Console.WriteLine(error + ex.errorCode.ToString("X8") + System.Environment.NewLine);

            //TODO Center this dialog in parent
            MessageBox.Show(error);
        }