Exemple #1
0
        private void Image_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            FrameworkElement frameworkElement = sender as FrameworkElement;

            if (frameworkElement == null)
            {
                return;
            }
            OutboundPhotoAttachment dataContext = frameworkElement.DataContext as OutboundPhotoAttachment;

            if (dataContext == null || dataContext.UploadState != OutboundAttachmentUploadState.NotStarted && dataContext.UploadState != OutboundAttachmentUploadState.Failed)
            {
                return;
            }
            this.WallPostVM.UploadAttachment((IOutboundAttachment)dataContext, null);
        }
        private void ProcessInputData()
        {
            Photo parameterForIdAndReset1 = ParametersRepository.GetParameterForIdAndReset("PickedPhoto") as Photo;

            if (parameterForIdAndReset1 != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment)OutboundPhotoAttachment.CreateForChoosingExistingPhoto(parameterForIdAndReset1, 0, false, PostType.WallPost));
            }
            VKClient.Common.Backend.DataObjects.Video parameterForIdAndReset2 = ParametersRepository.GetParameterForIdAndReset("PickedVideo") as VKClient.Common.Backend.DataObjects.Video;
            if (parameterForIdAndReset2 != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment) new OutboundVideoAttachment(parameterForIdAndReset2));
            }
            AudioObj parameterForIdAndReset3 = ParametersRepository.GetParameterForIdAndReset("PickedAudio") as AudioObj;

            if (parameterForIdAndReset3 != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment) new OutboundAudioAttachment(parameterForIdAndReset3));
            }
            Doc parameterForIdAndReset4 = ParametersRepository.GetParameterForIdAndReset("PickedDocument") as Doc;

            if (parameterForIdAndReset4 != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment) new OutboundDocumentAttachment(parameterForIdAndReset4));
            }
            List <Stream> parameterForIdAndReset5 = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotos") as List <Stream>;
            List <Stream> parameterForIdAndReset6 = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotosPreviews") as List <Stream>;

            if (parameterForIdAndReset5 != null)
            {
                for (int index = 0; index < parameterForIdAndReset5.Count; ++index)
                {
                    Stream stream1       = parameterForIdAndReset5[index];
                    Stream stream2       = parameterForIdAndReset6[index];
                    long   userOrGroupId = 0;
                    int    num1          = 0;
                    Stream previewStream = stream2;
                    int    num2          = 0;
                    this._commentVM.AddAttachment((IOutboundAttachment)OutboundPhotoAttachment.CreateForUploadNewPhoto(stream1, userOrGroupId, num1 != 0, previewStream, (PostType)num2));
                }
                this.GroupDiscussionVM.SetInProgress(true, CommonResources.WallPost_UploadingAttachments);
                this._commentVM.UploadAttachments();
            }
            FileOpenPickerContinuationEventArgs parameterForIdAndReset7 = ParametersRepository.GetParameterForIdAndReset("FilePicked") as FileOpenPickerContinuationEventArgs;

            if ((parameterForIdAndReset7 == null || !parameterForIdAndReset7.Files.Any <StorageFile>()) && !ParametersRepository.Contains("PickedPhotoDocuments"))
            {
                return;
            }
            object parameterForIdAndReset8 = ParametersRepository.GetParameterForIdAndReset("FilePickedType");
            IReadOnlyList <StorageFile> storageFileList = parameterForIdAndReset7 != null ? parameterForIdAndReset7.Files : (IReadOnlyList <StorageFile>)ParametersRepository.GetParameterForIdAndReset("PickedPhotoDocuments");
            AttachmentType result;

            if (parameterForIdAndReset8 == null || !Enum.TryParse <AttachmentType>(parameterForIdAndReset8.ToString(), out result))
            {
                return;
            }
            foreach (StorageFile file in (IEnumerable <StorageFile>)storageFileList)
            {
                if (result != AttachmentType.VideoFromPhone)
                {
                    if (result == AttachmentType.DocumentFromPhone || result == AttachmentType.DocumentPhoto)
                    {
                        this._commentVM.AddAttachment((IOutboundAttachment) new OutboundUploadDocumentAttachment(file));
                        this._commentVM.UploadAttachments();
                    }
                }
                else
                {
                    this._commentVM.AddAttachment((IOutboundAttachment) new OutboundUploadVideoAttachment(file, true, 0L));
                    this._commentVM.UploadAttachments();
                }
            }
        }
