public DataMessage(FuncMessage msg) { this.GUID = msg.guid; this.timeStamp = msg.dateTime; this._messageBody = msg.messageBody; this._user = msg.user; this.editable = msg.Editable; }
//Recive a message and changed its text. public void editMessage(DataMessage m, String editText) { try { DateTime msgDateTime = DateTime.Now.ToLocalTime(); FuncMessage newMessage = new FuncMessage(editText, m.guid, msgDateTime, m.user); newMessage.replace(); } catch (Exception e) { throw e; } }
// Sends a message to the server and returns a Message object. public FuncMessage sendMessage(String msg) { try { FuncMessage sentMsg = FuncMessage.Create(msg, this); sentMsg.Send(); return(sentMsg); } catch (Exception e) { throw e; } }
//Send message to the Server public Boolean SendMessage(String messageBody) { if (!ExceptionHandler.CheckValidty(messageBody)) { return(false); } try { FuncMessage sentMsg = CurrentUser.sendMessage(messageBody); RetriveTenlastMessages(); } catch (Exception e) { throw new Exception(e.Message); } return(true); }