public CamService(CamWindow camWindow)
 {
     this.camWindow   = camWindow;
     logger           = MainWindow.ServiceContainer.Resolve <Logger>();
     drawService      = MainWindow.ServiceContainer.Resolve <DrawService>();
     configService    = MainWindow.ServiceContainer.Resolve <ConfigService>();
     runtimeCapturing = configService.Read <bool>("RuntimeCapturingCheckBox");
     withDetection    = configService.Read <bool>("WithDetectionCheckBox");
     surfacePoint1    = new PointF();
     surfacePoint2    = new PointF();
     camNumber        = camWindow.camNumber;
     setupPoint       = new PointF(configService.Read <float>($"Cam{camNumber}X"),
                                   configService.Read <float>($"Cam{camNumber}Y"));
     resolutionWidth  = configService.Read <int>("ResolutionWidth");
     resolutionHeight = configService.Read <int>("ResolutionHeight");
     movesExtraction  = configService.Read <int>("MovesExtraction");
     movesDart        = configService.Read <int>("MovesDart");
     movesNoise       = configService.Read <int>("MovesNoise");
     smoothGauss      = configService.Read <int>("SmoothGauss");
     toCamDistance    = configService.Read <double>($"ToCam{camNumber}Distance");
     toBullAngle      = MeasureService.FindAngle(setupPoint, drawService.projectionCenterPoint);
     videoCapture     = new VideoCapture(GetCamIndex(camNumber), VideoCapture.API.DShow);
     videoCapture.SetCaptureProperty(CapProp.FrameWidth, resolutionWidth);
     videoCapture.SetCaptureProperty(CapProp.FrameHeight, resolutionHeight);
     GetSlidersData();
     RefreshImageBoxes();
 }
        private Throw PrepareThrowData(PointF poi)
        {
            var sectors = new List <int>()
            {
                14, 9, 12, 5, 20,
                1, 18, 4, 13, 6,
                10, 15, 2, 17, 3,
                19, 7, 16, 8, 11
            };
            var angle    = MeasureService.FindAngle(drawService.projectionCenterPoint, poi);
            var distance = MeasureService.FindDistance(drawService.projectionCenterPoint, poi);
            var sector   = 0;
            var type     = ThrowType.Single;

            if (distance >= drawService.projectionCoefficent * 95 &&
                distance <= drawService.projectionCoefficent * 105)
            {
                type = ThrowType.Tremble;
            }
            else if (distance >= drawService.projectionCoefficent * 160 &&
                     distance <= drawService.projectionCoefficent * 170)
            {
                type = ThrowType.Double;
            }

            // Find sector
            if (distance <= drawService.projectionCoefficent * 7)
            {
                sector = 50;
                type   = ThrowType.Bull;
            }
            else if (distance > drawService.projectionCoefficent * 7 &&
                     distance <= drawService.projectionCoefficent * 17)
            {
                sector = 25;
                type   = ThrowType._25;
            }
            else if (distance > drawService.projectionCoefficent * 170)
            {
                sector = 0;
                type   = ThrowType.Zero;
            }
            else
            {
                var startRadSector = -2.9845105;
                var radSectorStep  = 0.314159;
                var radSector      = startRadSector;
                foreach (var proceedSector in sectors)
                {
                    if (angle >= radSector && angle < radSector + radSectorStep)
                    {
                        sector = proceedSector;
                        break;
                    }

                    sector = 11; // todo - works, but not looks pretty

                    radSector += radSectorStep;
                }
            }

            return(new Throw(poi, sector, type, drawService.projectionFrameSide));
        }