Exemple #1
0
        /// <summary>
        /// Inserts the drawbox to the slot with the provided handler.
        /// </summary>
        /// <param name="box">The box to insert into the slot.</param>
        /// <param name="handler">The handler of the slot.</param>
        protected void PutDrawBoxInSlot(DrawBox box, SlotHandler handler)
        {
            if (box == this)
            {
                Debug.AddExceptionInClass(this.GetType(), "PutDrawBoxInSlot", "Can't add this to itself.");
                return;
            }

            if (handler.DrawBox != null)
            {
                Debug.AddExceptionInClass(this.GetType(), "PutDrawBoxInSlot", "Can't add point DrawBox to an occupied slot.");
                return;
            }

            if (DrawBoxList.Contains(box))
            {
                Debug.AddExceptionInClass(this.GetType(), "PutDrawBoxInSlot", "Can't add point DrawBox instance twice to the same container");
                return;
            }

            if (box.Container != null)
            {
                Debug.AddExceptionInClass(this.GetType(), "PutDrawBoxInSlot", "Can't add point DrawBox instance that already has point container.");
                return;
            }

            if (!box.IsInitialized)
            {
                Debug.AddExceptionInClass(this.GetType(), "PutDrawBoxInSlot", "Can't add point DrawBox that is not initialized.");
                return;
            }

            if (!Slots.ContainsKey(handler))
            {
                Debug.AddExceptionInClass(this.GetType(), "PutDrawBoxInSlot", "Tried to put drawbox in non-existing slot.");
                return;
            }

            Slots[handler].DrawBox = box;
            drawBoxList.Add(box);

            box.Parent    = Parent;
            box.Container = this;
            box.Handler   = handler;

            UpdateSize();

            box.ReloadAlignment();
            box.AddedToContainer();
            DrawBoxHasBeenAdded(box, handler);
        }