private static TLContainer CreateContainer(IList <HistoryItem> items) { var messages = new List <TLContainerTransportMessage>(); for (var i = 0; i < items.Count; i++) { var item = items[i]; var transportMessage = (TLContainerTransportMessage)item.Message; if (item.InvokeAfter != null) { transportMessage.MessageData = new TLInvokeAfterMsg { MsgId = item.InvokeAfter.Message.MessageId, Object = item.Object }; } item.Status = RequestStatus.Sent; messages.Add(transportMessage); } var container = new TLContainer { Messages = new List <TLContainerTransportMessage> (messages) }; return(container); }
private void GetPassportRequestsInternal(TLObject[] requests, Action <TLObject> getResultCallback, Action <TLRPCError> faultCallback = null) { var container = new TLContainer { Messages = new List <TLContainerTransportMessage>() }; var historyItems = new List <HistoryItem>(); for (var i = 0; i < requests.Length; i++) { var obj = requests[i]; int sequenceNumber; TLLong messageId; lock (_activeTransportRoot) { sequenceNumber = _activeTransport.SequenceNumber * 2 + 1; _activeTransport.SequenceNumber++; messageId = _activeTransport.GenerateMessageId(true); } var data = i > 0 ? new TLInvokeAfterMsg { MsgId = container.Messages[i - 1].MessageId, Object = obj } : obj; var transportMessage = new TLContainerTransportMessage { MessageId = messageId, SeqNo = new TLInt(sequenceNumber), MessageData = data }; var historyItem = new HistoryItem { SendTime = DateTime.Now, Caption = "passport.item" + i, Object = obj, Message = transportMessage, Callback = getResultCallback, AttemptFailed = null, FaultCallback = faultCallback, ClientTicksDelta = ClientTicksDelta, Status = RequestStatus.Sent, }; historyItems.Add(historyItem); container.Messages.Add(transportMessage); } lock (_historyRoot) { foreach (var item in historyItems) { _history[item.Hash] = item; } } #if DEBUG NotifyOfPropertyChange(() => History); #endif SendNonInformativeMessage <TLObject>("passport.container", container, result => { }, faultCallback); }
public ViewModelLocator() { _container = TLContainer.Current; }