Example #1
0
 def startApplication(self):
     while(True):
         senderId = input('Please enter your id: ')
         testUserController = UserController(self.connect)
         foundSenderId = testUserController.findUserById(senderId)
         if foundSenderId is None:
             print("The user id that you provided does not exist.")
             continue
         break
     print("\nHere is the current user list: ")
     print(testUserController.findAllUserIdExceptSenderId(senderId))
     while(True):
         receiverId = input("\nSelect a user to send your message to: ")
         foundReceiverId = testUserController.findUserById(receiverId)
         if foundReceiverId is None:
             print("The receiver id that you provided is wrong!")
             continue
         break
     testMessageController= MessageController(self.connect)
     while(True): 
         message = input("Please write your message down: ")
         foundMessage = testMessageController.sendMessage(receiverId, senderId, message)
         if foundMessage is not None:
             print(foundMessage)
         option = input("""Would you like to write another message to the same user? 
         Press 1 to write new message, any other button to quit.\n""")
         if option == "1":
             continue
         break