BF2Statistics.MedalData.Rank.GetName C# (CSharp) Method

GetName() public static method

Returns the Name of the Rank by Index
public static GetName ( int RankId ) : string
RankId int
return string
        public static string GetName(int RankId)
        {
            if (!Exists(RankId))
                throw new IndexOutOfRangeException();

            return StatsConstants.Ranks[RankId];
        }

Usage Example

        /// <summary>
        /// An event called everytime a new award is selected...
        /// It repaints the current award info
        /// </summary>
        private void AwardTree_AfterSelect(object sender, TreeViewEventArgs e)
        {
            // Set our award globally
            SelectedAwardNode = e.Node;

            // Only proccess child Nodes
            if (SelectedAwardNode.Nodes.Count == 0)
            {
                // Set Award Image
                SetAwardImage(SelectedAwardNode.Name);

                // Set award name and type
                switch (Award.GetType(SelectedAwardNode.Name))
                {
                case AwardType.Badge:
                    AwardTypeBox.Text = "Badge";
                    AwardNameBox.Text = Award.GetName(SelectedAwardNode.Name);
                    break;

                case AwardType.Medal:
                    AwardTypeBox.Text = "Medal";
                    AwardNameBox.Text = Award.GetName(SelectedAwardNode.Name);
                    break;

                case AwardType.Ribbon:
                    AwardTypeBox.Text = "Ribbon";
                    AwardNameBox.Text = Award.GetName(SelectedAwardNode.Name);
                    break;

                case AwardType.Rank:
                    AwardTypeBox.Text = "Rank";
                    AwardNameBox.Text = Rank.GetName(Int32.Parse(SelectedAwardNode.Name));
                    break;
                }

                // Delay or tree redraw
                AwardConditionsTree.BeginUpdate();

                // Clear all Nodes
                AwardConditionsTree.Nodes.Clear();

                // Parse award conditions into tree view
                SelectedAward = AwardCache.GetAward(SelectedAwardNode.Name);
                TreeNode Conds = SelectedAward.ToTree();
                if (Conds != null)
                {
                    AwardConditionsTree.Nodes.Add(Conds);
                }

                // Conditions tree's are to be expanded at all times
                AwardConditionsTree.ExpandAll();

                // Redraw the tree
                AwardConditionsTree.EndUpdate();
            }
        }
All Usage Examples Of BF2Statistics.MedalData.Rank::GetName