//If exit button is pressed
 private void exit_button_Click(object sender, RoutedEventArgs e)
 {
     HavissIoTCommandBuilder commandBuilder = new HavissIoTCommandBuilder();
     if (Config.password.Length > 0)
     {
         commandBuilder.addUser(Config.username, Config.password);
     }
     else
     {
         commandBuilder.addUser(Config.username);
     }
     commandBuilder.serverExit();
     SharedVariables.client.write(commandBuilder.getJsonString());
 }