private void OnNodeConnected(object sender, NodeConnectedEventArgs e) { try { _productCache.AddTail(e); } catch (System.Exception) { } }
void ISaiConnectionObserver.OnSaiConnected(uint localID, uint remoteID) { try { if (this.NodeConnected != null) { var args = new NodeConnectedEventArgs(localID, remoteID); this.NodeConnected(null, args); } } catch (System.Exception) { } }
private void OnNodeConnected(object sender, NodeConnectedEventArgs args) { try { this.Invoke(new Action(() => { clbDests.Items.Add(args.RemoteID); if (clbDests.Items.Count == 1) { clbDests.SetItemCheckState(0, CheckState.Checked); } })); } catch (Exception ex) { LogUtility.Error(ex); } }
private void ShowNodeConnectedEvent(NodeConnectedEventArgs args) { try { this.Invoke(new Action(() => { // 添加 var fixedName = this.DecorateDeviceID(args.RemoteID); this.AddSelectableDevice(fixedName); // 添加/查找Device节点 TreeNode theRemoteNode = null; // 更新网络状态图 var nodeDevice = this.treeViewNetwork.Nodes.Find(args.RemoteID.ToString(), false); if (nodeDevice.Length != 0) { theRemoteNode = nodeDevice[0]; } else { if (args.RemoteID == this.SiblingID) { theRemoteNode = this.AddSibling(args.RemoteID); } else { theRemoteNode = this.AddClient(args.RemoteID); } } theRemoteNode.ImageKey = "DeviceOnline"; theRemoteNode.SelectedImageKey = "DeviceOnline"; theRemoteNode.ForeColor = Color.Blue; })); } catch (System.Exception ex) { this.ShowLog(ex.Message); } }
/// <summary> /// Triggers the <see cref="NodeConnected"/> event asynchronously. /// </summary> /// <param name="eventArgs">the event arguments</param> /// <returns>a task that represents the asynchronous operation</returns> protected virtual Task OnNodeConnectedAsync(NodeConnectedEventArgs eventArgs) => NodeConnected.InvokeAsync(this, eventArgs);
private static void DiscoveryService_NodeConnected(object sender, NodeConnectedEventArgs e) { Console.WriteLine("Node conneced"); _resetNodeAdded.Set(); }