// ---------------------------- FOR GUI USES ---------------------------- // /// <summary> /// This method takes user's choices of sorting and filters and updates the messages screen following this. /// </summary> /// <param name="Operations">The operation to make on certain list.</param> public void refresh(string[] filters, bool checkTime, ISort sorter, bool ascending) { _ascending = ascending; if (!(filters[0] == "")) { msgHandler.addGroupFilter(filters[0]); } if (!(filters[1] == "")) { msgHandler.addNicknameFilter(filters[1]); } if (!checkTime) { messages.Clear(); } retrieveMessages(checkTime); messages = sorter.DoAction(messages); MessageConvertor msgConvertor = new MessageConvertor(); List <ReadOnlyMessage> newReadOnlyList = new List <ReadOnlyMessage>(); foreach (Message msg in messages) { ReadOnlyMessage roMsg = msgConvertor.convertToReadOnly(msg); newReadOnlyList.Add(roMsg); } messagesToPrint = newReadOnlyList; }