Exemple #3
0
        private bool HandleInputParams(NavigationEventArgs e = null)
        {
            if (ParametersRepository.GetParameterForIdAndReset("GoPickImage") != null)
            {
                this.ShowPhotoChooser(true);
                return(true);
            }
            string text = ParametersRepository.GetParameterForIdAndReset("NewMessageContents") as string;

            if (!string.IsNullOrEmpty(text))
            {
                this.WallPostVM.Text = text;
            }
            GeoCoordinate geoCoordinate = ParametersRepository.GetParameterForIdAndReset("NewPositionToBeAttached") as GeoCoordinate;

            if (geoCoordinate != null)
            {
                OutboundGeoAttachment attachment = new OutboundGeoAttachment(geoCoordinate.Latitude, geoCoordinate.Longitude);
                this.WallPostVM.AddAttachment(attachment);
            }
            Poll poll = ParametersRepository.GetParameterForIdAndReset("UpdatedPoll") as Poll;

            if (poll != null)
            {
                IEnumerable <IOutboundAttachment> arg_B2_0 = this.WallPostVM.Attachments;
                Func <IOutboundAttachment, bool>  arg_B2_1 = new Func <IOutboundAttachment, bool>((a) => { return(a is OutboundPollAttachment); });

                OutboundPollAttachment outboundPollAttachment = Enumerable.FirstOrDefault <IOutboundAttachment>(arg_B2_0, arg_B2_1) as OutboundPollAttachment;
                if (outboundPollAttachment != null)
                {
                    outboundPollAttachment.Poll = poll;
                }
                else
                {
                    OutboundPollAttachment attachment2 = new OutboundPollAttachment(poll);
                    this.WallPostVM.AddAttachment(attachment2);
                }
            }
            Stream        stream = ParametersRepository.GetParameterForIdAndReset("ChoosenPhoto") as Stream;
            List <Stream> list   = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotos") as List <Stream>;
            List <Stream> list2  = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotosPreviews") as List <Stream>;

            if (stream != null)
            {
                if (!this._fromPhotoPicker || this._isForwardNav)
                {
                    OutboundPhotoAttachment attachment3 = OutboundPhotoAttachment.CreateForUploadNewPhoto(stream, this.WallPostVM.UserOrGroupId, this.WallPostVM.IsGroup, null, PostType.WallPost);
                    this.WallPostVM.AddAttachment(attachment3);
                    this.WallPostVM.UploadAttachments();
                }
            }
            else if (list != null)
            {
                if (!this._fromPhotoPicker || this._isForwardNav)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        Stream arg_1C4_0     = list[i];
                        Stream previewStream = null;
                        if (list2 != null && list2.Count > i)
                        {
                            previewStream = list2[i];
                        }
                        OutboundPhotoAttachment attachment4 = OutboundPhotoAttachment.CreateForUploadNewPhoto(arg_1C4_0, this.WallPostVM.UserOrGroupId, this.WallPostVM.IsGroup, previewStream, PostType.WallPost);
                        this.WallPostVM.AddAttachment(attachment4);
                    }
                    this.WallPostVM.UploadAttachments();
                }
            }
            else if (this.WallPostVM.GoDirectlyToPhotoChooser && e != null && e.IsNavigationInitiator)
            {
                Navigator.Current.GoBack();
            }
            Photo photo = ParametersRepository.GetParameterForIdAndReset("PickedPhoto") as Photo;

            if (photo != null)
            {
                OutboundPhotoAttachment attachment5 = OutboundPhotoAttachment.CreateForChoosingExistingPhoto(photo, this.WallPostVM.UserOrGroupId, this.WallPostVM.IsGroup, PostType.WallPost);
                this.WallPostVM.AddAttachment(attachment5);
            }
            VKClient.Common.Backend.DataObjects.Video video = ParametersRepository.GetParameterForIdAndReset("PickedVideo") as VKClient.Common.Backend.DataObjects.Video;
            if (video != null)
            {
                OutboundVideoAttachment attachment6 = new OutboundVideoAttachment(video);
                this.WallPostVM.AddAttachment(attachment6);
            }
            AudioObj audioObj = ParametersRepository.GetParameterForIdAndReset("PickedAudio") as AudioObj;

            if (audioObj != null)
            {
                OutboundAudioAttachment attachment7 = new OutboundAudioAttachment(audioObj);
                this.WallPostVM.AddAttachment(attachment7);
            }
            Doc doc = ParametersRepository.GetParameterForIdAndReset("PickedDocument") as Doc;

            if (doc != null)
            {
                OutboundDocumentAttachment attachment8 = new OutboundDocumentAttachment(doc);
                this.WallPostVM.AddAttachment(attachment8);
            }
            TimerAttachment timerAttachment = ParametersRepository.GetParameterForIdAndReset("PickedTimer") as TimerAttachment;

            if (timerAttachment != null)
            {
                OutboundTimerAttachment           attachment9 = new OutboundTimerAttachment(timerAttachment);
                IEnumerable <IOutboundAttachment> arg_326_0   = this.WallPostVM.Attachments;
                Func <IOutboundAttachment, bool>  arg_326_1   = new Func <IOutboundAttachment, bool>((a) => { return(a.AttachmentId == "timestamp"); });

                IOutboundAttachment outboundAttachment = Enumerable.FirstOrDefault <IOutboundAttachment>(arg_326_0, arg_326_1);
                if (outboundAttachment != null)
                {
                    int index = this.WallPostVM.Attachments.IndexOf(outboundAttachment);
                    this.WallPostVM.RemoveAttachment(outboundAttachment);
                    this.WallPostVM.InsertAttachment(index, attachment9);
                }
                else
                {
                    this.WallPostVM.AddAttachment(attachment9);
                }
                this.WallPostVM.FromGroup = true;
            }
            FileOpenPickerContinuationEventArgs fileOpenPickerContinuationEventArgs = ParametersRepository.GetParameterForIdAndReset("FilePicked") as FileOpenPickerContinuationEventArgs;

            if ((fileOpenPickerContinuationEventArgs != null && Enumerable.Any <StorageFile>(fileOpenPickerContinuationEventArgs.Files)) || ParametersRepository.Contains("PickedPhotoDocuments"))
            {
                object parameterForIdAndReset = ParametersRepository.GetParameterForIdAndReset("FilePickedType");
                IReadOnlyList <StorageFile> arg_3DA_0;
                if (fileOpenPickerContinuationEventArgs == null)
                {
                    IReadOnlyList <StorageFile> readOnlyList = (List <StorageFile>)ParametersRepository.GetParameterForIdAndReset("PickedPhotoDocuments");
                    arg_3DA_0 = readOnlyList;
                }
                else
                {
                    arg_3DA_0 = fileOpenPickerContinuationEventArgs.Files;
                }
                IReadOnlyList <StorageFile> readOnlyList2 = arg_3DA_0;
                AttachmentType attachmentType;
                if (parameterForIdAndReset != null && Enum.TryParse <AttachmentType>(parameterForIdAndReset.ToString(), out attachmentType))
                {
                    using (IEnumerator <StorageFile> enumerator = readOnlyList2.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            StorageFile current = enumerator.Current;
                            if (attachmentType != AttachmentType.VideoFromPhone)
                            {
                                if (attachmentType == AttachmentType.DocumentFromPhone || attachmentType == AttachmentType.DocumentPhoto)
                                {
                                    OutboundUploadDocumentAttachment attachment10 = new OutboundUploadDocumentAttachment(current);
                                    this.WallPostVM.AddAttachment(attachment10);
                                    this.WallPostVM.UploadAttachments();
                                }
                            }
                            else
                            {
                                long groupId = this.WallPostVM.FromGroup ? this.WallPostVM.UserOrGroupId : 0L;
                                OutboundUploadVideoAttachment attachment11 = new OutboundUploadVideoAttachment(current, true, groupId);
                                this.WallPostVM.AddAttachment(attachment11);
                                this.WallPostVM.UploadAttachments();
                            }
                        }
                    }
                }
            }
            List <StorageFile> list3 = ParametersRepository.GetParameterForIdAndReset("ChosenDocuments") as List <StorageFile>;

            if (list3 != null)
            {
                IEnumerable <StorageFile> arg_4D4_0 = list3;
                Func <StorageFile, OutboundUploadDocumentAttachment> arg_4D4_1 = new Func <StorageFile, OutboundUploadDocumentAttachment>((chosenDocument) => new OutboundUploadDocumentAttachment(chosenDocument));
                using (IEnumerator <OutboundUploadDocumentAttachment> enumerator2 = Enumerable.Select <StorageFile, OutboundUploadDocumentAttachment>(arg_4D4_0, arg_4D4_1).GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        OutboundUploadDocumentAttachment current2 = enumerator2.Current;
                        this.WallPostVM.AddAttachment(current2);
                    }
                }
                this.WallPostVM.UploadAttachments();
            }
            List <StorageFile> list4 = ParametersRepository.GetParameterForIdAndReset("ChosenVideos") as List <StorageFile>;

            if (list4 != null)
            {
                IEnumerable <StorageFile> arg_550_0 = list4;
                Func <StorageFile, OutboundUploadVideoAttachment> arg_550_1 = new Func <StorageFile, OutboundUploadVideoAttachment>((chosenDocument) => new OutboundUploadVideoAttachment(chosenDocument, true, 0L));
                using (IEnumerator <OutboundUploadVideoAttachment> enumerator3 = Enumerable.Select <StorageFile, OutboundUploadVideoAttachment>(arg_550_0, arg_550_1).GetEnumerator())
                {
                    while (enumerator3.MoveNext())
                    {
                        OutboundUploadVideoAttachment current3 = enumerator3.Current;
                        this.WallPostVM.AddAttachment(current3);
                    }
                }
                this.WallPostVM.UploadAttachments();
            }
            return(false);
        }
