private void AppBarButtonCheck_Click(object sender, EventArgs e) { TimerAttachment timerAttachment = new TimerAttachment() { ScheduledPublishDateTime = this._viewModel.GetScheduledDateTime() }; if (timerAttachment.ScheduledPublishDateTime > DateTime.Now.AddYears(1)) { MessageBox.Show(CommonResources.PostSchedule_InvalidPublishDate, CommonResources.Error, (MessageBoxButton)0); } else { ParametersRepository.SetParameterForId("PickedTimer", timerAttachment); Navigator.Current.GoBack(); } }
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); }