private void BEdit_Click(object sender, EventArgs e)
        {
            if (LBAction.SelectedItem != null)
            {
                Action action = Action.GetAction(LBAction.SelectedItem.ToString());

                try
                {
                    Action.Timeout = float.Parse(TBTimout.Text);
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("Timeout value must be a float");
                    return;
                }

                Action updatedAction = null;

                if (action.GetType().ToString().Contains("PositionAction"))
                {
                    BuildPositionAction bsp = new BuildPositionAction();
                    bsp.BuildFromAction(( PositionAction )action);

                    if (bsp.ShowDialog() == DialogResult.OK)
                    {
                        updatedAction = bsp.Action;
                    }
                }

                else if (action.GetType().ToString().Contains("VeloctiyAction"))
                {
                    BuildVelocityAction velocityAction = new BuildVelocityAction();
                    velocityAction.BuildFromAction(( VelocityAction )action);

                    if (velocityAction.ShowDialog() == DialogResult.OK)
                    {
                        updatedAction = velocityAction.Action;
                    }
                }

                else if (action.GetType().ToString().Contains("AndAction"))
                {
                    BuildAndGesture andAction = new BuildAndGesture();
                    andAction.BuildFromAction(( AndAction )action);

                    if (andAction.ShowDialog() == DialogResult.OK)
                    {
                        updatedAction = andAction.Action;
                    }
                }

                else if (action.GetType().ToString().Contains("OrAction"))
                {
                    BuildOrGesture orAction = new BuildOrGesture();
                    orAction.BuildFromAction(( OrAction )action);

                    if (orAction.ShowDialog() == DialogResult.OK)
                    {
                        updatedAction = orAction.Action;
                    }
                }

                else if (action.GetType().ToString().Contains("TimeAction"))
                {
                    BuildTimeAction timeAction = new BuildTimeAction();
                    timeAction.BuildFromAction(( TimeAction )action);

                    if (timeAction.ShowDialog() == DialogResult.OK)
                    {
                        updatedAction = timeAction.Action;
                    }
                }

                if (updatedAction != null)
                {
                    Action.ReplaceAction(action, updatedAction);
                    RebuildActionList();
                }
            }
            else
            {
                MessageBox.Show("Select an action to edit");
            }
        }
        private void BEdit_Click(object sender, EventArgs e)
        {
            if (LBActions.SelectedItem != null)
            {
                Gesture currentGesture = GetGesture(GetSelectedNodeSkeliton(), TVGesturesSkel1.SelectedNode.Text);
                Action  action         = currentGesture.GetAction(LBActions.SelectedItem.ToString());
                Action  updatedAction  = null;

                if (action.GetType().ToString().Contains("PositionAction"))
                {
                    BuildPositionAction bsp = new BuildPositionAction();
                    bsp.BuildFromAction(( PositionAction )action);

                    if (bsp.ShowDialog() == DialogResult.OK)
                    {
                        updatedAction = bsp.Action;
                    }
                }

                else if (action.GetType().ToString().Contains("ConditionalVelocityAction"))
                {
                    ConditionalActionBuilder velocityAction = new ConditionalActionBuilder();
                    velocityAction.BuildFromAction(( ConditionalVelocityAction )action);

                    if (velocityAction.ShowDialog() == DialogResult.OK)
                    {
                        updatedAction = velocityAction.Action;
                    }
                }

                else if (action.GetType().ToString().Contains("VelocityAction"))
                {
                    BuildVelocityAction velocityAction = new BuildVelocityAction();
                    velocityAction.BuildFromAction(( VelocityAction )action);

                    if (velocityAction.ShowDialog() == DialogResult.OK)
                    {
                        updatedAction = velocityAction.Action;
                    }
                }

                else if (action.GetType().ToString().Contains("AndAction"))
                {
                    BuildAndGesture andAction = new BuildAndGesture();
                    andAction.BuildFromAction(( AndAction )action);

                    if (andAction.ShowDialog() == DialogResult.OK)
                    {
                        updatedAction = andAction.Action;
                    }
                }

                else if (action.GetType().ToString().Contains("OrAction"))
                {
                    BuildOrGesture orAction = new BuildOrGesture();
                    orAction.BuildFromAction(( OrAction )action);

                    if (orAction.ShowDialog() == DialogResult.OK)
                    {
                        updatedAction = orAction.Action;
                    }
                }

                else if (action.GetType().ToString().Contains("TimeAction"))
                {
                    BuildTimeAction timeAction = new BuildTimeAction();
                    timeAction.BuildFromAction(( TimeAction )action);

                    if (timeAction.ShowDialog() == DialogResult.OK)
                    {
                        updatedAction = timeAction.Action;
                    }
                }

                if (updatedAction != null)
                {
                    currentGesture.ReplaceAction(action, updatedAction);
                    RebuildActionList();
                }
            }
            else
            {
                MessageBox.Show("Select an action to edit");
            }
        }