private void BrowseCTRL_ItemsSelected(object sender, NodesSelectedEventArgs e) { try { foreach (ReferenceDescription reference in e.References) { if (reference.ReferenceTypeId == ReferenceTypeIds.HasProperty || reference.IsForward) { WriteValuesCTRL.AddValue(reference); } } } catch (Exception exception) { GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception); } }
/// <summary> /// Displays the dialog. /// </summary> public void Show(Session session, WriteValueCollection values) { if (session == null) { throw new ArgumentNullException("session"); } m_session = session; BrowseCTRL.SetView(m_session, BrowseViewType.Objects, null); WriteValuesCTRL.Initialize(session, values); MoveBTN_Click(BackBTN, null); Show(); BringToFront(); }
/// <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); }
/// <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); }