Exemplo n.º 1
0
        /// <summary>
        /// Registers an adapter to be managed by the proxy.
        /// </summary>
        /// <param name="adapter">The adapter to register.</param>
        public void RegisterAdapter(AdapterBase adapter)
        {
            if (!protocolDictionary.ContainsKey(adapter.ProtocolType))
            {
                protocolDictionary.Add(adapter.ProtocolType, new List <AdapterBase>());
            }
            else
            {
                throw new InvalidOperationException("Adapter already registered.");
            }

            List <AdapterBase> adapterCollection = protocolDictionary[adapter.ProtocolType];

            adapterCollection.Add(adapter);
            adapter.EndPointCreated   += new EventHandler <AdapterEndPointEventArgs>(EndPointCreatedEventHandler);
            adapter.EndPointDestroyed += new EventHandler <AdapterEndPointEventArgs>(EndPointDestroyedEventHandler);

            adapterDictionary.Add(adapter.AdapterId, adapter);
        }
Exemplo n.º 2
0
 /// <summary>
 ///     <para>Initializes an instance of the <see cref="AdapterEndPoint"/> class.</para>
 /// </summary>
 /// <param name="adapter">
 /// The Adapter which owns this endpoint.
 /// </param>
 /// <param name="uri">
 /// The URI respresented by this endpoint.
 /// </param>
 public AdapterEndPoint(AdapterBase adapter, Uri uri)
 {
     this.adapter = adapter;
     this.uri     = uri;
 }