예제 #1
0
 public ProfilePage(ApiUtility.Player player)
 {
     InitializeComponent();
     this.Top  = Utility.windowLocationY;
     this.Left = Utility.windowLocationX;
     displayStats(player);
 }
예제 #2
0
 public SelectedPlayerProfile(ApiUtility.Player player, MatchInfo matchInfo)
 {
     InitializeComponent();
     this.Top        = Utility.windowLocationY;
     this.Left       = Utility.windowLocationX;
     matchInfoGlobal = matchInfo;
     displayStats(player);
 }
예제 #3
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     Utility.username = UserName_Textbox.Text;
     ApiUtility.Player player = ApiUtility.getPlayerInfo(Utility.username);
     if (UserName_Textbox.Text != "")
     {
         if (player != null)
         {
             Utility.player = player;
             string usernameFormatted = Regex.Replace(UserName_Textbox.Text, @"\s+", "");
             if (usernameFormatted != "")
             {
                 new ProfilePage(player).Show();
                 this.Close();
             }
         }
     }
 }
예제 #4
0
        private void displayStats(ApiUtility.Player player)
        {
            if (player != null)
            {
                Utility.usernameID               = player.Id;
                UsernameValue_Label.Text         = player.Name;
                UserMessageValue_Label.Text      = player.Personal_Status_Message;
                TotalWinsValue_Label.Content     = (player.Wins).ToString();
                TotalLossesValue_Label.Content   = (player.Losses).ToString();
                HoursPlayedValue_Label.Content   = (player.HoursPlayed).ToString();
                MasteryLevelsValue_Label.Content = (player.MasteryLevel).ToString();



                float winPercent = ((float)player.Wins / ((float)player.Wins + (float)player.Losses)) * 100;
                WinRatioValue_Label.Content = winPercent.ToString("#.##") + "%";


                //Avatar loading causes issues currently - will fix in the next update

                /*
                 * if (player.Avatar_URL != "" || player.Avatar_URL != null)
                 * {
                 *  var imgUrl = new Uri(player.Avatar_URL);
                 *  var imageData = new WebClient().DownloadData(imgUrl);
                 *
                 *  // or you can download it Async won't block your UI
                 *  // var imageData = await new WebClient().DownloadDataTaskAsync(imgUrl);
                 *
                 *  var bitmapImage = new BitmapImage { CacheOption = BitmapCacheOption.OnLoad };
                 *  bitmapImage.BeginInit();
                 *  bitmapImage.StreamSource = new MemoryStream(imageData);
                 *  bitmapImage.EndInit();
                 *
                 *  Avatar_Img.Source = bitmapImage;
                 * }
                 */
            }
            else
            {
                this.Close();
            }
        }
예제 #5
0
        private void PlayerName_MouseDown(object sender, MouseButtonEventArgs e)
        {
            ApiUtility.Player selectedPlayer = null;

            if ((String)((Label)sender).Content != "")

            {
                string     nameOfLabel   = ((Label)sender).Name;
                List <int> teamAndPlayer = new List <int>();
                for (int i = 0; i < nameOfLabel.Length; i++)
                {
                    if (Char.IsDigit(nameOfLabel[i]))
                    {
                        if (teamAndPlayer.Count == 0)
                        {
                            teamAndPlayer.Add(int.Parse(nameOfLabel[i].ToString()));
                        }
                        else
                        {
                            teamAndPlayer.Add(int.Parse(nameOfLabel[i].ToString()) - 1);
                        }
                    }
                }

                if (teamAndPlayer[0] == 1)
                {
                    selectedPlayer = ApiUtility.getPlayerInfo(Utility.playerNamesTeam1[teamAndPlayer[1]]);
                }
                if (teamAndPlayer[0] == 2)
                {
                    selectedPlayer = ApiUtility.getPlayerInfo(Utility.playerNamesTeam2[teamAndPlayer[1]]);
                }

                if (selectedPlayer != null)
                {
                    new SelectedPlayerProfile(selectedPlayer, this).Show();
                    this.Hide();
                }
            }
        }