Ejemplo n.º 1
0
 protected override void HandleOnNavigatedTo(NavigationEventArgs e)
 {
     base.HandleOnNavigatedTo(e);
     if (!this._isInitialized)
     {
         base.DataContext = (new ChatEditViewModel(long.Parse(((Page)this).NavigationContext.QueryString["ChatId"]), ((Page)this).NavigationService));
         this.ChatEditVM.Reload(true);
         this._isInitialized = true;
     }
     else
     {
         List <User> parameterForIdAndReset1 = ParametersRepository.GetParameterForIdAndReset("SelectedUsers") as List <User>;
         if (parameterForIdAndReset1 != null && Enumerable.Any <User>(parameterForIdAndReset1))
         {
             this.ChatEditVM.AddMember((User)Enumerable.First <User>(parameterForIdAndReset1));
         }
         List <Stream> parameterForIdAndReset2 = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotos") as List <Stream>;
         if (parameterForIdAndReset2 == null || !Enumerable.Any <Stream>(parameterForIdAndReset2))
         {
             return;
         }
         Rect crop = new Rect();
         if (ParametersRepository.Contains("UserPicSquare"))
         {
             crop = (Rect)ParametersRepository.GetParameterForIdAndReset("UserPicSquare");
         }
         this.ChatEditVM.UpdatePhoto(parameterForIdAndReset2[0], crop);
     }
 }
Ejemplo n.º 2
0
        private void ProcessInputParameters()
        {
            Group group = ParametersRepository.GetParameterForIdAndReset("PickedGroupForRepost") as Group;

            if (group != null)
            {
                foreach (IVirtualizable virtualizable in (Collection <IVirtualizable>) this._viewModel.WallVM.Collection)
                {
                    WallPostItem wallPostItem = virtualizable as WallPostItem;
                    if (wallPostItem != null && wallPostItem.LikesAndCommentsItem != null)
                    {
                        if (wallPostItem.LikesAndCommentsItem.ShareInGroupIfApplicable(group.id, group.name))
                        {
                            break;
                        }
                    }
                }
            }
            List <Stream> streamList = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotos") as List <Stream>;
            Rect          rect       = new Rect();

            if (ParametersRepository.Contains("UserPicSquare"))
            {
                rect = (Rect)ParametersRepository.GetParameterForIdAndReset("UserPicSquare");
            }
            if (streamList == null || streamList.Count <= 0)
            {
                return;
            }
            this._viewModel.UploadProfilePhoto(streamList[0], rect);
        }
Ejemplo n.º 3
0
 protected override void HandleOnNavigatingFrom(NavigatingCancelEventArgs e)
 {
     base.HandleOnNavigatingFrom(e);
     if (e.NavigationMode != NavigationMode.Back || ParametersRepository.Contains("ValidationResponse"))
     {
         return;
     }
     ParametersRepository.SetParameterForId("ValidationResponse", new ValidationUserResponse()
     {
         IsSucceeded = false
     });
 }
Ejemplo n.º 4
0
        private void HandleInputParams()
        {
            List <Stream> parameterForIdAndReset = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotos") as List <Stream>;
            Rect          rect = new Rect();

            if (ParametersRepository.Contains("UserPicSquare"))
            {
                rect = (Rect)ParametersRepository.GetParameterForIdAndReset("UserPicSquare");
            }
            if (parameterForIdAndReset == null || parameterForIdAndReset.Count <= 0)
            {
                return;
            }
            this.RegistrationVM.SetUserPhoto(parameterForIdAndReset[0], rect);
        }
