USB and XBee Communication

No but the thing is I want the computer to send a command to the Arduino while the TX/RX pins are connected to XBee.

Is there a way I can know whether I am connected to USB or XBee?