Ejemplo n.º 1
0
        public void Remove(ISkinnableDrawable component)
        {
            if (content == null)
            {
                throw new NotSupportedException("Attempting to remove a new component from a target container which is not supported by the current skin.");
            }

            if (!(component is Drawable drawable))
            {
                throw new ArgumentException($"Provided argument must be of type {nameof(Drawable)}.", nameof(component));
            }

            content.Remove(drawable);
            components.Remove(component);
        }
Ejemplo n.º 2
0
        private void placeComponent(ISkinnableDrawable component, bool applyDefaults = true)
        {
            var targetContainer = getFirstTarget();

            if (targetContainer == null)
            {
                return;
            }

            var drawableComponent = (Drawable)component;

            if (applyDefaults)
            {
                // give newly added components a sane starting location.
                drawableComponent.Origin = Anchor.TopCentre;
                drawableComponent.Anchor = Anchor.TopCentre;
                drawableComponent.Y      = targetContainer.DrawSize.Y / 2;
            }

            targetContainer.Add(component);

            SelectedComponents.Clear();
            SelectedComponents.Add(component);
        }