Ejemplo n.º 1
0
        private async void button2_Click(object sender, EventArgs e)
        {
            UInt64 characterId;

            addCharTextbox.Text = "";
            bool isNumeric = UInt64.TryParse(addCharTextbox.Text, out characterId);

            if (isNumeric)
            {
                var charObject = (await DBCensus_Grabber.GetCharacterData(characterId)).Character.FirstOrDefault();
                if (null != charObject)
                {
                    this.charDataGridView.Rows.Add();
                    var row = charDataGridView.Rows[charDataGridView.Rows.GetLastRow(DataGridViewElementStates.Visible) - 1];
                    row.Cells[0].Value = TSChecker.Properties.Resources.terran_republic_logo_vector_by_westy543_d5xkdzh;
                    row.Cells[1].Value = charObject.Name.First;
                    row.Cells[2].Value = charObject.BattleRank.Value;
                    row.Cells[3].Value = "PSU";
                    row.Cells[3].Tag   = string.Format("http://www.planetside-universe.com/character-{0}.php", charObject.CharacterId);
                    row.Cells[4].Value = "x";
                }
                else
                {
                    MessageBox.Show("Character not found.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Invalid character ID, must be numeric.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userName"></param>
        private async void FillInInfo(string userName)
        {
            if (!string.IsNullOrEmpty(userName))
            {
                currentMember = (from member in Program.userInfo.Members
                                 where member.ForumName == userName
                                 select member).FirstOrDefault();

                if (null != currentMember)
                {
                    foreach (Character character in currentMember.Characters)
                    {
                        var charObject = (await DBCensus_Grabber.GetCharacterData(character.CharacterId)).Character.FirstOrDefault();
                        if (null != charObject)
                        {
                            this.charDataGridView.Rows.Add();
                            var row = charDataGridView.Rows[charDataGridView.Rows.GetLastRow(DataGridViewElementStates.Visible) - 1];
                            row.Cells[0].Value = TSChecker.Properties.Resources.terran_republic_logo_vector_by_westy543_d5xkdzh;
                            row.Cells[1].Value = charObject.Name.First;
                            row.Cells[2].Value = charObject.BattleRank.Value;
                            row.Cells[3].Value = string.Format("http://www.planetside-universe.com/character-{0}.php", charObject.CharacterId);
                            row.Cells[4].Value = "x";
                        }
                    }

                    this.nameTextBox.Text = currentMember.ForumName;
                    //this.nameTextBox.Enabled = false;
                    this.rankDropdown.SelectedText = currentMember.Rank;
                    //this.rankTextBox.Enabled = false;
                    this.divisionDropdown.SelectedText = currentMember.Division;
                    //this.divisionTextBox.Enabled = false;
                }
            }
        }