Ejemplo n.º 1
0
    public override bool addElement(int type, string id)
    {
        bool elementAdded = false;

        if (type == Controller.ACTIVE_AREA)
        {
            // Show a dialog asking for the item id
            string itemId = id;
            if (id == null)
            {
                itemId = controller.showInputDialog(TC.get("Operation.AddItemTitle"), TC.get("Operation.AddItemMessage"),
                                                    TC.get("Operation.AddItemDefaultValue"));
            }

            // If some value was typed and the identifier is valid
            if (itemId != null && controller.isElementIdValid(itemId))
            {
                ActiveArea newActiveArea = new ActiveArea(itemId, true, 220, 220, 100, 100);
                activeAreasList.Add(newActiveArea);
                ActiveAreaDataControl newActiveAreaDataControl = new ActiveAreaDataControl(sceneDataControl,
                                                                                           newActiveArea);
                activeAreasDataControlList.Add(newActiveAreaDataControl);
                controller.getIdentifierSummary().addActiveAreaId(itemId);
                //controller.dataModified( );
                elementAdded = true;
            }
        }

        return(elementAdded);
    }
Ejemplo n.º 2
0
    public override bool moveElementDown(DataControl dataControl)
    {
        bool elementMoved = false;
        int  elementIndex = activeAreasList.IndexOf((ActiveArea)dataControl.getContent());

        if (elementIndex < activeAreasList.Count - 1)
        {
            ActiveArea            a = activeAreasList[elementIndex];
            ActiveAreaDataControl c = activeAreasDataControlList[elementIndex];
            activeAreasList.RemoveAt(elementIndex);
            activeAreasDataControlList.RemoveAt(elementIndex);
            activeAreasList.Insert(elementIndex + 1, a);
            activeAreasDataControlList.Insert(elementIndex + 1, c);
            //controller.dataModified( );
            elementMoved = true;
        }

        return(elementMoved);
    }