Example #1
0
 public override void Read(BinaryReader reader)
 {
     this.id   = Tl.Parse <InputPhoto>(reader);
     this.crop = Tl.Parse <InputPhotoCrop>(reader);
 }
Example #2
0
 public InputMediaPhotoConstructor(InputPhoto id)
 {
     this.id = id;
 }
Example #3
0
 public InputChatPhotoConstructor(InputPhoto id, InputPhotoCrop crop)
 {
     this.id   = id;
     this.crop = crop;
 }
Example #4
0
        private void OnDialogSelected(object sender, DialogModel model)
        {
            InputPeer inputPeer = null;

            if (!(model is DialogModelPlain))
            {
                return;
            }

            DialogModelPlain dmp = (DialogModelPlain)model;

            if (fromMedia == 1)
            {
                MessageMedia media = MediaTransitionHelper.Instance.Media;

                InputMedia im = null;
                if (media.Constructor == Constructor.messageMediaPhoto)
                {
                    MessageMediaPhotoConstructor mmpc = (MessageMediaPhotoConstructor)media;
                    InputPhoto ip = TL.inputPhoto(((PhotoConstructor)mmpc.photo).id, ((PhotoConstructor)mmpc.photo).access_hash);

                    im = TL.inputMediaPhoto(ip);
                }
                else if (media.Constructor == Constructor.messageMediaVideo)
                {
                    MessageMediaVideoConstructor mmvc = (MessageMediaVideoConstructor)media;
                    InputVideo iv = TL.inputVideo(((VideoConstructor)mmvc.video).id, ((VideoConstructor)mmvc.video).access_hash);

                    im = TL.inputMediaVideo(iv);
                }
                else if (media.Constructor == Constructor.messageMediaGeo)
                {
                    MessageMediaGeoConstructor mmgc = (MessageMediaGeoConstructor)media;
                    GeoPointConstructor        gpc  = (GeoPointConstructor)mmgc.geo;

                    InputGeoPoint point = TL.inputGeoPoint(gpc.lat, gpc.lng);
                    im = TL.inputMediaGeoPoint(point);
                }

                if (im != null)
                {
                    dmp.SendMedia(im);
                    NavigationService.GoBack();
                }

                return;
            }

            if (messageId.Count == 0)
            {
                logger.error("error forwarding, no messageId");
            }

            Peer peer = model.Peer;

            if (model.IsChat)
            {
                inputPeer = TL.inputPeerChat(((PeerChatConstructor)peer).chat_id);
            }
            else
            {
                inputPeer = TL.inputPeerContact(((PeerUserConstructor)peer).user_id);
            }

            DoForwardMessages(inputPeer);

            int modelId = TelegramSession.Instance.Dialogs.Model.Dialogs.IndexOf(model);

            NavigationService.Navigate(new Uri("/UI/Pages/DialogPage.xaml?modelId=" + modelId, UriKind.Relative));
        }