Ejemplo n.º 5
0
 protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
 {
     base.OnNavigatingFrom(e);
     if (e.NavigationMode != NavigationMode.Back)
     {
         return;
     }
     // ISSUE: method pointer
     this.webBrowser.NavigationFailed -= (new NavigationFailedEventHandler(this.BrowserOnNavigationFailed));
     this.webBrowser.Navigating       -= (new EventHandler <NavigatingEventArgs>(this.BrowserOnNavigating));
     if (!this._isMoneyTransfer)
     {
         if (ParametersRepository.Contains("ValidationResponse"))
         {
             return;
         }
         ParametersRepository.SetParameterForId("ValidationResponse", new ValidationUserResponse()
         {
             IsSucceeded = false
         });
     }
     else if (this._isAcceptMoneyTransfer)
     {
         if (ParametersRepository.Contains("MoneyTransferAcceptedResponse"))
         {
             return;
         }
         ParametersRepository.SetParameterForId("MoneyTransferAcceptedResponse", new MoneyTransferAcceptedResponse()
         {
             IsSucceeded = false
         });
     }
     else
     {
         if (ParametersRepository.Contains("MoneyTransferSentResponse"))
         {
             return;
         }
         ParametersRepository.SetParameterForId("MoneyTransferSentResponse", new MoneyTransferAcceptedResponse()
         {
             IsSucceeded = false
         });
     }
 }
Ejemplo n.º 6
0
        private void HandleInputParams()
        {
            List <User> parameterForIdAndReset1 = ParametersRepository.GetParameterForIdAndReset("SelectedUsers") as List <User>;

            if (parameterForIdAndReset1 != null && parameterForIdAndReset1.Count >= 1)
            {
                this.VM.Partner = parameterForIdAndReset1[0];
            }
            List <Stream> parameterForIdAndReset2 = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotos") as List <Stream>;
            Rect          rect = new Rect();

            if (ParametersRepository.Contains("UserPicSquare"))
            {
                rect = (Rect)ParametersRepository.GetParameterForIdAndReset("UserPicSquare");
            }
            if (parameterForIdAndReset2 == null || parameterForIdAndReset2.Count <= 0)
            {
                return;
            }
            this.VM.UploadUserPhoto(parameterForIdAndReset2[0], rect);
        }
Ejemplo n.º 7
0
 protected override void HandleOnNavigatedTo(NavigationEventArgs e)
 {
     base.HandleOnNavigatedTo(e);
     if (!this._isInitialized)
     {
         this._viewModel  = new TransfersListViewModel();
         base.DataContext = this._viewModel;
         this._viewModel.Inbox.LoadData(false, false, null, false);
         this._isInitialized = true;
     }
     else
     {
         if (!ParametersRepository.Contains("SelectedUsers"))
         {
             return;
         }
         User targetUser = Enumerable.First <User>((List <User>)ParametersRepository.GetParameterForIdAndReset("SelectedUsers"));
         this.SkipNextNavigationParametersRepositoryClearing = true;
         Navigator.Current.NavigateToSendMoneyPage(targetUser.id, targetUser, 0, "");
     }
 }
Ejemplo n.º 8
0
 protected override void HandleOnNavigatedTo(NavigationEventArgs e)
 {
     base.HandleOnNavigatedTo(e);
     if (!this._isInitialized)
     {
         BlockEditingViewModel viewModel = new BlockEditingViewModel(long.Parse(((Page)this).NavigationContext.QueryString["CommunityId"]), (User)ParametersRepository.GetParameterForIdAndReset("CommunityManagementBlockEditingUser"), (User)ParametersRepository.GetParameterForIdAndReset("CommunityManagementBlockEditingManager"), bool.Parse(((Page)this).NavigationContext.QueryString["IsEditing"]), bool.Parse(((Page)this).NavigationContext.QueryString["IsOpenedWithoutPicker"]));
         base.DataContext = viewModel;
         ApplicationBarIconButton applicationBarIconButton1 = new ApplicationBarIconButton();
         Uri uri1 = new Uri("/Resources/check.png", UriKind.Relative);
         applicationBarIconButton1.IconUri = uri1;
         string appBarMenuSave = CommonResources.AppBarMenu_Save;
         applicationBarIconButton1.Text = appBarMenuSave;
         ApplicationBarIconButton appBarButtonSave          = applicationBarIconButton1;
         ApplicationBarIconButton applicationBarIconButton2 = new ApplicationBarIconButton();
         Uri uri2 = new Uri("/Resources/appbar.cancel.rest.png", UriKind.Relative);
         applicationBarIconButton2.IconUri = uri2;
         string appBarCancel = CommonResources.AppBar_Cancel;
         applicationBarIconButton2.Text = appBarCancel;
         ApplicationBarIconButton applicationBarIconButton3 = applicationBarIconButton2;
         appBarButtonSave.Click += ((EventHandler)((p, f) =>
         {
             ((Control)this).Focus();
             viewModel.SaveChanges(((Page)this).NavigationService);
         }));
         applicationBarIconButton3.Click += ((EventHandler)((p, f) => Navigator.Current.GoBack()));
         this.ApplicationBar              = ((IApplicationBar)ApplicationBarBuilder.Build(new Color?(), new Color?(), 0.9));
         viewModel.PropertyChanged       += (PropertyChangedEventHandler)((p, f) => appBarButtonSave.IsEnabled = viewModel.IsFormEnabled);
         this.ApplicationBar.Buttons.Add(appBarButtonSave);
         this.ApplicationBar.Buttons.Add(applicationBarIconButton3);
         this._isInitialized = true;
     }
     else
     {
         if (!ParametersRepository.Contains("BlockDurationUnixTime"))
         {
             return;
         }
         this.ViewModel.UpdateDuration((int)ParametersRepository.GetParameterForIdAndReset("BlockDurationUnixTime"));
     }
 }
