Exemplo n.º 1
0
 public void Update(TLInputGeoPointBase geoPoint)
 {
     foreach (var message in Items.ToList())
     {
         Update(message, geoPoint, false);
     }
 }
Exemplo n.º 2
0
        public void UploadProfilePhotoAsync(TLInputFile file, TLString caption, TLInputGeoPointBase geoPoint, TLInputPhotoCropBase crop, Action <TLPhotosPhoto> callback, Action <TLRPCError> faultCallback = null)
        {
            var obj = new TLUploadProfilePhoto {
                File = file, Caption = caption, GeoPoint = geoPoint, Crop = crop
            };

            SendInformativeMessage("photos.uploadProfilePhoto", obj, callback, faultCallback);
        }
Exemplo n.º 3
0
        public BotResultsCollection(IMTProtoService protoService, TLInputUserBase bot, TLInputPeerBase peer, TLInputGeoPointBase geoPoint, string query)
        {
            _protoService = protoService;
            _bot          = bot;
            _peer         = peer;
            _geoPoint     = geoPoint;
            _query        = query;

            _nextOffset = string.Empty;
        }
Exemplo n.º 4
0
        private TLInputGeoPointBase GetGeoPoint(TLUser45 user45)
        {
            TLInputGeoPointBase geoPoint = null;

            if (user45 != null && user45.IsBotInlineGeo)
            {
                geoPoint = new TLInputGeoPointEmpty();
                if (user45.BotInlineGeoAccess && _watcher != null && _watcher.Status == GeoPositionStatus.Ready && _watcher.Position.Location != GeoCoordinate.Unknown)
                {
                    geoPoint = new TLInputGeoPoint {
                        Lat = new TLDouble(_watcher.Position.Location.Latitude), Long = new TLDouble(_watcher.Position.Location.Longitude)
                    };
                }
            }
            return(geoPoint);
        }
Exemplo n.º 5
0
        private void Update(TLMessage message, TLInputGeoPointBase geoPoint, bool stop)
        {
            if (message.Media is TLMessageMediaGeoLive geoLiveMedia)
            {
                var expires = ConvertDate(message.Date + geoLiveMedia.Period);
                if (expires > DateTime.Now)
                {
                    var peer = message.Parent?.ToInputPeer();
                    if (peer == null)
                    {
                        return;
                    }

                    if (geoPoint != null)
                    {
                        geoLiveMedia.Geo = geoPoint.ToGeoPoint();
                        geoLiveMedia.RaisePropertyChanged(() => geoLiveMedia.Geo);
                    }

                    if (stop)
                    {
                        geoLiveMedia.Period = 0;
                        geoLiveMedia.RaisePropertyChanged(() => geoLiveMedia.Period);
                    }

                    _protoService.EditMessageAsync(peer, message.Id, null, null, null, geoPoint, false, stop, null);
                }
                else
                {
                    Items.Remove(message);
                }
            }

            if (_locator != null && Items.IsEmpty())
            {
                _locator.PositionChanged -= OnPositionChanged;
            }
        }
Exemplo n.º 6
0
        public void EditMessageAsync(TLInputPeerBase peer, int id, string message, TLVector <TLMessageEntityBase> entities, TLReplyMarkupBase replyMarkup, TLInputGeoPointBase geoPoint, bool noWebPage, bool stop, Action <TLUpdatesBase> callback, Action <TLRPCError> faultCallback = null)
        {
            var obj = new TLMessagesEditMessage {
                Flags = 0, Peer = peer, Id = id, Message = message, IsNoWebPage = noWebPage, Entities = entities, ReplyMarkup = replyMarkup, GeoPoint = geoPoint, IsStop = stop
            };

            const string caption = "messages.editMessage";

            SendInformativeMessage <TLUpdatesBase>(caption, obj,
                                                   result =>
            {
                var multiPts = result as ITLMultiPts;
                if (multiPts != null)
                {
                    _updatesService.SetState(multiPts, caption);
                }
                else
                {
                    ProcessUpdates(result, null, true);
                }

                callback?.Invoke(result);
            },
                                                   faultCallback);
        }
Exemplo n.º 7
0
        public void EditMessageAsync(TLInputPeerBase peer, TLInt id, TLString message, TLVector <TLMessageEntityBase> entities, TLInputMediaBase media, TLReplyKeyboardBase replyMarkup, bool noWebPage, bool stopGeoLive, TLInputGeoPointBase geoPoint, Action <TLUpdatesBase> callback, Action <TLRPCError> faultCallback = null)
        {
            var obj = new TLEditMessage {
                Flags = new TLInt(0), Peer = peer, Id = id, Message = message, NoWebPage = noWebPage, Entities = entities, Media = media, ReplyMarkup = replyMarkup, StopGeoLive = stopGeoLive, GeoPoint = geoPoint
            };

            const string caption = "messages.editMessage";

            SendInformativeMessage <TLUpdatesBase>(caption, obj,
                                                   result =>
            {
                var multiPts = result as IMultiPts;
                if (multiPts != null)
                {
                    _updatesService.SetState(multiPts, caption);
                }
                else
                {
                    ProcessUpdates(result, null, true);
                }

                callback.SafeInvoke(result);
            },
                                                   faultCallback);
        }