示例#1
0
        /// <summary>
        /// Writes the valus to the server.
        /// </summary>
        private void Write()
        {
            WriteValueCollection nodesToWrite = Utils.Clone(WriteValuesCTRL.GetValues()) as WriteValueCollection;

            if (nodesToWrite == null || nodesToWrite.Count == 0)
            {
                return;
            }

            foreach (WriteValue nodeToWrite in nodesToWrite)
            {
                NumericRange  indexRange;
                ServiceResult result = NumericRange.Validate(nodeToWrite.IndexRange, out indexRange);

                if (ServiceResult.IsGood(result) && indexRange != NumericRange.Empty)
                {
                    // apply the index range.
                    object valueToWrite = nodeToWrite.Value.Value;

                    result = indexRange.ApplyRange(ref valueToWrite);

                    if (ServiceResult.IsGood(result))
                    {
                        nodeToWrite.Value.Value = valueToWrite;
                    }
                }
            }

            StatusCodeCollection     results         = null;
            DiagnosticInfoCollection diagnosticInfos = null;

            ResponseHeader responseHeader = m_session.Write(
                null,
                nodesToWrite,
                out results,
                out diagnosticInfos);

            ClientBase.ValidateResponse(results, nodesToWrite);
            ClientBase.ValidateDiagnosticInfos(diagnosticInfos, nodesToWrite);

            WriteResultsCTRL.ShowValue(results, true);
        }
示例#2
0
        /// <summary>
        /// Writes the valus to the server.
        /// </summary>
        private void Write()
        {
            WriteValueCollection nodesToWrite = WriteValuesCTRL.GetValues();

            if (nodesToWrite == null || nodesToWrite.Count == 0)
            {
                return;
            }

            StatusCodeCollection     results         = null;
            DiagnosticInfoCollection diagnosticInfos = null;

            ResponseHeader responseHeader = m_session.Write(
                null,
                nodesToWrite,
                out results,
                out diagnosticInfos);

            ClientBase.ValidateResponse(results, nodesToWrite);
            ClientBase.ValidateDiagnosticInfos(diagnosticInfos, nodesToWrite);

            WriteResultsCTRL.ShowValue(results, true);
        }