コード例 #1
0
       public ResourcePoller(Resource res, int pollingIterval)
       {
            ResourceFactory resFactory = new ResourceFactory();
            PollingInterval = Math.Abs(pollingIterval);
            Resource = res;

       }
コード例 #2
0
        public void Configuration(IAppBuilder app)
        {
            // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888
            List<Resource> resources = new List<Resource>();
            var hubConfiguration = new HubConfiguration();
            hubConfiguration.EnableDetailedErrors = true;
            app.MapSignalR(hubConfiguration);
            System.Configuration.ConfigurationManager
                .AppSettings["resources"]
                .Split(',')
                .ToList()
                .ForEach(s =>
                {
                    Resource r = new ResourceFactory().GetResource(s);
                    if (r != null)
                        resources.Add(new ResourceFactory().GetResource(s));
                    
                }); 

            StateMonitor monitor = new StateMonitor(20000, resources);
            Task.Factory.StartNew(async() => await monitor.Init());

            
        }