sorry to hear it, but it goes with the territory. if you have electric and a sturdy perimeter then the fox should not get in. It was just window shopping, but will try and find a way in. there are all sorts of things you can do to put them off, and I'm sure other members know loads more. a dog, weeing on the perimeters( you and the dog). human hair hanging in old tights?, renardine( if you can still get it), a shot gun, a humane trap( and a shotgun for after), ask a local hunter to come and lamp, or just accept it and make sure your defences are up to scratch.
good luck