Ejemplo n.º 9
0
        protected override void HandleOnNavigatedTo(NavigationEventArgs e)
        {
            base.HandleOnNavigatedTo(e);
            long                  communityId = long.Parse(((Page)this).NavigationContext.QueryString["CommunityId"]);
            GroupLink             link        = ParametersRepository.Contains("CommunityLink") ? (GroupLink)ParametersRepository.GetParameterForIdAndReset("CommunityLink") :  null;
            LinkCreationViewModel viewModel   = new LinkCreationViewModel(communityId, link);

            base.DataContext = viewModel;
            ApplicationBarIconButton applicationBarIconButton1 = new ApplicationBarIconButton();
            Uri uri1 = new Uri("/Resources/check.png", UriKind.Relative);

            applicationBarIconButton1.IconUri = uri1;
            string appBarMenuSave = CommonResources.AppBarMenu_Save;

            applicationBarIconButton1.Text = appBarMenuSave;
            int num = link != null ? 1 : 0;

            applicationBarIconButton1.IsEnabled = (num != 0);
            ApplicationBarIconButton appBarButtonSave          = applicationBarIconButton1;
            ApplicationBarIconButton applicationBarIconButton2 = new ApplicationBarIconButton();
            Uri uri2 = new Uri("/Resources/appbar.cancel.rest.png", UriKind.Relative);

            applicationBarIconButton2.IconUri = uri2;
            string appBarCancel = CommonResources.AppBar_Cancel;

            applicationBarIconButton2.Text = appBarCancel;
            ApplicationBarIconButton applicationBarIconButton3 = applicationBarIconButton2;

            appBarButtonSave.Click += ((EventHandler)((p, f) =>
            {
                ((Control)this).Focus();
                viewModel.AddEditLink();
            }));
            applicationBarIconButton3.Click += ((EventHandler)((p, f) => Navigator.Current.GoBack()));
            this.ApplicationBar              = ((IApplicationBar)ApplicationBarBuilder.Build(new Color?(), new Color?(), 0.9));
            viewModel.PropertyChanged       += (PropertyChangedEventHandler)((p, f) => appBarButtonSave.IsEnabled = (viewModel.IsFormCompleted && viewModel.IsFormEnabled));
            this.ApplicationBar.Buttons.Add(appBarButtonSave);
            this.ApplicationBar.Buttons.Add(applicationBarIconButton3);
        }
Ejemplo n.º 10
0
 protected override void HandleOnNavigatedTo(NavigationEventArgs e)
 {
     base.HandleOnNavigatedTo(e);
     if (!this._isInitialized)
     {
         this._maxAllowedToSelect = int.Parse(((Page)this).NavigationContext.QueryString["MaxAllowedToSelect"]);
         long loggedInUserId = AppGlobalStateManager.Current.LoggedInUserId;
         DocumentsViewModel        parentPageViewModel = new DocumentsViewModel(loggedInUserId);
         DocumentsSectionViewModel sectionViewModel    = new DocumentsSectionViewModel(parentPageViewModel, loggedInUserId, 0, CommonResources.AllDocuments, false, true)
         {
             IsSelected = true
         };
         parentPageViewModel.Sections.Add(sectionViewModel);
         parentPageViewModel.LoadSection(0);
         base.DataContext    = parentPageViewModel;
         this._isInitialized = true;
     }
     if (e.NavigationMode != NavigationMode.Back || !ParametersRepository.Contains("FilePicked") && !ParametersRepository.Contains("PickedPhotoDocuments"))
     {
         return;
     }
     this.SkipNextNavigationParametersRepositoryClearing = true;
     Navigator.Current.GoBack();
 }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
