コード例 #1
0
        private Grid GeneratePlayerTitleBlock(Player p)
        {
            PlayerAdapter pa = new PlayerAdapter();
            Maths         u  = new Maths();

            Grid g;

            g = GenerateBlankBlockGrid(3, p.DisplayName(PersonNameReturnType.FirstnameLastname) +
                                       (Debugger.IsAttached ? string.Format(", ID: {0}", p.UniqueID.ToString()) : ""), 2);
            Grid.SetColumnSpan(g, 2);

            TextBlock t = new TextBlock();

            t.Text   = pa.PositionAndSideText(p, false);
            t.Style  = Application.Current.FindResource("ListHeader") as Style;
            t.Margin = new Thickness(8, 0, 0, 0);
            Grid.SetColumn(t, 0);
            Grid.SetColumnSpan(t, 2);
            Grid.SetRow(t, 1);
            g.Children.Add(t);

            UiUtils.AddGridData(g, 0, 2, LangResources.CurLang.DateOfBirth,
                                p.DateOfBirth.ToString(LangResources.CurLang.DateFormat) + string.Format(" (Age: {0})", u.CalculateAgeInGame(p.DateOfBirth)));

            StackPanel stars = GraphicUtils.StarRating(p.Stars);

            stars.HorizontalAlignment = HorizontalAlignment.Right;
            Grid.SetColumn(stars, 3);
            Grid.SetColumnSpan(stars, 3);
            Grid.SetRow(stars, 0);
            g.Children.Add(stars);
            return(g);
        }