public void Build(IEnumerable<Player> players)
        {
            Children = new List<View>();

            int badgesWidth = (badgeDictionary.Count - 1) * 15;
            double labelWidth = Width - badgesWidth - 25;

            LabelView topListTextView = new LabelView("Top 7")
            {
                X = 5,
                Width = Width - 10,
                Height = 15,
                Y = 5,
            };

            double offsetY = 25;

            foreach (Player player in players.Take(7))
            {

                CompositeView row = new CompositeView(Width, 20)
                    {
                        new LabelView(" " + player.PlayerName + " ")
                        {
                            Width = labelWidth,
                            Height = 10,
                            Align = TextAlignment.Left,
                            Y = 5
                        },
                    };
                double spacing = 0;
                foreach (var badge in player.Badges)
                {
                    row.Add(new ImageView(badgeDictionary[badge], 15, 15)
                    {
                        X = labelWidth + spacing,
                        Y = 2.5
                    });
                    spacing += 15;
                }
                frameView = new FrameView(Width, 20, row);

                row.X = 5;
                row.Y = offsetY;
                row.Width = Width - 10;
                row.BackgroundColor = new Color(239, 239, 239);
                Children.Add(row);

                offsetY += 25;
            }
            Children.Add(topListTextView);
        }
        public AndroidContext(Android.Content.Context context, InputMethodManager input, double width, double height) : base(context)
        {
            contentView = null;
            this.width = width;
            this.height = height;
            this.input = input;

            this.InputType = InputTypes.ClassText | InputTypes.TextVariationPassword;

            imageCache = new Dictionary<string, Bitmap>()
            {
                {"icon.png", BitmapFactory.DecodeResource(Resources, Resource.Drawable.Icon) },
                {"brøkbadge.png", BitmapFactory.DecodeResource(Resources, Resource.Drawable.brokbadge) },
                {"master_of_algebrabadge.png", BitmapFactory.DecodeResource(Resources, Resource.Drawable.master_of_algebrabadge) },
                {"parenthesis_badge.png", BitmapFactory.DecodeResource(Resources, Resource.Drawable.parenthesis_badge) },
                {"star.png", BitmapFactory.DecodeResource(Resources, Resource.Drawable.star) },
                {"star_activated.png", BitmapFactory.DecodeResource(Resources, Resource.Drawable.star_activated) },
                {"tutorial_badge.png", BitmapFactory.DecodeResource(Resources, Resource.Drawable.tutorial_badge) },
                {"restart.png", BitmapFactory.DecodeResource(Resources, Resource.Drawable.restart) },
                {"potens_badge.png", BitmapFactory.DecodeResource(Resources, Resource.Drawable.potens_badge) }
            };

            Text = "";
            Append("webmat");
            this.TextChanged += (obj, args) =>
            {
                Console.WriteLine(this.Text);
                if (args.Text.ToString() == "webma")
                {
                    contentView.KeyPressed("Back", this);
                    Text = "";
                    Append("webmat");
                }
                else if(args.Text.ToString().Length > "webmat".Length)
                {
                    contentView.KeyPressed(args.Text.Last() + "", this);
                    Text = "";
                    Append("webmat");
                }
            };
        }
 public override void SetContentView(FrameView view)
 {
     base.SetContentView(view);
     Draw();
 }
 public Context(double width, double height)
 {
     ContentView = new FrameView(0, 0);
     Width = width;
     Height = height;
 }
 public virtual void SetContentView(FrameView view)
 {
     ContentView = view;
 }
        public void Build(CurrentPlayer user)
        {
            MenuButton = new ButtonView("Menu", () => { if (OnExit != null) { OnExit(); } })
            {
                Width = 75,
                Height = 30,
                BackgroundColor = new Color(193, 57, 43),
                TextColor = new Color(255, 255, 255),
            };

            TitelView = new CompositeView(200, 40)
            {
                X = 100,
                Y = 10,
            };
            CategoryName = new LabelView(user.Categories[Category].Name)
            {
                Width = TitelView.Width * 0.6,
                Height = TitelView.Height,
                X = TitelView.X - (TitelView.Width * 0.6) / 2
            };

            StarTextView = new LabelView("")
            {
                Width = TitelView.Width * 0.15,
                Height = 15,
                X = CategoryName.X + CategoryName.Width + 7.5,
                Y = CategoryName.Y + ((CategoryName.Height) / 2) - 7.5
            };

            StarView = new ImageView("star_activated.png", TitelView.Width * 0.10, TitelView.Width * 0.10)
            {
                X = CategoryName.X + CategoryName.Width + StarTextView.Width + 10,
                Y = CategoryName.Y + 0.5 * (TitelView.Width * 0.10)
            };

            BadgeView = new ImageView("tutorialbadge.png", TitelView.Width * 0.15, TitelView.Width * 0.15)
            {
                X = 0 - ((TitelView.Width * 0.10) / 2) + 5,
                Y = CategoryName.Y + (0.5 * (TitelView.Width * 0.15)) - 10
            };

            TitelView.Add(StarTextView);
            TitelView.Add(CategoryName);
            TitelView.Add(StarView);
            TitelView.Add(BadgeView);

            Levels = new FrameView(Width - 100, Height - (CategoryName.Y + CategoryName.Height))
            {
                X = 50,
                Y = CategoryName.Y + CategoryName.Height,
            };

            ArrowRight = new VectorImageView(345, Levels.Y + Levels.Height / 2 - 75 / 2, 50, 75)
            {
                { 0,0    },
                { 25,75/2 },
                { 0,75   },
            };

            ArrowRight.Visible = Category < user.Categories.Count - 1;
            ArrowRight.BackgroundColor = new Color(44, 119, 130);
            ArrowRight.OnClick = () =>
            {
                if (Category < user.Categories.Count - 1)
                {
                    Category++;
                    OnChanged();
                }
            };

            ArrowLeft = new VectorImageView(5, Levels.Y + Levels.Height / 2 - 75 / 2, 50, 75)
            {
                { 25,75/2 },
                { 50,0    },
                { 50,75   },
            };

            ArrowLeft.BackgroundColor = new Color(44, 119, 130);
            ArrowLeft.OnClick = () =>
            {
                if (Category > 0)
                {
                    Category--;
                    OnChanged();
                }
            };
            ArrowLeft.Visible = Category > 0;

            Children.Add(MenuButton);
            Children.Add(ArrowLeft);
            Children.Add(ArrowRight);
            Children.Add(Levels);
            Children.Add(TitelView);

            Update(user);
        }
 public void SetContentView(Model.UI.FrameView view)
 {
     contentView = view;
     Draw();
 }