Esempio n. 1
0
 /// <summary>
 /// Called after a child control is removed from this control. The default behavior is to call InvalidateAutoSize().
 /// </summary>
 protected virtual void OnChildRemoved(int index, Control child)
 {
     InvalidateAutoSize();
 }
Esempio n. 2
0
        /// <summary>
        /// Remove the given control from this control's list of children.
        /// </summary>
        public void RemoveChild(Control child)
        {
            if (child.Parent != this)
                throw new InvalidOperationException();

            RemoveChildAt(children.IndexOf(child));
        }
Esempio n. 3
0
 public void AddChild(Control child, int index)
 {
     if (child.Parent != null)
     {
         child.Parent.RemoveChild(child);
     }
     child.Parent = this;
     if (children == null)
     {
         children = new List<Control>();
     }
     children.Insert(index, child);
     OnChildAdded(index, child);
 }
Esempio n. 4
0
 public void AddChild(Control child)
 {
     if (child.Parent != null)
     {
         child.Parent.RemoveChild(child);
     }
     AddChild(child, ChildCount);
 }
Esempio n. 5
0
 // Call this method once per frame on the root of your control heirarchy to draw all the controls.
 // See ControlScreen for an example.
 public static void BatchDraw(Control control, GraphicsDevice device, SpriteBatch spriteBatch, Vector2 offset, GameTime gameTime)
 {
     if (control != null && control.Visible)
     {
         spriteBatch.Begin();
         control.Draw(new DrawContext
         {
             Device = device,
             SpriteBatch = spriteBatch,
             DrawOffset = offset + control.Position,
             GameTime = gameTime
         });
         spriteBatch.End();
     }
 }
        private void Populate()
        {
            try
            {
                List<Score> highSores = new List<Score>();

                PanelControl newList = new PanelControl();

                if (HighScores.scores.Count > 0)
                {
                    Thread.Sleep(3000);

                    highSores = HighScores.scores;
                    foreach (var s in highSores)
                    {
                        newList.AddChild(CreateLeaderboardEntryControl(s.name, s.score, s.time));
                        _count++;
                    }
                    if (_count == HighScores.scores.Count)
                    {
                        Populated = true;
                    }
                   // newList.RemoveChildAt(0);
                }
                else
                {
                    newList.AddChild(CreateLeaderboardEntryControl(Message, " ", " "));
                }
                newList.LayoutColumn(0, 0, 0);

                if (resultListControl != null)
                {
                    RemoveChild(resultListControl);
                }
                resultListControl = newList;
                AddChild(resultListControl);
                LayoutColumn(0, 0, 0);
            }
            catch
            {

            }
        }