Example #1
0
        private void SendGeoLocation(LocationBubble locationBubble)
        {
            var inputPeer = GetInputPeer(locationBubble.Address, locationBubble.Party, locationBubble.ExtendedParty);
            using (var client = new FullClientDisposable(this))
            {
                var updates = TelegramUtils.RunSynchronously(
                    client.Client.Methods.MessagesSendMediaAsync(new MessagesSendMediaArgs
                    {

                        Flags = 0,
                        Peer = inputPeer,
                        Media = new InputMediaGeoPoint
                        {
                            GeoPoint = new InputGeoPoint
                            {
                                Lat = locationBubble.Latitude,
                                Long = locationBubble.Longitude
                            }
                        },
                        RandomId = GenerateRandomId(),
                    }));
                var id = GetMessageId(updates);
                locationBubble.IdService = id;
                SendToResponseDispatcher(updates,client.Client);
            }

        }
Example #2
0
 private VisualBubble MakeGeoBubble(GeoPoint geoPoint,Message message,bool isUser,bool useCurrentTime,string addressStr,string participantAddress,string name)
 {
     LocationBubble bubble;
     if (isUser)
     {
         bubble = new LocationBubble(useCurrentTime ? Time.GetNowUnixTimestamp() : (long)message.Date,
             message.Out != null ? Bubble.BubbleDirection.Outgoing : Bubble.BubbleDirection.Incoming, addressStr, null, false, this, geoPoint.Long, geoPoint.Lat,
             "", null, message.Id.ToString(CultureInfo.InvariantCulture));
     }
     else
     {
         bubble = new LocationBubble(useCurrentTime ? Time.GetNowUnixTimestamp() : (long)message.Date,
             message.Out != null ? Bubble.BubbleDirection.Outgoing : Bubble.BubbleDirection.Incoming, addressStr, participantAddress, true, this, geoPoint.Long, geoPoint.Lat,
             "", null, message.Id.ToString(CultureInfo.InvariantCulture));
     }
     if (name != null) 
     {
         bubble.Name = name;
     }
     if (bubble.Direction == Bubble.BubbleDirection.Outgoing)
     {
         bubble.Status = Bubble.BubbleStatus.Sent;
     }
     return bubble;
 }