コード例 #1
0
        public GamePage(CGameStartModel model)
        {
            InitializeComponent();
            IDataBaseAccessService client = SDbService.Get();

            switch (model.MySideColor)
            {
            case EPieceColor.White:
                WhitePlayerBadge.Content = new PlayerBadgeControl(
                    CAuthenticationStaff.Instance.User.Nickname,
                    client.GetWinRate(CAuthenticationStaff.Instance.User.UserId));
                BlackPlayerBadge.Content = new PlayerBadgeControl(
                    client.FindUserById(model.OpponentId).Nickname,
                    client.GetWinRate(model.OpponentId));
                break;

            case EPieceColor.Black:
                WhitePlayerBadge.Content = new PlayerBadgeControl(
                    client.FindUserById(model.OpponentId).Nickname,
                    client.GetWinRate(model.OpponentId));
                BlackPlayerBadge.Content = new PlayerBadgeControl(
                    CAuthenticationStaff.Instance.User.Nickname,
                    client.GetWinRate(CAuthenticationStaff.Instance.User.UserId));
                break;

            default:
                throw new InvalidEnumArgumentException("Unknown or undefined player side color");
            }
            DataContext = new CGamePageViewModel(model.GameId, model.MySideColor);
        }
コード例 #2
0
 public void NavigateToGamePage(CGameStartModel model)
 {
     GamePageNavigate?.Invoke(model);
 }
コード例 #3
0
 private void ToGamePage(CGameStartModel model)
 {
     MainFrame.Content = new GamePage(model);
 }