Exemple #4
0
        private void ProcessInputData()
        {
            Group group = ParametersRepository.GetParameterForIdAndReset("PickedGroupForRepost") as Group;

            if (group != null)
            {
                this.Share(group.id, group.name);
            }
            Photo photo = ParametersRepository.GetParameterForIdAndReset("PickedPhoto") as Photo;

            if (photo != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment)OutboundPhotoAttachment.CreateForChoosingExistingPhoto(photo, 0L, false, PostType.WallPost));
            }
            VKClient.Common.Backend.DataObjects.Video video = ParametersRepository.GetParameterForIdAndReset("PickedVideo") as VKClient.Common.Backend.DataObjects.Video;
            if (video != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment) new OutboundVideoAttachment(video));
            }
            AudioObj audio = ParametersRepository.GetParameterForIdAndReset("PickedAudio") as AudioObj;

            if (audio != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment) new OutboundAudioAttachment(audio));
            }
            Doc pickedDocument = ParametersRepository.GetParameterForIdAndReset("PickedDocument") as Doc;

            if (pickedDocument != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment) new OutboundDocumentAttachment(pickedDocument));
            }
            List <Stream> streamList1 = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotos") as List <Stream>;
            List <Stream> streamList2 = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotosPreviews") as List <Stream>;

            if (streamList1 != null && streamList2 != null)
            {
                for (int index = 0; index < streamList1.Count; ++index)
                {
                    Stream stream1       = streamList1[index];
                    Stream stream2       = streamList2[index];
                    long   userOrGroupId = 0;
                    int    num1          = 0;
                    Stream previewStream = stream2;
                    int    num2          = 0;
                    this._commentVM.AddAttachment((IOutboundAttachment)OutboundPhotoAttachment.CreateForUploadNewPhoto(stream1, userOrGroupId, num1 != 0, previewStream, (PostType)num2));
                }
                this._viewModel.SetInProgress(true, CommonResources.WallPost_UploadingAttachments);
                this._commentVM.UploadAttachments();
            }
            FileOpenPickerContinuationEventArgs continuationEventArgs = ParametersRepository.GetParameterForIdAndReset("FilePicked") as FileOpenPickerContinuationEventArgs;

            if ((continuationEventArgs == null || !(continuationEventArgs.Files).Any <StorageFile>()) && !ParametersRepository.Contains("PickedPhotoDocument"))
            {
                return;
            }
            object         parameterForIdAndReset = ParametersRepository.GetParameterForIdAndReset("FilePickedType");
            StorageFile    file = continuationEventArgs != null ? (continuationEventArgs.Files).First <StorageFile>() : (StorageFile)ParametersRepository.GetParameterForIdAndReset("PickedPhotoDocument");
            AttachmentType result;

            if (parameterForIdAndReset == null || !Enum.TryParse <AttachmentType>(parameterForIdAndReset.ToString(), out result))
            {
                return;
            }
            if (result != AttachmentType.VideoFromPhone)
            {
                if (result != AttachmentType.DocumentFromPhone && result != AttachmentType.DocumentPhoto)
                {
                    return;
                }
                this._commentVM.AddAttachment((IOutboundAttachment) new OutboundUploadDocumentAttachment(file));
                this._commentVM.UploadAttachments();
            }
            else
            {
                this._commentVM.AddAttachment((IOutboundAttachment) new OutboundUploadVideoAttachment(file, true, 0L));
                this._commentVM.UploadAttachments();
            }
        }
