Пример #1
0
        /// <summary>
        /// Lookups the error text for the specified error id.
        /// </summary>
        private string GetErrorText(OpcResult resultID)
        {
            if (ShowErrorTextMI.Checked)
            {
                // display nothing for ok results.
                if (resultID == OpcResult.S_OK)
                {
                    return("");
                }

                // check if text has already been fetched.
                string errorText = (string)m_errors[resultID];

                // fetch the error text from the server.
                if (errorText == null)
                {
                    try
                    {
                        errorText          = m_server.GetErrorText(m_locale, resultID);
                        m_errors[resultID] = errorText;
                    }
                    catch
                    {
                        errorText = null;
                    }
                }

                // return the result;
                return((errorText != null)?errorText:"");
            }

            // return the result id as a string.
            return(resultID.ToString());
        }
        /// <summary>
        /// Lookups the error text for the specified error id.
        /// </summary>
        private string GetErrorText(object subscriptionHandle, OpcResult resultID)
        {
            if (ShowErrorTextMI.Checked)
            {
                // display nothing for ok results.
                if (resultID == OpcResult.S_OK)
                {
                    return("");
                }

                // fetch the error text from the server.
                string errorText = null;

                try
                {
                    TsCDaSubscription subscription = (TsCDaSubscription)m_subscriptions[subscriptionHandle];
                    string            locale       = (subscription != null)?subscription.Locale:CultureInfo.CurrentCulture.Name;
                    errorText = m_server.GetErrorText(locale, resultID);
                }
                catch
                {
                    errorText = null;
                }

                // return the result;
                return((errorText != null)?errorText:"");
            }

            // return the result id as a string.
            return(resultID.ToString());
        }
Пример #3
0
        /// <summary>
        /// Lookups the error text for the specified error id.
        /// </summary>
        private string GetErrorText(OpcResult resultId)
        {
            if (showErrorTextMi_.Checked)
            {
                // display nothing for ok results.
                if (resultId == OpcResult.S_OK)
                {
                    return("");
                }

                // check if text has already been fetched.
                string errorText = (string)MErrors[resultId];

                // fetch the error text from the server.
                if (errorText == null)
                {
                    try
                    {
                        errorText         = MServer.GetErrorText(MLocale, resultId);
                        MErrors[resultId] = errorText;
                    }
                    catch
                    {
                        errorText = null;
                    }
                }

                // return the result;
                return((errorText != null)?errorText:"");
            }

            // return the result id as a string.
            return(resultId.ToString());
        }