private void MessageGetterDelegate(AllMessageGetter.MessageStatus status, List <Conversation> conversations, Dictionary <int, List <Message> > messages, Dictionary <string, User> users) { if (Getting) { getter = new AllMessageGetter(PrivateKey, MessageGetterDelegate); } else { getter = null; } if (conversations != null && conversations.Count > 0) { TimeStamp = conversations[conversations.Count - 1].LastActivity; } Result?.Invoke(EnumConverter.Convert <MessageGetAllStatus>(status), conversations, messages, users); if (status != AllMessageGetter.MessageStatus.Success) { Thread.Sleep(TimeBetweenFailedCalls); } else { Thread.Sleep(TimeBetweenCalls); } getter?.get(TimeStamp, GetUsers, WaitingCall); }
public bool StartGetting() { if (!Getting) { Getting = true; if (getter == null) { getter = new AllMessageGetter(PrivateKey, MessageGetterDelegate); getter.get(TimeStamp, GetUsers, WaitingCall); } return(true); } else { return(false); } }