public AboutTabViewModel(DataContext dataContext,
                          IDbService dbService,
                          ILogger logger,
                          IConfigService configService,
                          DrawService drawService,
                          IMessageBoxService messageBoxService,
                          CamsDetectionBoard camsDetectionBoard,
                          IDetectionService detectionService)
     : base(dataContext, dbService, logger, configService, drawService, messageBoxService, camsDetectionBoard, detectionService)
 {
 }
        private void RegisterContainer()
        {
            logger.Debug("Services container register start");

            var cb = new ContainerBuilder();

            cb.Register(r => logger).AsSelf().SingleInstance();

            cb.Register(r => telemetryWriter).AsSelf().SingleInstance();

            var messageBoxService = new MessageBoxService();

            cb.Register(r => messageBoxService).AsSelf().SingleInstance();

            var dbService = new DBService();

            cb.Register(r => dbService).AsSelf().SingleInstance();

            var configService = new ConfigService(logger, dbService);

            cb.Register(r => configService).AsSelf().SingleInstance();

            var versionChecker = new VersionChecker(dbService, configService, messageBoxService);

            cb.Register(r => versionChecker).AsSelf().SingleInstance();

            var scoreBoardService = new ScoreBoardService();

            cb.Register(r => scoreBoardService).AsSelf().SingleInstance();

            var drawService = new DrawService(this, configService, logger);

            cb.Register(r => drawService).AsSelf().SingleInstance();

            var throwService = new ThrowService(drawService, logger);

            cb.Register(r => throwService).AsSelf().SingleInstance();

            var detectionService = new DetectionService(this, drawService, configService, throwService, logger);

            cb.Register(r => detectionService).AsSelf().SingleInstance();

            var manualThrowPanel = new ManualThrowPanel(logger, detectionService);

            cb.Register(r => manualThrowPanel).AsSelf().SingleInstance();

            var gameService = new GameService(this, scoreBoardService, detectionService, configService, drawService, logger, dbService);

            cb.Register(r => gameService).AsSelf().SingleInstance();

            ServiceContainer = cb.Build();

            logger.Debug("Services container register end");
        }
Example #3
0
        public bool isClosingDraw(long pGroupId, DateTime pDrawDate)
        {
            bool        isClosing   = false;
            DrawService drawService = new DrawService();

            if (drawService.isDrawClosed(pGroupId, pDrawDate))
            {
                isClosing = true;
            }
            return(isClosing);
        }
Example #4
0
        public StatisticForm(StatisticService current, DrawService drawing)
        {
            InitializeComponent();
            service = current;
            draw    = drawing;

            this.chart1.ChartAreas[0].AxisX.Title = "ітерація";
            this.chart1.ChartAreas[0].AxisY.Title = "кількість агентів";

            DataBinding();
        }
        public void DrawMap_WHEN_InvokedWithMapWithoutShoots_THEN_ReturnMapConvertedToStringWithProperChars()
        {
            IDrawService drawService = new DrawService();
            var          map         = new Map(10, 10);
            var          textMap     = drawService.DrawMap(map);

            textMap.Length.Should().BePositive();
            textMap.Should().NotContain("x");
            textMap.Should().NotContain("o");
            textMap.Should().Contain("+");
        }
Example #6
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var connectionFactory = new ConnectionFactory();

            var lotteryGameRepository = new LotteryGameRepository(connectionFactory);
            var drawRepository        = new DrawRepository(connectionFactory);
            var drawService           = new DrawService(drawRepository);
            var lotteryWindow         = new LotteryWindow(lotteryGameRepository, drawRepository, drawService);

            lotteryWindow.Show();
        }
