public static NodeConnection BuildWith(FieldIdentifier Code)
        {
            //build fields
            Dictionary <FieldIdentifier, FieldBase> mutableFields =
                new Dictionary <FieldIdentifier, FieldBase>();

            mutableFields.Add(new FieldIdentifier(m_CodeName), Code);

            //build children
            KeyedNodeCollection <NodeBase> mutableChildren =
                new KeyedNodeCollection <NodeBase>();

            //build node
            NodeConnection Builder = new NodeConnection(
                new ReadOnlyDictionary <FieldIdentifier, FieldBase>(mutableFields),
                new ReadOnlyCollection <NodeBase>(mutableChildren));

            return(Builder);
        }
        public static NodeConnection BuildWith(FieldIdentifier Code)
        {
            //build fields
            Dictionary<FieldIdentifier, FieldBase> mutableFields =
                new Dictionary<FieldIdentifier, FieldBase>();
            mutableFields.Add(new FieldIdentifier(m_CodeName), Code);

            //build children
            KeyedNodeCollection<NodeBase> mutableChildren =
                new KeyedNodeCollection<NodeBase>();

            //build node
            NodeConnection Builder = new NodeConnection(
                new ReadOnlyDictionary<FieldIdentifier, FieldBase>(mutableFields),
                new ReadOnlyCollection<NodeBase>(mutableChildren));

            return Builder;
        }
 private void stopOutgoingConnection()
 {
     int port = Properties.Settings.Default.PortNumber;
     if (!Properties.Settings.Default.RunAsService)
     {
         port = 0;
     }
     if (port != m_port)
     {
         if (m_port > 0 && m_outgoingConnection != null)
         {
             // stop existing connection
             m_outgoingConnection.Close();
             m_outgoingConnection = null;
         }
     }
 }
 private void newOutgoingConnection()
 {
     int port = Properties.Settings.Default.PortNumber;
     if (!Properties.Settings.Default.RunAsService)
     {
         port = 0;
     }
     if (port != m_port)
     {
         if (port > 0)
         {
             m_port = port;
             m_outgoingConnection = CommunicationManager.StartOutgoingConnection(
                 new FieldIdentifier("test"), "localhost", port);
             var remoteList = m_outgoingConnection.RegisterRemotePeerListChangedCallback(
                 new NodeConnection.RemotePeerListChangedHandler(
                     delegate(NodePeerList remotePeerList)
                     {
                         runtimeType.Value.SetLocalRuntimePeer(remotePeerList);
                     }
             ));
             runtimeType.Value.SetLocalRuntimePeer(remoteList);
         }
     }
 }