How can i create custom custom commands

How can I create custom action commands ?
I have tried the code bellow, but the menus are not diplayed in the contextual menus, and they do not appear in the shape sheet Actions section.

long shapeId = page.DrawRectangle(1, 1, 1, 1);
Shape shape = page.Shapes.GetShape(shapeId);
Act act = new Act();
act.Action.Ufe.F = “SETF("Actions.C2","0")+SETF(GetRef(Sheet.383!FlipX),NOT(Sheet.383!FlipX))”;
act.Menu.Value = “Flip shape hori&zontal”;
shape.Acts.Add(act);

        act = new Act();
        act.Action.Ufe.F = "SETF(\"Actions.C2\",\"1\")+SETF(GetRef(Sheet.383!FlipX),\"PNTX(LOCTOLOC(PNT(LocPinX, LocPinY), Width, ThePage!PageWidth)) > PNTX(LOCTOLOC(PNT(Sheet.B!LocPinX, Sheet.B!LocPinY), Sheet.B!Width, ThePage!PageWidth))\")";
        act.Menu.Value = "A&utomatic shape flipping";
        shape.Acts.Add(act);

@zkormos
Thanks for the sample code.
Please set the act’s name as shown in the following code,then it will display in the menu:

        Act act = new Act();
        act.Name = "Test"; //set act's name
        act.NameU = "Test";
        act.Action.Ufe.F = "SETF(\"Actions.C2\",\"1\")+SETF(GetRef(Sheet.383!FlipX),\"PNTX(LOCTOLOC(PNT(LocPinX, LocPinY), Width, ThePage!PageWidth)) > PNTX(LOCTOLOC(PNT(Sheet.B!LocPinX, Sheet.B!LocPinY), Sheet.B!Width, ThePage!PageWidth))\")";
        act.Menu.Value = "A&utomatic shape flipping";
        shape.Acts.Add(act);

Thanks.