Beispiel #1
0
        private void AddSeries(IThreadWrapper p_threadWrapper)
        {
            this.chart1.Series.SuspendUpdates();

            Color seriesColor = Color.FromArgb(255, SeriesColor.R, SeriesColor.G, SeriesColor.B);

            var newSeries = new Series
            {
                BorderColor     = seriesColor,
                BorderDashStyle = ChartDashStyle.Solid,
                ChartArea       = chart1.ChartAreas[0].Name,
                ChartType       = SeriesChartType.Column,
                Color           = seriesColor,
                LabelBackColor  = Color.Maroon,
                LabelForeColor  = Color.Lime,
                Legend          = "Legend1",
                Name            = "Thread +" + p_threadWrapper.ThreadId,
            };

            this.chart1.Series.Add(newSeries);

            chart1.ChartAreas.SuspendUpdates();

            for (int index = 0; index < ChartSize + 2; index++)
            {
                var dataPointIndex = newSeries.Points.AddXY(0, 0);
            }

            chart1.ChartAreas.ResumeUpdates();
            UpdateChart();
        }
 public void Kill(IThreadWrapper threadWrapper)
 {
     if (threadWrapper.IsAlive())
     {
         threadWrapper.Abort();
     }
 }
Beispiel #3
0
 internal ScheduledJob(
     TimeSpan interval, Action <CancellationToken> workItem, Action <CancellationToken> startupAction, IThreadWrapper worker)
 {
     _interval = interval;
     _workItem = workItem;
     _worker   = worker;
     _worker.Setup(Loop, startupAction);
 }
Beispiel #4
0
        internal AbstractProducer(IThreadWrapper worker, IStartupBarrier startupBarrier = null)
        {
            _worker = worker;
            _worker.Setup(Loop,
                          cancellationToken =>
            {
                Startup(AddWork, cancellationToken);

                startupBarrier?.Wait(cancellationToken);
            });
        }
Beispiel #5
0
 public Agent(
     IRules rulesService,
     IRulesWriter rulesWriter,
     IThreadWrapper thread,
     ILogger logger)
 {
     this.rulesService   = rulesService;
     this.rulesWriter    = rulesWriter;
     this.thread         = thread;
     this.log            = logger;
     this.updateRequired = false;
     this.rules          = new List <RuleApiModel>();
 }
Beispiel #6
0
 public DeviceGroupsClient(
     IHttpClient httpClient,
     IDevicesClient devices,
     IServicesConfig servicesConfig,
     ILogger logger,
     IThreadWrapper thread)
 {
     this.logger         = logger;
     this.httpClient     = httpClient;
     this.devices        = devices;
     this.baseUrl        = $"{servicesConfig.ConfigServiceUrl}/devicegroups";
     this.servicesConfig = servicesConfig;
     this.thread         = thread;
 }
        public Agent(
            IAsaStorage messages,
            IAsaStorage alarms,
            IServicesConfig config,
            IThreadWrapper thread,
            ILogger logger)
        {
            this.messages = messages;
            this.alarms   = alarms;
            this.thread   = thread;
            this.log      = logger;

            this.messages.Initialize(config.MessagesStorageType, config.MessagesCosmosDbConfig);
            this.alarms.Initialize(config.AlarmsStorageType, config.AlarmsCosmosDbConfig);
        }
 public Agent(
     IClusterNodes clusterNodes,
     IDevicePartitions partitions,
     ISimulations simulations,
     IThreadWrapper thread,
     IClusteringConfig clusteringConfig,
     ILogger logger)
 {
     this.clusterNodes       = clusterNodes;
     this.partitions         = partitions;
     this.simulations        = simulations;
     this.thread             = thread;
     this.log                = logger;
     this.checkIntervalMsecs = clusteringConfig.CheckIntervalMsecs;
     this.running            = false;
 }
        public void Run(IDataWebScraperConfiguration dataWebScraperConfiguration)
        {
            _webBrowserConfigurationRunnerProcessorWascompleted = false;
            WebBrowserConfigurationRunnerProcessor.WebBrowserConfigurationRunnerProcessorWasCompleted += WebBrowserConfigurationRunnerProcessor_WebBrowserConfigurationRunnerProcessorWasCompleted;

            _threadWrapper = ThreadWrapperFactory.GetThreadWrapper(new ParameterizedThreadStart(ProcessDataWebScraperconfigurationInWebBrowser));
            _threadWrapper.SetApartmentState(ApartmentState.STA);
            _threadWrapper.Start(dataWebScraperConfiguration);
            if (WaitForProcessToBeCompleted)
            {
                while (!_webBrowserConfigurationRunnerProcessorWascompleted)
                {
                    Thread.Sleep(1000);
                }
            }
        }
Beispiel #10
0
 public Agent(
     IDeviceGroupsWriter deviceGroupsWriter,
     IDeviceGroupsClient deviceGroupsClient,
     IEventProcessorHostWrapper eventProcessorHostWrapper,
     IEventProcessorFactory deviceEventProcessorFactory,
     IEventHubStatus eventHubStatus,
     IServicesConfig servicesConfig,
     IBlobStorageConfig blobStorageConfig,
     ILogger logger,
     IThreadWrapper thread)
 {
     this.log = logger;
     this.deviceGroupsWriter          = deviceGroupsWriter;
     this.deviceGroupsClient          = deviceGroupsClient;
     this.eventProcessorHostWrapper   = eventProcessorHostWrapper;
     this.deviceEventProcessorFactory = deviceEventProcessorFactory;
     this.eventHubStatus    = eventHubStatus;
     this.servicesConfig    = servicesConfig;
     this.blobStorageConfig = blobStorageConfig;
     this.deviceGroupDefinitionDictionary = new Dictionary <string, string>();
     this.thread = thread;
 }
 public Agent(
     IClusterNodes clusterNodes,
     IDevicePartitions partitions,
     ISimulations simulations,
     IThreadWrapper thread,
     IClusteringConfig clusteringConfig,
     IFactory factory,
     ILogger logger,
     IAzureManagementAdapterClient azureManagementAdapter)
 {
     this.clusterNodes           = clusterNodes;
     this.partitions             = partitions;
     this.simulations            = simulations;
     this.thread                 = thread;
     this.factory                = factory;
     this.log                    = logger;
     this.azureManagementAdapter = azureManagementAdapter;
     this.clusteringConfig       = clusteringConfig;
     this.checkIntervalMsecs     = clusteringConfig.CheckIntervalMsecs;
     this.running                = false;
     this.currentNodeCount       = DEFAULT_NODE_COUNT;
 }
Beispiel #12
0
 internal TestProducer(IThreadWrapper threadWrapper) : base(threadWrapper)
 {
 }
Beispiel #13
0
 internal Consumer(Func <CancellationToken, IWorkItem> takeWork, IThreadWrapper threadWrapper)
 {
     _takeWork      = takeWork;
     _threadWrapper = threadWrapper;
     _threadWrapper.Setup(Loop);
 }