public List <BussinessLayer.Message> Retrive10Messages() { List <BussinessLayer.Message> Rmessages = new List <BussinessLayer.Message>(); List <CommunicationLayer.IMessage> RImessages = CommunicationLayer.Communication.Instance.GetTenMessages(url); foreach (CommunicationLayer.IMessage m in RImessages) { BussinessLayer.Message Cmessage = new BussinessLayer.Message(m, FindUser(m.UserName, m.GroupID, false), FindUser(m.UserName, m.GroupID, false).GetGroupID()); if (containMessage(Cmessage)) { this.messages.Add(Cmessage); Cmessage.Save(); msgCounter++; } } return(this.messages); }
public Boolean SendMessage(string msg) { if (this.loogedInUser == null | msg.Length > 150) { /* DateTime c12 = DateTime.Now; * // Create a string array with the lines of text * string[] lines = { c12 + " wrong sending message " }; * // Write the string array to a new file named "WriteLines.txt". * * StreamWriter outputFile; * using (outputFile = File.AppendText(GuiChatRoom.Paths.logDBPath())) * { * foreach (string line in lines) * outputFile.WriteLine(line); * } * * outputFile.Close();*/ return(false); } BussinessLayer.Message m = this.loogedInUser.SendMessage(msg, this); DateTime c11 = DateTime.Now; string[] lines = { c11 + " message has been sent " }; // Write the string array to a new file named "WriteLines.txt". StreamWriter outputFile; //using (outputFile = File.AppendText(GuiChatRoom.Paths.logDBPath())) { // foreach (string line in lines) //outputFile.WriteLine(line); } //outputFile.Close(); return(true); }