0
 protected override void HandleOnNavigatedTo(NavigationEventArgs e)
 {
     base.HandleOnNavigatedTo(e);
     this._fromPhotoPicker = false;
     this._isForwardNav    = e.NavigationMode == 0;
     if (ParametersRepository.Contains("FromPhotoPicker"))
     {
         this._fromPhotoPicker = (bool)ParametersRepository.GetParameterForIdAndReset("FromPhotoPicker");
     }
     if (!this._isInitialized)
     {
         this._adminLevel = int.Parse(((Page)this).NavigationContext.QueryString["AdminLevel"]);
         bool isPublicPage   = ((Page)this).NavigationContext.QueryString["IsPublicPage"] == bool.TrueString;
         bool isNewTopicMode = ((Page)this).NavigationContext.QueryString["IsNewTopicMode"] == bool.TrueString;
         this._isFromWallPostPage = ((Page)this).NavigationContext.QueryString["FromWallPostPage"] == bool.TrueString;
         WallPostViewModel.Mode mode;
         // ISSUE: explicit reference operation
         // ISSUE: cast to a reference type
         Enum.TryParse <WallPostViewModel.Mode>(((Page)this).NavigationContext.QueryString["Mode"], out mode);
         WallPost parameterForIdAndReset1 = ParametersRepository.GetParameterForIdAndReset("PublishWallPost") as WallPost;
         WallPost parameterForIdAndReset2 = ParametersRepository.GetParameterForIdAndReset("EditWallPost") as WallPost;
         Comment  parameterForIdAndReset3 = ParametersRepository.GetParameterForIdAndReset("EditWallComment") as Comment;
         Comment  parameterForIdAndReset4 = ParametersRepository.GetParameterForIdAndReset("EditPhotoComment") as Comment;
         Comment  parameterForIdAndReset5 = ParametersRepository.GetParameterForIdAndReset("EditVideoComment") as Comment;
         Comment  parameterForIdAndReset6 = ParametersRepository.GetParameterForIdAndReset("EditProductComment") as Comment;
         Comment  parameterForIdAndReset7 = ParametersRepository.GetParameterForIdAndReset("EditDiscussionComment") as Comment;
         Dictionary <long, long> parameterForIdAndReset8  = ParametersRepository.GetParameterForIdAndReset("CidToAuthorIdDict") as Dictionary <long, long>;
         WallRepostInfo          parameterForIdAndReset9  = ParametersRepository.GetParameterForIdAndReset("WallRepostInfo") as WallRepostInfo;
         WallPostViewModel       parameterForIdAndReset10 = ParametersRepository.GetParameterForIdAndReset("NewCommentVM") as WallPostViewModel;
         this._shareContentDataProvider = ShareContentDataProviderManager.RetrieveDataProvider();
         if (this._shareContentDataProvider is ShareExternalContentDataProvider)
         {
             ((Page)this).NavigationService.ClearBackStack();
             this.ucHeader.HideSandwitchButton = true;
             this.SuppressMenu = true;
         }
         WallPostViewModel vm;
         if (parameterForIdAndReset1 != null)
         {
             vm = new WallPostViewModel(parameterForIdAndReset1, this._adminLevel, null)
             {
                 WMMode = WallPostViewModel.Mode.PublishWallPost
             }
         }
         ;
         else if (parameterForIdAndReset2 != null)
         {
             vm = new WallPostViewModel(parameterForIdAndReset2, this._adminLevel, parameterForIdAndReset9)
             {
                 WMMode = WallPostViewModel.Mode.EditWallPost
             };
             if (vm.WallRepostInfo != null)
             {
                 RepostHeaderUC repostHeaderUc1 = new RepostHeaderUC();
                 Thickness      thickness       = new Thickness(0.0, 14.0, 0.0, 14.0);
                 ((FrameworkElement)repostHeaderUc1).Margin = thickness;
                 RepostHeaderUC repostHeaderUc2 = repostHeaderUc1;
                 repostHeaderUc2.Configure(vm.WallRepostInfo, null);
                 this.wallRepostContainer.Child = ((UIElement)repostHeaderUc2);
             }
         }
         else
         {
             vm = parameterForIdAndReset3 == null ? (parameterForIdAndReset4 == null ? (parameterForIdAndReset5 == null ? (parameterForIdAndReset6 == null ? (parameterForIdAndReset7 == null ? (parameterForIdAndReset10 == null ? new WallPostViewModel(this.CommonParameters.UserOrGroupId, this.CommonParameters.IsGroup, this._adminLevel, isPublicPage, isNewTopicMode) : parameterForIdAndReset10) : WallPostViewModel.CreateEditDiscussionCommentVM(parameterForIdAndReset7, parameterForIdAndReset8)) : WallPostViewModel.CreateEditProductCommentVM(parameterForIdAndReset6)) : WallPostViewModel.CreateEditVideoCommentVM(parameterForIdAndReset5)) : WallPostViewModel.CreateEditPhotoCommentVM(parameterForIdAndReset4)) : WallPostViewModel.CreateEditWallCommentVM(parameterForIdAndReset3);
         }
         vm.IsOnPostPage = true;
         vm.WMMode       = mode;
         if (!this._fromPhotoPicker && (!e.IsNavigationInitiator || e.NavigationMode != NavigationMode.New || (mode == WallPostViewModel.Mode.NewTopic || mode == WallPostViewModel.Mode.NewWallPost)))
         {
             WallPostVMCacheManager.TryDeserializeVM(vm);
         }
         vm.PropertyChanged += new PropertyChangedEventHandler(this.vm_PropertyChanged);
         base.DataContext    = vm;
         this._isInitialized = true;
     }
     if (this.HandleInputParams(e))
     {
         return;
     }
     this.UpdateViewState();
     ListExtensions.ForEach <IOutboundAttachment>(this.WallPostVM.OutboundAttachments, (Action <IOutboundAttachment>)(a => a.SetRetryFlag()));
     if (!e.IsNavigationInitiator || e.NavigationMode != NavigationMode.New)
     {
         return;
     }
     if (this.WallPostVM.IsInNewWallPostMode || this.WallPostVM.EditWallRepost)
     {
         this.FocusTextBox();
     }
     else
     {
         if (!this.WallPostVM.IsInNewTopicMode)
         {
             return;
         }
         this.FocusTitleTextBox();
     }
 }