Example #7
0
        /// <summary>
        /// Запуск игры
        /// </summary>
        public JsonResult Start(string settings)
        {
            GameState gameState = new GameState();

            var gameSettings = JsonHelper.DeserialiazeWithType <GameSettings>(settings);


            IPlayer[] gamePlayers = new IPlayer[4];
            int       index       = 0;

            foreach (var pl in gameSettings.players)
            {
                switch (pl)
                {
                case "robot":
                    gamePlayers[index++] = new SmartPlayer();
                    break;

                case "human":
                    gamePlayers[index++] = new WebHumanPlayer();
                    break;

                default:
                    gamePlayers[index++] = new SmartPlayer2();
                    break;
                }
            }

            while (index < 4)
            {
                gamePlayers[index++] = new SmartPlayer();
            }

            if (!gameSettings.mapId.HasValue)
            {
                gameSettings.mapId = new Random().Next();
            }

            gameState.board = new Board(gamePlayers, gameSettings.mapId.Value);
            gameState.game  = new Game(gamePlayers, gameState.board);

            Session["test"] = gameState;

            var service = new DrawService();
            var map     = service.Map(gameState.board);

            return(Json(new {
                gamename = "test",
                map = map,
                mapId = gameSettings.mapId.Value,
                stat = service.GetStatistics(gameState.game)
            }));
        }
Example #8
0
        public void AddParticipant_SingleParticipant_ReturnsParticipantAdded()
        {
            // Arrange
            var drawService = new DrawService();

            // Act
            var expected = "participant_one";

            drawService.AddParticipant(expected);

            // Assert
            Assert.Equal(expected, drawService.GetParticipants()[0]);
        }
Example #9
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var context = new LotteryContext();

            context.CreateOrUpdateDatabase();

            var lotteryGameRepository = new LotteryGameRepository(context);
            var drawRepository        = new DrawRepository(context);
            var drawService           = new DrawService(drawRepository);
            var lotteryWindow         = new LotteryWindow(lotteryGameRepository, drawRepository, drawService);

            lotteryWindow.Show();
        }
Example #10
0
        /// <summary>
        /// Basic initializing.
        /// </summary>
        protected override void Initialize()
        {
#if DX
            _Editor = new DrawService(_graphicsDeviceService, SwapChainRenderTarget);

            SwapChainRenderTargetRefreshed -= DrawWindow_UpdateSwapChainRenderTarget;
            SwapChainRenderTargetRefreshed += DrawWindow_UpdateSwapChainRenderTarget;
            MultiSampleCountRefreshed      -= DrawWindow_UpdateMultiSampleCount;
            MultiSampleCountRefreshed      += DrawWindow_UpdateMultiSampleCount;
#elif GL
            _Editor = new DrawService(_graphicsDeviceService, SwapChainRenderTarget);
#endif
            _Editor.Initialize();
        }
Example #11
0
        public void CreateLine(ILineModel line)
        {
            GameObject currentLine = Instantiate(DrawService.GetLinePrefab(), Vector3.zero, Quaternion.identity);

            currentLine.transform.SetParent(DrawService.GetRoot3D().transform, false);
            LineRenderer lineRenderer = currentLine.GetComponent <LineRenderer>();

            lineRenderer.sharedMaterial = new Material(DrawService.GetLineMaterial());
            lineRenderer.positionCount  = line.KochLineProperty.OriginalPositions.Length;
            lineRenderer.SetPositions(line.KochLineProperty.OriginalPositions);
            line.LineGameObject = lineRenderer;
            _lines.Add(line.Guid, line);
            UpdateLine((LineModel)line);
        }
Example #12
0
        public override async void Execute()
        {
            await Task.Delay(1000);

            ViewManager.Initialize();
            SaveManager.Initialize();
            ShortcutService.Initialize();
            BrushService.Initialize();
            DrawService.Initialize();
            BackgroundService.Initialize();
            CameraService.Initialize();
            ProjectService.Initialize();
            AudioPeerService.Initialize();
        }
 public PlayerTabViewModel(DataContext dataContext,
                           ILogger logger,
                           IConfigService configService,
                           DrawService drawService,
                           IDbService dbService,
                           IMessageBoxService messageBoxService,
                           CamsDetectionBoard camsDetectionBoard,
                           IDetectionService detectionService)
     : base(dataContext, dbService, logger, configService, drawService, messageBoxService, camsDetectionBoard, detectionService)
 {
     ChooseNewPlayerAvatarCommand = new ChooseNewPlayerAvatarCommand(SelectAvatarImage);
     SaveNewPlayerCommand         = new SaveNewPlayerCommand(SaveNewPlayer);
     PlayerStatisticsLoadCommand  = new PlayerStatisticsLoadCommand(PlayerStatisticsLoad);
 }
