예제 #1
0
        public POCViewModel(IWebSocketClient client, string clientName, BoundingBoxRequest bbr, string clientIndex)
        {
            this.client     = client;
            this.ClientName = clientName;
            IDToEntity      = new Dictionary <string, Entity>();

            triggerStatisticsCollector        = new NumberStatisticsCollector();
            redisStatisticsCollector          = new NumberStatisticsCollector();
            entitiesAmountStatisticsCollector = new NumberStatisticsCollector();

            csvExporter = new CsvHelperCsvExporter(clientIndex);

            generator = new ZoomChangeGenerator(this, bbr);
            generator.Start();

            workQueue = new BlockingCollection <DistributionWorkItem>();
            workers   = new List <DistributionWorker>();

            for (int i = 0; i < ConfigData.Instance.Workers; i++)
            {
                var worker = new DistributionWorker(client, triggerStatisticsCollector, redisStatisticsCollector, entitiesAmountStatisticsCollector, workQueue);
                workers.Add(worker);
                worker.Start();
            }
        }
예제 #2
0
        private void Dispose(bool disposing)
        {
            if (disposing)
            {
                generator.Stop();
                generator = null;

                client.Dispose();
                client = null;

                foreach (var worker in workers)
                {
                    worker.Stop();
                }

                workers.Clear();

                CreateCSVs();
            }
        }