Ejemplo n.º 13
0
        protected override void HandleOnNavigatedTo(NavigationEventArgs e)
        {
            base.HandleOnNavigatedTo(e);
            if (this._isInitialized)
            {
                if (!ParametersRepository.Contains("SelectedUsers"))
                {
                    return;
                }
                List <User> parameterForIdAndReset = ParametersRepository.GetParameterForIdAndReset("SelectedUsers") as List <User>;
                User        user = parameterForIdAndReset != null?Enumerable.FirstOrDefault <User>(parameterForIdAndReset) :  null;

                if (user == null)
                {
                    return;
                }
                this._viewModel.AddRecipient(user);
            }
            else
            {
                long        result1      = 0;
                string      categoryName = "";
                bool        isProduct    = false;
                string      description1 = "";
                string      imageUrl1    = "";
                int         result2      = 0;
                int         result3      = 0;
                List <long> userIds1     = null;
                IDictionary <string, string> queryString = ((Page)this).NavigationContext.QueryString;
                if (queryString.ContainsKey("GiftId"))
                {
                    long.TryParse(queryString["GiftId"], out result1);
                }
                if (queryString.ContainsKey("CategoryName"))
                {
                    categoryName = queryString["CategoryName"];
                }
                if (queryString.ContainsKey("IsProduct") && queryString["IsProduct"] == bool.TrueString)
                {
                    isProduct = true;
                }
                if (ParametersRepository.Contains("Description"))
                {
                    description1 = ParametersRepository.GetParameterForIdAndReset("Description") as string;
                }
                if (ParametersRepository.Contains("ImageUrl"))
                {
                    imageUrl1 = ParametersRepository.GetParameterForIdAndReset("ImageUrl") as string;
                }
                if (ParametersRepository.Contains("Price"))
                {
                    int.TryParse(ParametersRepository.GetParameterForIdAndReset("Price").ToString(), out result2);
                }
                if (ParametersRepository.Contains("GiftsLeft"))
                {
                    int.TryParse(ParametersRepository.GetParameterForIdAndReset("GiftsLeft").ToString(), out result3);
                }
                if (ParametersRepository.Contains("UserIds"))
                {
                    userIds1 = ParametersRepository.GetParameterForIdAndReset("UserIds") as List <long>;
                    long loggedInUserId = AppGlobalStateManager.Current.LoggedInUserId;
                    if (userIds1 != null && userIds1.Contains(loggedInUserId))
                    {
                        userIds1.Remove(loggedInUserId);
                    }
                }
                GiftSendPageState giftSendPageState = null;
                if (this.State.ContainsKey("GiftSendPageState"))
                {
                    giftSendPageState = this.State["GiftSendPageState"] as GiftSendPageState;
                }
                if (giftSendPageState != null)
                {
                    string      message           = giftSendPageState.Message ?? "";
                    bool        nameAndTextPublic = giftSendPageState.AreNameAndTextPublic;
                    string      description2      = giftSendPageState.Description ?? "";
                    string      imageUrl2         = giftSendPageState.ImageUrl ?? "";
                    int         price             = giftSendPageState.Price;
                    int         giftsLeft         = giftSendPageState.GiftsLeft;
                    List <long> userIds2          = giftSendPageState.UserIds;
                    this._viewModel          = new GiftSendViewModel(result1, categoryName, isProduct, description2, imageUrl2, price, giftsLeft, ((Page)this).NavigationService, userIds2, message, nameAndTextPublic);
                    this.textBoxMessage.Text = message;
                    this.UpdateMessageTextBox();
                }
                else
                {
                    this._viewModel = new GiftSendViewModel(result1, categoryName, isProduct, description1, imageUrl1, result2, result3, ((Page)this).NavigationService, userIds1);
                }
                base.DataContext = this._viewModel;
                this._viewModel.Reload(true);
                this._isInitialized = true;
            }
        }