Example #14
0
        private bool startQRGenrationAndClosing(long pDrawType, DateTime pDrawDate, string pQRText)
        {
            bool successGeneration = true;
            // Cambiar estado de lista a QR Generado
            ListService listService = new ListService();

            listService.changeSyncStatusToQRUpdated(pDrawType, pDrawDate);
            // Obtener parámetros del QR generado
            DrawTypeService  drawTypeService = new DrawTypeService();
            PointSaleService posService      = new PointSaleService();

            this.dateLabel.Text = "" + UtilityService.getLargeDate(pDrawDate);
            this.drawLabel.Text = "Grupo: " + drawTypeService.getById(pDrawType).LDT_DisplayName;
            this.posLabel.Text  = "Suc: " + posService.getPointSale().LPS_DisplayName;
            // Obtener QRString codificada
            string qrOriginalText = UtilityService.getEncodeQRString(pQRText, pDrawDate, pDrawType);

            Console.WriteLine("Original QR: " + qrOriginalText);
            //text = UtilityService.compressText(text);
            string qrEncriptedText = qrOriginalText;

            Console.WriteLine("Compress QR: " + qrEncriptedText);

            // Setear el QRText y obtener las propiedades del mismo
            this.qrText = qrEncriptedText;
            int qrTextLength = qrEncriptedText.Length;
            int zerosCount   = (from c in qrEncriptedText where c == '0' select c).Count();

            // Desplegar propiedades del QR
            this.countLabel.Text = qrTextLength + " | " + zerosCount;
            this.displayQRPanel.BackgroundImage = UtilityService.buildQRCode(qrEncriptedText, this.displayQRPanel.Width, this.displayQRPanel.Height);

            // Validar tamaño de QR y advertir en caso de ser muy grande
            int maxQRSizeSuported = 350;

            if (qrTextLength > maxQRSizeSuported)
            {
                MessageService.displayErrorMessage(
                    "El QR parece tener un tamaño no apropiado para ser leído.\nEs preferible que copie el QR y lo envíe por whatsapp.\nEn caso de duda contacte al administrador.",
                    "PREFERIBLE EL ENVÍO DEL QR POR WHATSAPP"
                    );
            }
            // Cerrar el sorteo
            if (pDrawDate != null && pDrawType != 0)
            {
                DrawService drawService = new DrawService();
                drawService.changeDrawStatus(pDrawType, pDrawDate, SystemConstants.DRAW_STATUS_CLOSED);
            }
            return(successGeneration);
        }
Example #15
0
        public void Draw_ReturnsWinner()
        {
            // Arrange
            var drawService = new DrawService();

            drawService.AddParticipant("participant_one");
            drawService.AddParticipant("participant_two");
            drawService.AddParticipant("participant_three");

            // Act
            var winner = drawService.Draw();

            // Assert
            Assert.Contains(drawService.GetParticipants(), _ => _.Contains(winner));
        }
Example #16
0
        public void RemoveAllParticipants_ReturnsNoParticipants()
        {
            // Arrange
            var drawService = new DrawService();

            drawService.AddParticipant("participant_one");
            drawService.AddParticipant("participant_two");
            drawService.AddParticipant("participant_three");

            // Act
            drawService.RemoveAllParticipants();

            // Assert
            Assert.Equal(0, drawService.GetParticipants().Count);
        }
