Ejemplo n.º 1
0
 /// <summary>
 /// Adds control
 /// </summary>
 /// <param name="control"></param>
 public void Add(IControl control)
 {
     control.LoadContent(Game);
     _controls.Add(control);
     if (control is SelectableControl)
     {
         _selectableControls++;
     }
 }
Ejemplo n.º 2
0
        public bool AddControl(IControl control)
        {
            if (_controlLayers.Count > 0)
                _controlLayers.First.Value.IsActive = false;

            if (!_controlLayers.TryAddFirst(control)) {
                Console.Error.WriteLine("Failed to acquire control lock. {0} control not added.", control.GetType().Name);
                return false;
            }
            if (_isLoaded)
                control.LoadContent(this);
            control.IsActive = true;
            control.OnClosed += _closedControlHandler;
            _alignControl(control);
            return true;
        }