/// <summary> /// Changes the browse position. /// </summary> /// <param name="direction">The direction.</param> /// <param name="name">The name.</param> /// <returns>True if the operation was successful.</returns> private bool ChangeBrowsePosition(OPCBROWSEDIRECTION direction, string name) { string methodName = "IOPCBrowseServerAddressSpace.ChangeBrowsePosition"; try { IOPCBrowseServerAddressSpace server = BeginComCall <IOPCBrowseServerAddressSpace>(methodName, true); server.ChangeBrowsePosition(direction, name); } catch (Exception e) { if (ComUtils.IsUnknownError(e, ResultIds.E_FAIL, ResultIds.E_INVALIDARG)) { ComCallError(methodName, e); } return(false); } finally { EndComCall(methodName); } return(true); }
public void ChangeBrowsePosition(OPCBROWSEDIRECTION direction, string name) { try { ifBrowse.ChangeBrowsePosition(direction, name); } catch (Exception ex) { throw (new Exception("ChangeBrowsePosition执行错误,不存在节点“" + name + "”,具体错误信息:" + ex.ToString())); } }
public void ChangeBrowsePosition(OPCBROWSEDIRECTION dwBrowseDirection, string szString) { var methodName = nameof(IOPCBrowseServerAddressSpace) + "." + nameof(IOPCBrowseServerAddressSpace.ChangeBrowsePosition); try { var server = BeginComCall <IOPCBrowseServerAddressSpace>(methodName, true); server.ChangeBrowsePosition(dwBrowseDirection, szString); } finally { EndComCall(methodName); } }
public void ChangeBrowsePosition(OPCBROWSEDIRECTION direction, string name) { this.ifBrowse.ChangeBrowsePosition(direction, name); }
/// <summary> /// Change the current browse position. /// </summary> /// <param name="direction">Browse direction</param> /// <param name="name"></param> public void ChangeBrowsePosition(OPCBROWSEDIRECTION direction, string name) { ThrowIfDisposed(); opcBrowseServer.ChangeBrowsePosition(direction, name); }
void IOPCBrowseServerAddressSpace.ChangeBrowsePosition([In, MarshalAs(UnmanagedType.U4)] OPCBROWSEDIRECTION dwBrowseDirection, [In, MarshalAs(UnmanagedType.LPWStr)] string szName) { }
/// <summary> /// Changes the browse position. /// </summary> /// <param name="direction">The direction.</param> /// <param name="name">The name.</param> /// <returns>True if the operation was successful.</returns> private bool ChangeBrowsePosition(OPCBROWSEDIRECTION direction, string name) { string methodName = "IOPCBrowseServerAddressSpace.ChangeBrowsePosition"; try { IOPCBrowseServerAddressSpace server = BeginComCall<IOPCBrowseServerAddressSpace>(methodName, true); server.ChangeBrowsePosition(direction, name); } catch (Exception e) { if (ComUtils.IsUnknownError(e, ResultIds.E_FAIL, ResultIds.E_INVALIDARG)) { ComCallError(methodName, e); } return false; } finally { EndComCall(methodName); } return true; }
public void ChangeBrowsePosition(OPCBROWSEDIRECTION dwBrowseDirection, string szString) { OpcCom.Da.Wrapper.Server server; Monitor.Enter(server = this); try { BrowseElement element; BrowseFilters filters = new BrowseFilters { MaxElementsReturned = 0, BrowseFilter = browseFilter.all, ElementNameFilter = null, VendorFilter = null, ReturnAllProperties = false, PropertyIDs = null, ReturnPropertyValues = false }; ItemIdentifier itemID = null; Opc.Da.BrowsePosition position = null; switch (dwBrowseDirection) { case OPCBROWSEDIRECTION.OPC_BROWSE_UP: if (this.m_browseStack.Count == 0) { throw CreateException(-2147467259); } goto Label_0146; case OPCBROWSEDIRECTION.OPC_BROWSE_DOWN: if ((szString == null) || (szString.Length == 0)) { throw CreateException(-2147024809); } goto Label_00F4; case OPCBROWSEDIRECTION.OPC_BROWSE_TO: if ((szString != null) && (szString.Length != 0)) { break; } this.m_browseStack.Clear(); goto Label_0179; default: goto Label_0179; } itemID = new ItemIdentifier(szString); BrowseElement[] elementArray = null; try { elementArray = this.m_server.Browse(itemID, filters, out position); } catch (Exception) { throw CreateException(-2147024809); } if ((elementArray == null) || (elementArray.Length == 0)) { throw CreateException(-2147024809); } this.m_browseStack.Clear(); this.m_browseStack.Push(null); this.m_browseStack.Push(itemID); goto Label_0179; Label_00F4: element = this.FindChild(szString); if ((element == null) || !element.HasChildren) { throw CreateException(-2147024809); } this.m_browseStack.Push(new ItemIdentifier(element.ItemName)); goto Label_0179; Label_0146: itemID = (ItemIdentifier)this.m_browseStack.Pop(); if ((this.m_browseStack.Count > 0) && (this.m_browseStack.Peek() == null)) { this.BuildBrowseStack(itemID); } Label_0179: if (position != null) { position.Dispose(); position = null; } } catch (Exception exception) { throw CreateException(exception); } finally { Monitor.Exit(server); } }
public void ChangeBrowsePosition(OPCBROWSEDIRECTION dwBrowseDirection, string szString) { lock (this) { try { BrowseFilters browseFilters = new BrowseFilters(); browseFilters.MaxElementsReturned = 0; browseFilters.BrowseFilter = browseFilter.all; browseFilters.ElementNameFilter = null; browseFilters.VendorFilter = null; browseFilters.ReturnAllProperties = false; browseFilters.PropertyIDs = null; browseFilters.ReturnPropertyValues = false; ItemIdentifier itemIdentifier = null; Opc.Da.BrowsePosition position = null; switch (dwBrowseDirection) { case OPCBROWSEDIRECTION.OPC_BROWSE_TO: { if (szString == null || szString.Length == 0) { m_browseStack.Clear(); break; } itemIdentifier = new ItemIdentifier(szString); BrowseElement[] array = null; try { array = m_server.Browse(itemIdentifier, browseFilters, out position); } catch (Exception) { throw CreateException(-2147024809); } if (array == null || array.Length == 0) { throw CreateException(-2147024809); } m_browseStack.Clear(); m_browseStack.Push(null); m_browseStack.Push(itemIdentifier); break; } case OPCBROWSEDIRECTION.OPC_BROWSE_DOWN: { if (szString == null || szString.Length == 0) { throw CreateException(-2147024809); } BrowseElement browseElement = FindChild(szString); if (browseElement == null || !browseElement.HasChildren) { throw CreateException(-2147024809); } m_browseStack.Push(new ItemIdentifier(browseElement.ItemName)); break; } case OPCBROWSEDIRECTION.OPC_BROWSE_UP: if (m_browseStack.Count == 0) { throw CreateException(-2147467259); } itemIdentifier = (ItemIdentifier)m_browseStack.Pop(); if (m_browseStack.Count > 0 && m_browseStack.Peek() == null) { BuildBrowseStack(itemIdentifier); } break; } if (position != null) { position.Dispose(); position = null; } } catch (Exception e) { throw CreateException(e); } } }
public void ChangeBrowsePosition( OPCBROWSEDIRECTION direction, string name ) { ifBrowse.ChangeBrowsePosition( direction, name ); }
public void ChangeBrowsePosition(OPCBROWSEDIRECTION browseDirection, string itemNameOrId = "") { DoComCall(ComObject, "IOPCBrowseServerAddressSpace::ChangeBrowsePosition", () => ComObject.ChangeBrowsePosition(browseDirection, itemNameOrId ?? ""), browseDirection, itemNameOrId); }
public void ChangeBrowsePosition(OPCBROWSEDIRECTION dwBrowseDirection, string szString) { var methodName = nameof(IOPCBrowseServerAddressSpace) + "." + nameof(IOPCBrowseServerAddressSpace.ChangeBrowsePosition); try { var server = BeginComCall<IOPCBrowseServerAddressSpace>(methodName, true); server.ChangeBrowsePosition(dwBrowseDirection, szString); } finally { EndComCall(methodName); } }