Пример #1
0
        public static async Task <int> AddNewMatchAsync(
            int player1Id,
            int player2Id,
            bool isPlayer1PlayFirst,
            bool blockTwoEndsRule,
            int gameCount
            )
        {
            using (ModuleContext DB = new ModuleContext())
            {
                var player1 = await DB.Players.Where(x => x.Id == player1Id).SingleOrDefaultAsync();

                var player2 = await DB.Players.Where(x => x.Id == player2Id).SingleOrDefaultAsync();

                StoredMatch match = new StoredMatch()
                {
                    Player1             = player1,
                    Player2             = player2,
                    IsPlayer1PlayFirst  = isPlayer1PlayFirst,
                    HasBlockTwoEndsRule = blockTwoEndsRule,
                    GameCount           = gameCount,
                    DateTime            = DateTime.Now
                };
                DB.Matches.Add(match);
                await DB.SaveChangesAsync();

                return(match.Id);
            }
        }
Пример #2
0
 public MainWindow()
 {
     InitializeComponent();
     storedMatch = Helper.GetMatch(7);
     InitMatch();
     //storedMatch = match;
 }
Пример #3
0
        public ShowMatch(StoredMatch match)
        {
            InitializeComponent();
            storedMatch = match;
            InitMatch();

            ShowPlayerInformations();
        }
Пример #4
0
        private async Task ShowMatchAsync()
        {
            StoredMatch match = await Helper.GetMatchAsync(this.match.StoredMatchId);

            ShowMatch showMatch = new ShowMatch(match);
            await Task.Run(() => showMatch.Dispatcher.BeginInvoke(new Action(delegate
            {
                showMatch.Show();
            })));
        }