Added auto dis/connect based on having the focus

Added automatic connect & disconnect when the form gains and losses the
focus.
Added auto dis/connect when Form has focus

Added automatic connect & disconnect based on when the form is active.