Fixed UI problems with orientation changes.

The PiClient now stays for connected for the correct amount of time.
    - It connects when the application is open or brought to the foreground
    - It disconnects when the application enters the background