Exemple #5
0
        private void ProcessInputData()
        {
            Group parameterForIdAndReset1 = ParametersRepository.GetParameterForIdAndReset("PickedGroupForRepost") as Group;

            if (parameterForIdAndReset1 != null)
            {
                this.Share(parameterForIdAndReset1.id, parameterForIdAndReset1.name);
            }
            Photo parameterForIdAndReset2 = ParametersRepository.GetParameterForIdAndReset("PickedPhoto") as Photo;

            if (parameterForIdAndReset2 != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment)OutboundPhotoAttachment.CreateForChoosingExistingPhoto(parameterForIdAndReset2, 0, false, PostType.WallPost));
            }
            VKClient.Common.Backend.DataObjects.Video parameterForIdAndReset3 = ParametersRepository.GetParameterForIdAndReset("PickedVideo") as VKClient.Common.Backend.DataObjects.Video;
            if (parameterForIdAndReset3 != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment) new OutboundVideoAttachment(parameterForIdAndReset3));
            }
            AudioObj parameterForIdAndReset4 = ParametersRepository.GetParameterForIdAndReset("PickedAudio") as AudioObj;

            if (parameterForIdAndReset4 != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment) new OutboundAudioAttachment(parameterForIdAndReset4));
            }
            Doc parameterForIdAndReset5 = ParametersRepository.GetParameterForIdAndReset("PickedDocument") as Doc;

            if (parameterForIdAndReset5 != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment) new OutboundDocumentAttachment(parameterForIdAndReset5));
            }
            List <Stream> parameterForIdAndReset6 = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotos") as List <Stream>;
            List <Stream> parameterForIdAndReset7 = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotosPreviews") as List <Stream>;

            if (parameterForIdAndReset6 != null)
            {
                for (int index = 0; index < parameterForIdAndReset6.Count; ++index)
                {
                    Stream stream1       = parameterForIdAndReset6[index];
                    Stream stream2       = parameterForIdAndReset7[index];
                    long   userOrGroupId = 0;
                    int    num1          = 0;
                    Stream previewStream = stream2;
                    int    num2          = 0;
                    this._commentVM.AddAttachment((IOutboundAttachment)OutboundPhotoAttachment.CreateForUploadNewPhoto(stream1, userOrGroupId, num1 != 0, previewStream, (PostType)num2));
                }
                this.PostCommentsVM.SetInProgress(true, CommonResources.WallPost_UploadingAttachments);
                this._commentVM.UploadAttachments();
            }
            FileOpenPickerContinuationEventArgs parameterForIdAndReset8 = ParametersRepository.GetParameterForIdAndReset("FilePicked") as FileOpenPickerContinuationEventArgs;

            if ((parameterForIdAndReset8 == null || !Enumerable.Any <StorageFile>(parameterForIdAndReset8.Files)) && !ParametersRepository.Contains("PickedPhotoDocuments"))
            {
                return;
            }
            object parameterForIdAndReset9 = ParametersRepository.GetParameterForIdAndReset("FilePickedType");
            IReadOnlyList <StorageFile> storageFileList = parameterForIdAndReset8 != null ? parameterForIdAndReset8.Files : (IReadOnlyList <StorageFile>)ParametersRepository.GetParameterForIdAndReset("PickedPhotoDocuments");
            AttachmentType attachmentType;

            // ISSUE: explicit reference operation
            // ISSUE: cast to a reference type
            if (parameterForIdAndReset9 == null || !Enum.TryParse <AttachmentType>((parameterForIdAndReset9).ToString(), out attachmentType))
            {
                return;
            }
            IEnumerator <StorageFile> enumerator = ((IEnumerable <StorageFile>)storageFileList).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    StorageFile current = enumerator.Current;
                    if (attachmentType != AttachmentType.VideoFromPhone)
                    {
                        if (attachmentType == AttachmentType.DocumentFromPhone || attachmentType == AttachmentType.DocumentPhoto)
                        {
                            this._commentVM.AddAttachment((IOutboundAttachment) new OutboundUploadDocumentAttachment(current));
                            this._commentVM.UploadAttachments();
                        }
                    }
                    else
                    {
                        this._commentVM.AddAttachment((IOutboundAttachment) new OutboundUploadVideoAttachment(current, true, 0L));
                        this._commentVM.UploadAttachments();
                    }
                }
            }
            finally
            {
                if (enumerator != null)
                {
                    enumerator.Dispose();
                }
            }
        }
