Exemple #1
0
        public MetaService()
        {
            ServiceState.RegisterStartupCondition(STARTUP_CONDITION);

            CompositionHinter hinter = new CompositionHinter(new ZeroconfDiscoverer());

            hinter.StartDiscovery();
            publishers = hinter.GetAvailablePublishers();
            detector   = new CachingServiceDetector(new AdhocServiceDetector(hinter), hinter);

            initialized           = false;
            ServiceState.Started += delegate()
            {
                initialized = true;
            };

            Task.Factory.StartNew(delegate()
            {
                // give it some time to detect all service sets
                Thread.Sleep(5000);
                foreach (var publisher in publishers)
                {
                    publisher.Detector = detector;
                    publisher.PublishAsync();
                }
                ServiceState.StartupConditionCompleted(STARTUP_CONDITION);
            });

            accessRequests = new AccessRequests();
        }