eg.
He was working at the table when I went in. 当我进去的时候,他正在桌旁工作。
Someone knocked at the door when I was sleeping. 当我正在睡觉时,有人敲门。
I will visit my good friend when I have time. 当我有空儿时,我将去看望我的好友。
I worked for a foreign company when I was in Shanghai. 当我在上海时,我为一家外国企业工作。
注:when也可以作并列连词,表示一个动词正在进行的时候,突然间发生了另外一件事。