Exemple #6
0
        public static void HandleInputParams(WallPostViewModel wallPostVM)
        {
            GeoCoordinate parameterForIdAndReset1 = ParametersRepository.GetParameterForIdAndReset("NewPositionToBeAttached") as GeoCoordinate;

            if (parameterForIdAndReset1 != null)
            {
                OutboundGeoAttachment outboundGeoAttachment = new OutboundGeoAttachment(parameterForIdAndReset1.Latitude, parameterForIdAndReset1.Longitude);
                wallPostVM.AddAttachment((IOutboundAttachment)outboundGeoAttachment);
            }
            List <Stream> parameterForIdAndReset2 = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotos") as List <Stream>;
            List <Stream> parameterForIdAndReset3 = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotosPreviews") as List <Stream>;

            if (parameterForIdAndReset2 != null)
            {
                for (int index = 0; index < parameterForIdAndReset2.Count; ++index)
                {
                    Stream stream1       = parameterForIdAndReset2[index];
                    Stream stream2       = parameterForIdAndReset3[index];
                    long   userOrGroupId = wallPostVM.UserOrGroupId;
                    int    num1          = wallPostVM.IsGroup ? 1 : 0;
                    Stream previewStream = stream2;
                    int    num2          = 0;
                    OutboundPhotoAttachment forUploadNewPhoto = OutboundPhotoAttachment.CreateForUploadNewPhoto(stream1, userOrGroupId, num1 != 0, previewStream, (PostType)num2);
                    wallPostVM.AddAttachment((IOutboundAttachment)forUploadNewPhoto);
                }
                wallPostVM.UploadAttachments();
            }
            Photo parameterForIdAndReset4 = ParametersRepository.GetParameterForIdAndReset("PickedPhoto") as Photo;

            if (parameterForIdAndReset4 != null)
            {
                OutboundPhotoAttachment choosingExistingPhoto = OutboundPhotoAttachment.CreateForChoosingExistingPhoto(parameterForIdAndReset4, wallPostVM.UserOrGroupId, wallPostVM.IsGroup, PostType.WallPost);
                wallPostVM.AddAttachment((IOutboundAttachment)choosingExistingPhoto);
            }
            VKClient.Common.Backend.DataObjects.Video parameterForIdAndReset5 = ParametersRepository.GetParameterForIdAndReset("PickedVideo") as VKClient.Common.Backend.DataObjects.Video;
            if (parameterForIdAndReset5 != null)
            {
                OutboundVideoAttachment outboundVideoAttachment = new OutboundVideoAttachment(parameterForIdAndReset5);
                wallPostVM.AddAttachment((IOutboundAttachment)outboundVideoAttachment);
            }
            AudioObj parameterForIdAndReset6 = ParametersRepository.GetParameterForIdAndReset("PickedAudio") as AudioObj;

            if (parameterForIdAndReset6 != null)
            {
                OutboundAudioAttachment outboundAudioAttachment = new OutboundAudioAttachment(parameterForIdAndReset6);
                wallPostVM.AddAttachment((IOutboundAttachment)outboundAudioAttachment);
            }
            Doc parameterForIdAndReset7 = ParametersRepository.GetParameterForIdAndReset("PickedDocument") as Doc;

            if (parameterForIdAndReset7 != null)
            {
                OutboundDocumentAttachment documentAttachment = new OutboundDocumentAttachment(parameterForIdAndReset7);
                wallPostVM.AddAttachment((IOutboundAttachment)documentAttachment);
            }
            FileOpenPickerContinuationEventArgs parameterForIdAndReset8 = ParametersRepository.GetParameterForIdAndReset("FilePicked") as FileOpenPickerContinuationEventArgs;

            if ((parameterForIdAndReset8 == null || !Enumerable.Any <StorageFile>(parameterForIdAndReset8.Files)) && !ParametersRepository.Contains("PickedPhotoDocuments"))
            {
                return;
            }
            object parameterForIdAndReset9 = ParametersRepository.GetParameterForIdAndReset("FilePickedType");
            IReadOnlyList <StorageFile> storageFileList = parameterForIdAndReset8 != null ? parameterForIdAndReset8.Files : (IReadOnlyList <StorageFile>)ParametersRepository.GetParameterForIdAndReset("PickedPhotoDocuments");
            AttachmentType attachmentType;

            // ISSUE: explicit reference operation
            // ISSUE: cast to a reference type
            if (parameterForIdAndReset9 == null || !Enum.TryParse <AttachmentType>((parameterForIdAndReset9).ToString(), out attachmentType))
            {
                return;
            }
            IEnumerator <StorageFile> enumerator = ((IEnumerable <StorageFile>)storageFileList).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    StorageFile current = enumerator.Current;
                    if (attachmentType != AttachmentType.VideoFromPhone)
                    {
                        if (attachmentType == AttachmentType.DocumentFromPhone || attachmentType == AttachmentType.DocumentPhoto)
                        {
                            OutboundUploadDocumentAttachment documentAttachment = new OutboundUploadDocumentAttachment(current);
                            wallPostVM.AddAttachment((IOutboundAttachment)documentAttachment);
                            wallPostVM.UploadAttachments();
                        }
                    }
                    else
                    {
                        OutboundUploadVideoAttachment uploadVideoAttachment = new OutboundUploadVideoAttachment(current, true, 0L);
                        wallPostVM.AddAttachment((IOutboundAttachment)uploadVideoAttachment);
                        wallPostVM.UploadAttachments();
                    }
                }
            }
            finally
            {
                if (enumerator != null)
                {
                    enumerator.Dispose();
                }
            }
        }
Exemple #7
0
 internal void AddExistingPhotoAttachment(Photo pickedPhoto)
 {
     this.Attachments.Add((IOutboundAttachment)OutboundPhotoAttachment.CreateForChoosingExistingPhoto(pickedPhoto, 0, false, PostType.Message));
 }
Exemple #8
0
 public void AddPictureAttachment(Stream stream, Stream previewStream)
 {
     this.Attachments.Add((IOutboundAttachment)OutboundPhotoAttachment.CreateForUploadNewPhoto(stream, 0, false, previewStream, PostType.Message));
 }