コード例 #1
0
ファイル: MainForm.cs プロジェクト: joebu23/GV-2015
 private void homePlayerInput1_TextChanged(object sender, EventArgs e)
 {
     try
     {
         var playerNumber = Convert.ToInt32(homePlayerInput1.Text);
         _homePlayer = playerService.GetPlayerByPlayerNumber(playerNumber, Home);
         if (_homePlayer != null)
         {
             homePlayerLabel1.Text = _homePlayer.Name;
             if (GetLiveData.Checked)
             {
                 bw = new BackgroundWorker();
                 bw.WorkerSupportsCancellation = true;
                 bw.DoWork += new DoWorkEventHandler(GetHomePlayerData);
                 bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(FillInPlayerLabelsHome);
                 bw.RunWorkerAsync();
             }
             else
             {
                 BlankHomePlayerStatLines();
             }
         }
         else
         {
             homePlayerLabel1.Text = "";
         }
     }
     catch (Exception er)
     {
         homePlayerLabel1.Text = "";
         BlankHomePlayerStatLines();
     }
 }
コード例 #2
0
ファイル: PlayerService.cs プロジェクト: joebu23/GV-2015
 public Models.Team.Player GetPlayerByPlayerNumber(int playerNum, Team team)
 {
     var returnPlayer = new Team.Player();
     return team.Players.Where(x => x.Number == playerNum).SingleOrDefault();
 }