Example #17
0
        public void GetParticipantsCount_AllParticipants_ReturnsCountOfParticipants()
        {
            // Arrange
            var drawService = new DrawService();

            drawService.AddParticipant("participant_one");
            drawService.AddParticipant("participant_two");
            drawService.AddParticipant("participant_three");

            // Act
            var result = drawService.GetParticipantsCount();

            // Assert
            Assert.Equal(3, result);
        }
 public GameService(MainWindow mainWindow,
                    ScoreBoardService scoreBoardService,
                    DetectionService detectionService,
                    ConfigService configService,
                    DrawService drawService,
                    Logger logger,
                    DBService dbService)
 {
     this.mainWindow        = mainWindow;
     this.scoreBoardService = scoreBoardService;
     this.detectionService  = detectionService;
     this.configService     = configService;
     this.drawService       = drawService;
     this.logger            = logger;
     this.dbService         = dbService;
 }
Example #19
0
        public void RemoveParticipant_SingleParticipant_ReturnsParticipantNotRemoved()
        {
            // Arrange
            var drawService = new DrawService();
            var toRemove    = "participant_one";
            var expected    = "participant_two";

            drawService.AddParticipant(toRemove);
            drawService.AddParticipant(expected);

            // Act
            drawService.RemoveParticipant(toRemove);

            // Assert
            Assert.Equal(expected, drawService.GetParticipants()[0]);
        }
Example #20
0
 public async void closeTransactions(int pSyncType, DateTime? pDrawDate = null, long pDrawType = 0)
 {
     bool syncResult = await this.processParallelSynchronization(pDrawDate, pDrawType, pSyncType);
     if (syncResult)
     {
         if (pDrawDate != null && pDrawType != 0)
         {
             DrawService drawService = new DrawService();
             drawService.changeDrawStatus(pDrawType, pDrawDate, SystemConstants.DRAW_STATUS_CLOSED);
             MessageService.displayInfoMessage(
             "El sorteo fue cerrado de manera exitosa",
             "CIERRE COMPLETADO"
             );
         }
     }
 }
 public SettingsTabViewModel(DataContext dataContext,
                             IDbService dbService,
                             ILogger logger,
                             IConfigService configService,
                             DrawService drawService,
                             IMessageBoxService messageBoxService,
                             CamsDetectionBoard camsDetectionBoard,
                             IDetectionService detectionService)
     : base(dataContext, dbService, logger, configService, drawService, messageBoxService, camsDetectionBoard, detectionService)
 {
     CalibrateCamsSetupPointsCommand = new CalibrateCamsSetupPointsCommand(CalibrateCamsSetupPoints);
     CheckCamsCommand              = new CheckCamsCommand(CheckCamsSimultaneousWork);
     FindCamsCommand               = new FindCamsCommand(FindConnectedCams);
     StartRuntimeCrossingCommand   = new StartRuntimeCrossingCommand(StartCrossing);
     StopRuntimeCrossingCommand    = new StopRuntimeCrossingCommand(StopCrossing);
     StartCamSetupCapturingCommand = new StartCamSetupCapturingCommand(StartCamSetupCapturing);
     StopCamSetupCapturingCommand  = new StopCamSetupCapturingCommand(StopCamSetupCapturing);
 }
