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); }
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(); } } }