public void CanMakeMatchFacade()
        {
            const int numberOfRounds = 1;
            var       match          = new MatchFacade(numberOfRounds);

            Assert.NotNull(match);
        }
        public LiveViewModel GetLiveViewModel()
        {
            var facade = new MatchFacade();
            var model  = new LiveViewModel {
                LiveMatches = facade.FindInProgress()
            };

            return(model);
        }
        // Call into the read stack to read state

        public MatchApplicationService(
            MatchFacade matchFacade,
            IHubContext <LiveScoreHub, ITypedHubClient> liveScoreHubContext,
            EventSourceManager eventSourceManager)
        {
            _matchFacade         = matchFacade;
            _liveScoreHubContext = liveScoreHubContext;
            _eventSourceManager  = eventSourceManager;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Invokes while the main window load.
        /// 窗体加载成功
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            MatchFacade.Boot();

            Initialize();

            _logDialog = new LogPanel();
            // _logDialog.Show();
        }
Ejemplo n.º 5
0
        public IndexViewModel GetIndexViewModel()
        {
            var facade = new MatchFacade();
            var model  = new IndexViewModel {
                ScheduledMatches = facade.FindScheduled()
            };

            return(model);
        }
        public void CanIncreasePlayerScore()
        {
            const int expectedScore  = 1;
            const int numberOfRounds = 1;

            var match = new MatchFacade(numberOfRounds);

            match.AddToPlayerScore();

            Assert.Equal(expectedScore, match.PlayerScore);
        }
        public void CanIncreaseRound()
        {
            const int expectedRound  = 1;
            const int numberOfRounds = 1;

            var match  = new MatchFacade(numberOfRounds);
            var result = match.NextRound();

            Assert.Equal(expectedRound, match.Round);
            Assert.True(result);
        }
        public void CanMakeMatchFacadeWithExpectedValues()
        {
            const int expectedNumberOfRounds = 1;
            const int expectedScore          = 0;
            const int numberOfRounds         = 1;

            var match = new MatchFacade(numberOfRounds);

            Assert.Equal(expectedNumberOfRounds, match.MaximumRounds);
            Assert.Equal(expectedScore, match.ComputerScore);
            Assert.Equal(expectedScore, match.PlayerScore);
        }
Ejemplo n.º 9
0
        /// <summary>
        ///     Initializes all of the components.
        /// </summary>
        private void Initialize()
        {
            _searchEngine = new BinarySearchEngine(_minimumNumber, _maximumNumber);
            _match        = new MatchFacade(MaximumRounds);
            _gameState    = GameState.Start;

            _displayHandler       = new DisplayHandler();
            _computerChosenNumber = new NumberPicker(_displayHandler, _maximumNumber, _minimumNumber);

            // Need to set on click events prior to hiding the user interface
            var attemptGuess = new AttemptGuess(_displayHandler, _computerChosenNumber);

            attemptGuess.SetOnClickForAttemptGuess();

            _displayHandler.HideUserInterface();

            _guessHandler  = new GuessHandler(_searchEngine, _displayHandler);
            _inputListener = new InputListener();
            _inputHandler  = new InputHandler(_displayHandler, _inputListener);
        }
Ejemplo n.º 10
0
        // Call into the read stack to read state
        public MatchViewModel GetMatchDetails(string id)
        {
            var facade = new MatchFacade();
            var model  = new MatchViewModel {
                Current = facade.FindById(id)
            };

            // Handle timeouts for #1
            var canCallTimeout1 = HandleTimeoutFor(model.Current.TimeoutSummary1);
            var canCallTimeout2 = HandleTimeoutFor(model.Current.TimeoutSummary2);

            switch (model.Current.State)
            {
            case MatchState.ToBePlayed:
                model.Actions.CanStart = true;
                break;

            case MatchState.Warmup:
            case MatchState.Interval:
                model.Actions.CanEnd         = true;
                model.Actions.CanStartPeriod = true;
                model.Actions.CanUndo        = true;
                break;

            case MatchState.PlayInProgress:
                model.Actions.CanEnd          = true;
                model.Actions.CanEndPeriod    = true;
                model.Actions.CanScoreGoal    = true;
                model.Actions.CanCallTimeout1 = canCallTimeout1;
                model.Actions.CanCallTimeout2 = canCallTimeout2;
                model.Actions.CanUndo         = true;
                break;

            case MatchState.Timeout:
                model.Actions.CanEnd    = true;
                model.Actions.CanResume = true;
                model.Actions.CanUndo   = true;
                break;
            }
            return(model);
        }
Ejemplo n.º 11
0
        public JsonResult AddCompany(string SrcId, string MatchRecord, string Tag, string OriginalSrcRecordId)
        {
            MatchFacade mac = new MatchFacade(this.CurrentClient.ApplicationDBConnectionString);

            try
            {
                // Validate SrcId for checking duplicate records at "Add Match as a new Company".
                mac.ValidateCompanySrcId(SrcId);
                MatchEntity Match = new MatchEntity();
                if (!string.IsNullOrWhiteSpace(MatchRecord))
                {
                    // Add Match Record as Company record
                    Match      = SerializeHelper.DeserializeString <MatchEntity>(MatchRecord);
                    Match.Tags = Tag;
                    Match.OriginalSrcRecordId = OriginalSrcRecordId;
                    Match.SrcRecordId         = SrcId;
                    ViewBag.matchRecord       = Match;
                    mac.AddCompanyRecord(Match, Convert.ToInt32(User.Identity.GetUserId()));
                }
            }
            catch (SqlException ex)
            {
                return(new JsonResult {
                    Data = ex.Message
                });
            }
            catch (Exception ex)
            {
                return(new JsonResult {
                    Data = ex.Message
                });
            }
            return(new JsonResult {
                Data = CommonMessagesLang.msgSuccess
            });
        }
Ejemplo n.º 12
0
 public LiveScoreApplicationService(MatchFacade matchFacade)
 {
     _matchFacade = matchFacade;
 }
Ejemplo n.º 13
0
 private void Window_Loaded_1(object sender, RoutedEventArgs e)
 {
     MatchFacade.Boot();
     miControl1.SetName(LocalHelper.EmulatorHomeId);
     miControl2.SetName(LocalHelper.EmulatorAwayId);
 }
Ejemplo n.º 14
0
 private void Window_Loaded_1(object sender, RoutedEventArgs e)
 {
     MatchFacade.Boot();
 }
 public HomeApplicationService(MatchFacade matchFacade)
 {
     _matchFacade = matchFacade;
 }
Ejemplo n.º 16
0
 public byte[] CreateMatchToBin(MatchInput input)
 {
     return(MatchFacade.CreateMatchToBin(input));
 }
Ejemplo n.º 17
0
 public byte[] CreateMatchBin(byte[] rawInput)
 {
     return(MatchFacade.CreateMatchBin(rawInput));
 }