Example #22
0
        private void closeDraw(long pDrawTypeToClose, DateTime pDateToClose)
        {
            DrawService     drawService  = new DrawService();
            LTD_LotteryDraw existingDraw = drawService.getDraw(pDrawTypeToClose, pDateToClose);

            // Validar si el sorteo está cerrado
            if (existingDraw == null || existingDraw.LDS_LotteryDrawStatus == SystemConstants.DRAW_STATUS_CLOSED)
            {
                MessageService.displayInfoMessage(
                    "El sorteo se encuentra cerrado\nNo es necesario realizar la operación.",
                    "SORTEO CERRADO PREVIAMENTE"
                    );
                this.clearDrawTypeBox();
            }
            else
            {
                List <LTD_LotteryDraw> otherUnclosedDrawList = drawService.getUnclosedDraw(pDrawTypeToClose, pDateToClose);
                if (otherUnclosedDrawList.Count > 0)
                {
                    DrawTypeService     drawType  = new DrawTypeService();
                    LDT_LotteryDrawType type      = drawType.getById(pDrawTypeToClose);
                    string unclosedDateListString = "\n\n";
                    foreach (LTD_LotteryDraw drawItem in otherUnclosedDrawList)
                    {
                        if (drawItem.LTD_CreateDate != pDateToClose)
                        {
                            unclosedDateListString += type.LDT_DisplayName + "\t" + FormatService.formatDrawDateToSimpleString(drawItem.LTD_CreateDate) + "\n";
                        }
                    }
                    //Console.WriteLine(unclosedDateListString);
                    MessageService.displayWarningMessage(
                        "Existen sorteos de fechas anteriores pendientes de cierre.\nPor favor, proceda primero a realizar los cierres pendientes:" + unclosedDateListString,
                        "SORTEOS ANTERIORES SIN CERRAR"
                        );
                    //this.clearDrawTypeBox();
                }
                else
                {
                    this.confirmDrawClosing(pDrawTypeToClose, pDateToClose);
                }
            }
        }
Example #23
0
        private async Task LoadData()
        {
            NotificationMessage = "Loading...";
            IsBusy = true;
            HasNotificationMessage = true;
            if (IsInDesignMode)
            {
                CurrentDemo = await _cacheService.GetDemoDataFromCache(string.Empty);
            }
            CurrentDemo.WeaponFired = await _cacheService.GetDemoWeaponFiredAsync(CurrentDemo);

            _mapService.InitMap(CurrentDemo);
            OverviewLayer = _mapService.GetWriteableImage();
            _drawService  = new DrawService(_mapService);
            StuffLayer    = _drawService.SmokeLayer;
            await LoadStuffs();

            IsBusy = false;
            HasNotificationMessage = false;
        }
        public GameTabViewModel(DataContext dataContext,
                                IDbService dbService,
                                ILogger logger,
                                IConfigService configService,
                                DrawService drawService,
                                IMessageBoxService messageBoxService,
                                CamsDetectionBoard camsDetectionBoard,
                                IDetectionService detectionService,
                                GameService gameService,
                                ScoreBoardService scoreBoardService,
                                ManualThrowPanel manualThrowPanel)
            : base(dataContext, dbService, logger, configService, drawService, messageBoxService, camsDetectionBoard, detectionService)
        {
            this.gameService       = gameService;
            this.scoreBoardService = scoreBoardService;
            this.manualThrowPanel  = manualThrowPanel;

            StartNewGameCommand = new StartNewGameCommand(StartGame);
            StopGameCommand     = new StopGameCommand(StopGameByButton);
        }
        protected TabViewModelBase(DataContext dataContext,
                                   IDbService dbService,
                                   ILogger logger,
                                   IConfigService configService,
                                   DrawService drawService,
                                   IMessageBoxService messageBoxService,
                                   CamsDetectionBoard camsDetectionBoard,
                                   IDetectionService detectionService)
        {
            DataContext             = dataContext;
            this.dbService          = dbService;
            this.logger             = logger;
            this.configService      = configService;
            this.drawService        = drawService;
            this.messageBoxService  = messageBoxService;
            this.camsDetectionBoard = camsDetectionBoard;
            this.detectionService   = detectionService;

            HyperLinkNavigateCommand = new HyperLinkNavigateCommand(OnHyperlinkNavigate);
        }
Example #26
0
        private void button1_Click(object sender, EventArgs e)
        {
            simulation = new WorldSimulation();
            drawing    = new DrawService(simulation.WorldSize);
            sw         = Stopwatch.StartNew();
            simulation.RunSimulation();
            sw.Stop();

            var time = sw.ElapsedMilliseconds;

            simulation.statistic.AlgorithmTime = time;

            var table = drawing.ConstructDataTable(simulation.allAgents);

            this.worldView.DataSource = table;
            for (int i = 0; i < worldView.ColumnCount; i++)
            {
                worldView.Columns[i].Width = width;
            }

            MessageBox.Show($"Simulation is completed.");
        }
