Beispiel #1
0
        private void masterBlobsHaveAdded(List <Bitmap> blobs)
        {
            try
            {
#if (DEMO)
                DateTime timeTotal = DateTime.Now;
#endif
//                lock (listMaster)/**/
                {
                    foreach (var bitmap  in blobs)
                    {
#if (DEMO)
                        Flokal.Protocol.Logging.Trace($"FormLifeMS.masterBlobsHaveAdded(...)", "Clone time", timeTotal);
#endif
                        dtsetprocess = ((blob_tag)bitmap.Tag).time;
                        bvMaster.Add(bitmap);
#if (DEMO)
                        listMaster.Add(((blob_tag)bitmap.Tag).check);
                        DateTime timeValve = DateTime.Now;
#endif
                        ((blob_tag)bitmap.Tag).valve = currValve = valves.calc(bitmap, true);
#if (DEMO)
                        Flokal.Protocol.Logging.Trace($"FormLifeMS.masterBlobsHaveAdded(...)", "Valve time", timeValve);
                        DateTime timeBlow = DateTime.Now;
#endif
                        if (!isDetectItensivity && ((blob_tag)bitmap.Tag).check)
                        {
                            ((blob_tag)bitmap.Tag).blowInterval = cfg.Blow;

                            var task = new BackgroundWorker();
                            task.DoWork += new DoWorkEventHandler(doBackgroundBlow);
                            task.RunWorkerAsync(bitmap.Tag);

                            sumIntesitiveSampleMasterBad += ((blob_tag)bitmap.Tag).intensivity;
                            countSampleMasterBad++;
                        }
                        else
                        {
                            sumIntesitiveSampleMasterGood += ((blob_tag)bitmap.Tag).intensivity;
                            countSampleMasterGood++;
                        }
#if (DEMO)
                        Flokal.Protocol.Logging.Trace($"FormLifeMS.masterBlobsHaveAdded(...)", "Blow time", timeBlow);
#endif
                    }
                }
#if (DEMO)
                Flokal.Protocol.Logging.Trace($"FormLifeMS.masterBlobsHaveAdded(...)", "Total time", timeTotal);
#endif
            }
            catch (Exception e)
            {
                Flokal.Protocol.Logging.Error("FormLifeMS.masterBlobsHaveAdded(...): " + e.Message);
                throw;
            }
        }
Beispiel #2
0
        private void slaveBlobsHaveAdded(List <Bitmap> blobs)
        {
            long count = bvSlave.Blobs.Count;

            try
            {
#if (DEMO)
                DateTime timeTotal = DateTime.Now;
#endif
                lock (listSlave)
                {
                    foreach (var bitmap in blobs)
                    {
                        bvSlave.Add(bitmap);
#if (DEMO)
                        listSlave.Add(((blob_tag)bitmap.Tag).check);
#endif
                        ((blob_tag)bitmap.Tag).valve = currValve = valves.calc(bitmap, false);

#if (!DEMO)
                        if (!isDetectItensivity && ((blob_tag)bitmap.Tag).check)
                        {
                            ((blob_tag)bitmap.Tag).blowInterval = cfg.BlowInterval;

                            var task = new BackgroundWorker();
                            task.DoWork += new DoWorkEventHandler(doBackgroundBlow);
                            task.RunWorkerAsync(bitmap.Tag);

                            sumIntesitiveSampleSlaveBad += ((blob_tag)bitmap.Tag).intensivity;
                            countSampleSlaveBad++;
                        }
                        else
                        {
                            sumIntesitiveSampleSlaveGood += ((blob_tag)bitmap.Tag).intensivity;
                            countSampleSlaveGood++;
                        }
#endif
                        //                        if (!timerSYNC_MS.Enabled)
                        //                        {
                        //                            timerSYNC_MS.Start();
                        //                        }
                    }
                }
#if (DEMO)
                Flokal.Protocol.Logging.Trace($"FormLifeMS.SLAVEBlobsHaveAdded(...)", "Total time", timeTotal);
#endif
            }
            catch (Exception e)
            {
                Flokal.Protocol.Logging.Error("FormLifeMS.SlaveBlobsHaveAdded(...): " + e.Message);
                throw;
            }
        }