You cannot burn yourself when taking a shower, you would use while.
Of the below sentences, which one does *not* make sense?
a: "i burned myself accidentally when i was cooking"
b: "i burned myself accidentally when i was taking a shower"