Пример #1
0
        // Log the event and sync up
        public void ProcessAction(string id, EventType whatHappened, string team1 = null, string team2 = null)
        {
            switch (whatHappened)
            {
            case EventType.Undo:
                EventSourceManager.RemoveLast(id);
                break;

            case EventType.Created:
                EventSourceManager.Log(id, whatHappened, TeamId.Unknown, team1, team2);
                break;

            case EventType.Start:
                EventSourceManager.Log(id, whatHappened);
                break;

            case EventType.End:
                EventSourceManager.Log(id, whatHappened);
                break;

            case EventType.Resume:
                EventSourceManager.Log(id, whatHappened);
                break;

            case EventType.NewPeriod:
                EventSourceManager.Log(id, whatHappened);
                break;

            case EventType.EndPeriod:
                EventSourceManager.Log(id, whatHappened);
                break;

            case EventType.Goal1:
                EventSourceManager.Log(id, whatHappened, TeamId.Home, GetRandomPlayerId());
                break;

            case EventType.Goal2:
                EventSourceManager.Log(id, whatHappened, TeamId.Visitors, GetRandomPlayerId());
                break;

            case EventType.Timeout1:
                EventSourceManager.Log(id, whatHappened, TeamId.Home);
                break;

            case EventType.Timeout2:
                EventSourceManager.Log(id, whatHappened, TeamId.Visitors);
                break;
            }

            // Notify the live module of changes
            LiveScoreHub.Refresh();
        }
Пример #2
0
        public void ProcessAction(AdminAction action)
        {
            var repository   = new MiscRepository();
            var matchService = new MatchService();

            switch (action)
            {
            case AdminAction.ResetDb:
                repository.ResetDb();
                matchService.ProcessAction("WP0001", EventType.Created, "Frogs", "Sharks");
                matchService.ProcessAction("WP0002", EventType.Created, "Sharks", "Eels");
                break;
            }
            LiveScoreHub.Refresh();
        }