Beispiel #1
0
        private void WatcherHubFound(Object Sender, Int64 Address, String Name)
        {
            // First, check that we are not connected to the HUB.
            if (!FHubs.ContainsKey(Address))
            {
                // Query application about interest of this HUB.
                Boolean Connect;
                DoHubFound(Address, Name, out Connect);
                if (Connect)
                {
                    // Prepare HUB object.
                    wclWeDoHub Hub = new wclWeDoHub();
                    // Setup HUB events.
                    Hub.OnConnected    += HubConnected;
                    Hub.OnDisconnected += HubDisconnected;

                    // Try to connect to the given HUB.
                    if (Hub.Connect(FRadio, Address) == wclErrors.WCL_E_SUCCESS)
                    {
                        // If operation started with success add HUB to the list to prevent
                        // From adding it one more time.
                        FHubs.Add(Address, Hub);
                    }
                }
            }
        }