Ejemplo n.º 14
0
        protected override void HandleOnNavigatedTo(NavigationEventArgs e)
        {
            base.HandleOnNavigatedTo(e);
            if (!this._isInitialized)
            {
                ServicesViewModel viewModel = new ServicesViewModel(long.Parse(((Page)this).NavigationContext.QueryString["CommunityId"]));
                base.DataContext = viewModel;
                ApplicationBarIconButton applicationBarIconButton1 = new ApplicationBarIconButton();
                Uri uri1 = new Uri("/Resources/check.png", UriKind.Relative);
                applicationBarIconButton1.IconUri = uri1;
                string appBarMenuSave = CommonResources.AppBarMenu_Save;
                applicationBarIconButton1.Text = appBarMenuSave;
                ApplicationBarIconButton applicationBarIconButton2 = applicationBarIconButton1;
                ApplicationBarIconButton applicationBarIconButton3 = new ApplicationBarIconButton();
                Uri uri2 = new Uri("/Resources/appbar.cancel.rest.png", UriKind.Relative);
                applicationBarIconButton3.IconUri = uri2;
                string appBarCancel = CommonResources.AppBar_Cancel;
                applicationBarIconButton3.Text = appBarCancel;
                ApplicationBarIconButton applicationBarIconButton4 = applicationBarIconButton3;
                applicationBarIconButton2.Click += ((EventHandler)((p, f) =>
                {
                    ((Control)this).Focus();
                    viewModel.SaveChanges();
                }));
                applicationBarIconButton4.Click += ((EventHandler)((p, f) => Navigator.Current.GoBack()));
                this.ApplicationBar              = ((IApplicationBar)ApplicationBarBuilder.Build(new Color?(), new Color?(), 0.9));
                this.ApplicationBar.Buttons.Add(applicationBarIconButton2);
                this.ApplicationBar.Buttons.Add(applicationBarIconButton4);
                viewModel.Reload(true);
                this._isInitialized = true;
            }
            else
            {
                if (!ParametersRepository.Contains("CommunityManagementService"))
                {
                    return;
                }
                CommunityService      parameterForIdAndReset1 = (CommunityService)ParametersRepository.GetParameterForIdAndReset("CommunityManagementService");
                CommunityServiceState parameterForIdAndReset2 = (CommunityServiceState)ParametersRepository.GetParameterForIdAndReset("CommunityManagementServiceNewState");
                switch (parameterForIdAndReset1)
                {
                case CommunityService.Wall:
                    this.ViewModel.WallOrComments = parameterForIdAndReset2;
                    break;

                case CommunityService.Photos:
                    this.ViewModel.Photos = parameterForIdAndReset2;
                    break;

                case CommunityService.Videos:
                    this.ViewModel.Videos = parameterForIdAndReset2;
                    break;

                case CommunityService.Audios:
                    this.ViewModel.Audios = parameterForIdAndReset2;
                    break;

                case CommunityService.Documents:
                    this.ViewModel.Documents = parameterForIdAndReset2;
                    break;

                case CommunityService.Discussions:
                    this.ViewModel.Discussions = parameterForIdAndReset2;
                    break;
                }
            }
        }
