Personally, I would do the electrical first. You may want to talk to your local building dept. They may not differentiate between your type of construction and a typical frame which usuallly requires the frame to be wired and plumbed before any insulation can be done. The reason for this is to make sure the structure has not been compromised by an over-zealous tradesman with a sawsall or hole-hawg. If you do opt for the wiring after the foam, technically none of the wiring job is hidden by the insulation so it is possible to do it that way and still be properly inspected, just check with the guys with the ballpoints, they sign your building card.