Example #27
0
        /// <summary>
        /// Ход игры
        /// </summary>
        public JsonResult Turn(int?turnNum)
        {
            GameState gameState = Session["test"] as GameState;

            if (gameState == null)
            {
                return(Json(new { error = true }));
            }

            string prevBoardStr = JsonHelper.SerialiazeWithType(gameState.board);

            if (gameState.game.CurrentPlayer is WebHumanPlayer)
            {
                if (turnNum.HasValue)
                {
                    gameState.game.CurrentPlayer.SetHumanMove(turnNum.Value);
                    gameState.game.Turn();
                }
                else
                {
                    // если пользователь не сделал выбор, то перезапрашиваем ход
                }
            }
            else
            {
                gameState.game.Turn();
            }

            var prevBoard = JsonHelper.DeserialiazeWithType <Board>(prevBoardStr);

            var service = new DrawService();

            return(Json(new {
                changes = service.Draw(gameState.board, prevBoard),
                stat = service.GetStatistics(gameState.game),
                moves = service.GetAvailableMoves(gameState.game)
            }));
        }
Example #28
0
        /* Build a .FBX model to a .XNB file */
        public void LoadModel(string fileName)
        {
            NameService name = (NameService)wObj.GetService(typeof(NameService));

            Cursor = Cursors.WaitCursor;
            /* Prepare the content builder project */
            this.createWorld.contentBuilder.Add(fileName, name.name, null, "ModelProcessor");
            /* Build the model */
            string buildError = this.createWorld.contentBuilder.Build();

            if (buildError == null)
            {
                if (!wObj.ContainService(typeof(DrawService)))
                {
                    /* Try load the Model and adress it as a Service to the World Object */
                    Model model = (Model)contentManager.Load <Model>(name.name);
                    wObj.AddService(typeof(Model), model);
                    DrawService toDrawService = new DrawService(wObj, this.createWorld.game);
                    wObj.AddService(typeof(DrawService), toDrawService);
                }
                else
                {
                    DrawService toDrawService = (DrawService)wObj.GetService(typeof(DrawService));
                    /* Try load the Model and adress it as a Service to the World Object */
                    Model model = (Model)contentManager.Load <Model>(name.name);
                    toDrawService.model = model;
                    wObj.RemoveService(typeof(Model));
                    wObj.AddService(typeof(Model), model);
                }
            }
            else
            {
                ProblemLoadingModel probL = new ProblemLoadingModel();
                probL.ShowDialog();
                this.StringModel.Text = "";
            }
            Cursor = Cursors.Arrow;
        }
        private async Task LoadData()
        {
            Notification    = Properties.Resources.NotificationLoading;
            IsBusy          = true;
            HasNotification = true;
            if (IsInDesignMode)
            {
                Demo = await _cacheService.GetDemoDataFromCache(string.Empty);
            }
            Demo.WeaponFired = await _cacheService.GetDemoWeaponFiredAsync(Demo);

            _mapService.InitMap(Demo);
            OverviewLayer = _mapService.GetWriteableImage(Properties.Settings.Default.UseSimpleRadar);
            _drawService  = new DrawService(_mapService)
            {
                UseSimpleRadar = Properties.Settings.Default.UseSimpleRadar,
            };
            StuffLayer = _drawService.SmokeLayer;
            await LoadStuffs();

            IsBusy          = false;
            HasNotification = false;
        }
        private void RegisterContainer()
        {
            logger.Debug("Services container register start");

            var cb = new ContainerBuilder();

            cb.Register(r => logger).AsSelf().SingleInstance();

            var configService = new ConfigService(logger);

            cb.Register(r => configService).AsSelf().SingleInstance();

            var drawService = new DrawService(this, configService, logger);

            cb.Register(r => drawService).AsSelf().SingleInstance();

            var throwService = new ThrowService(drawService, logger);

            cb.Register(r => throwService).AsSelf().SingleInstance();

            ServiceContainer = cb.Build();

            logger.Debug("Services container register end");
        }