Ejemplo n.º 15
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();
                }
            }
        }
Ejemplo n.º 16
0
        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();
                }
            }
        }
Ejemplo n.º 17
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();
                }
            }
        }
Ejemplo n.º 18
0
 protected override void HandleOnNavigatedTo(NavigationEventArgs e)
 {
     base.HandleOnNavigatedTo(e);
     if (!this._isInitialized)
     {
         long ownerId = 0;
         bool isOwnerCommunityAdmined = false;
         if (((Page)this).NavigationContext.QueryString.ContainsKey("OwnerId"))
         {
             ownerId = long.Parse(((Page)this).NavigationContext.QueryString["OwnerId"]);
         }
         if (((Page)this).NavigationContext.QueryString.ContainsKey("IsOwnerCommunityAdmined"))
         {
             isOwnerCommunityAdmined = bool.Parse(((Page)this).NavigationContext.QueryString["IsOwnerCommunityAdmined"]);
         }
         if (ownerId != AppGlobalStateManager.Current.LoggedInUserId && !isOwnerCommunityAdmined)
         {
             this.ApplicationBar.Buttons.Remove(this._appBarAddButton);
         }
         DocumentsViewModel parentPageViewModel = new DocumentsViewModel(ownerId);
         parentPageViewModel.Sections.Add(new DocumentsSectionViewModel(parentPageViewModel, ownerId, 0, CommonResources.Header_ShowAll, isOwnerCommunityAdmined, false));
         parentPageViewModel.LoadSection(0);
         ((FrameworkElement)this).DataContext = parentPageViewModel;
         this._isInitialized = true;
     }
     else if (ParametersRepository.Contains("FilePicked"))
     {
         FileOpenPickerContinuationEventArgs parameterForIdAndReset = ParametersRepository.GetParameterForIdAndReset("FilePicked") as FileOpenPickerContinuationEventArgs;
         StorageFile m0;
         if (parameterForIdAndReset == null)
         {
             m0 = null;
         }
         else
         {
             IReadOnlyList <StorageFile> files = parameterForIdAndReset.Files;
             m0 = files != null?Enumerable.FirstOrDefault <StorageFile>(files) : null;
         }
         StorageFile storageFile = (StorageFile)m0;
         if (storageFile == null)
         {
             return;
         }
         this.ViewModel.UploadDocuments(new List <StorageFile>()
         {
             storageFile
         });
     }
     else
     {
         if (!ParametersRepository.Contains("PickedPhotoDocuments"))
         {
             return;
         }
         List <StorageFile> parameterForIdAndReset = ParametersRepository.GetParameterForIdAndReset("PickedPhotoDocuments") as List <StorageFile>;
         if (parameterForIdAndReset == null || !Enumerable.Any <StorageFile>(parameterForIdAndReset))
         {
             return;
         }
         this.ViewModel.UploadDocuments(parameterForIdAndReset);
     }
 }
Ejemplo n.º 19
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();
            }
        }