Пример #1
0
        private void HandleSelectedItem(object listBox, object selectedItem)
        {
            GroupHeader groupHeader = selectedItem as GroupHeader;

            if (groupHeader == null)
            {
                return;
            }
            if (this._pickManaged)
            {
                if (this._ownerId != 0L && this._picId != 0L)
                {
                    this.Share(this._text ?? "", groupHeader.Group.id, groupHeader.Group.name ?? "");
                }
                ParametersRepository.SetParameterForId("PickedGroupForRepost", (object)groupHeader.Group);
                EventAggregator.Current.Publish((object)new PhotoIsRepostedInGroup());
                ((Page)this).NavigationService.GoBackSafe();
            }
            else if (this._shareContentDataProvider != null)
            {
                this._shareContentDataProvider.StoreDataToRepository();
                ShareContentDataProviderManager.StoreDataProvider(this._shareContentDataProvider);
                Navigator.Current.NavigateToNewWallPost(groupHeader.Group.id, true, groupHeader.Group.admin_level, groupHeader.Group.GroupType == GroupType.PublicPage, false, false);
            }
            else
            {
                Navigator.Current.NavigateToGroup(groupHeader.Group.id, groupHeader.Group.name, false);
            }
        }
Пример #2
0
        private static void CameraCaptureTask_OnCompleted(object sender, PhotoResult e)
        {
            if (((TaskEventArgs)e).TaskResult != TaskResult.OK)
            {
                return;
            }
            MemoryStream memoryStream = StreamUtils.ReadFully(e.ChosenPhoto);

            e.ChosenPhoto.Position = 0L;
            memoryStream.Position  = 0L;
            ParametersRepository.SetParameterForId("ChoosenPhotos", new List <Stream>()
            {
                e.ChosenPhoto
            });
            ParametersRepository.SetParameterForId("ChoosenPhotosPreviews", new List <Stream>()
            {
                (Stream)memoryStream
            });
            string      paramId  = "ChoosenPhotosSizes";
            List <Size> sizeList = new List <Size>();
            Size        size     = new Size();

            sizeList.Add(size);
            ParametersRepository.SetParameterForId(paramId, sizeList);
        }
Пример #3
0
 public void HandleTap()
 {
     if (this._fromSearch)
     {
         return;
     }
     if (!this._pickMode)
     {
         CurrentMediaSource.VideoSource  = this._actionSource;
         CurrentMediaSource.VideoContext = this._context;
         Navigator.Current.NavigateToVideoWithComments(this._vKVideo, this._vKVideo.owner_id, this._vKVideo.vid, this._vKVideo.access_key);
     }
     else
     {
         ParametersRepository.SetParameterForId("PickedVideo", this._vKVideo);
         if (this._albumId != 0L)
         {
             PageBase currentPage = FramePageUtils.CurrentPage;
             if (currentPage != null)
             {
                 ((Page)currentPage).NavigationService.RemoveBackEntrySafe();
             }
         }
         Navigator.Current.GoBack();
     }
 }
Пример #4
0
 private void _appBarButtonCheck_Click(object sender, EventArgs e)
 {
     this.VM.SavePoll((Action <Poll>)(poll =>
     {
         ParametersRepository.SetParameterForId("UpdatedPoll", poll);
         Navigator.Current.GoBack();
     }));
 }
Пример #5
0
 private void _photoChooserTask_Completed(object sender, PhotoResult e)
 {
     if (((TaskEventArgs)e).TaskResult != TaskResult.OK)
     {
         return;
     }
     ParametersRepository.SetParameterForId("ChoosenPhoto", (object)e.ChosenPhoto);
 }
Пример #6
0
 private void editCommentCallback(CommentItem commentItem)
 {
     commentItem.Comment.GroupId = this._gid;
     commentItem.Comment.TopicId = this._tid;
     ParametersRepository.SetParameterForId("EditDiscussionComment", (object)commentItem.Comment);
     ParametersRepository.SetParameterForId("CidToAuthorIdDict", (object)this.GetCidToAuthorDict());
     Navigator.Current.NavigateToNewWallPost(Math.Abs(commentItem.Comment.owner_id), commentItem.Comment.owner_id < 0, 0, false, false, false);
 }
Пример #7
0
 private static void PhotoChooserTask_OnCompleted(object sender, PhotoResult e)
 {
     if (e.TaskResult != TaskResult.OK)
     {
         return;
     }
     ParametersRepository.SetParameterForId("ChoosenPhoto", (object)e.ChosenPhoto);
 }
Пример #8
0
 private void _photoChooserTask_Completed(object sender, PhotoResult e)
 {
     Logger.Instance.Info("Back from photo chooser");
     if (((TaskEventArgs)e).TaskResult != TaskResult.OK)
     {
         return;
     }
     ParametersRepository.SetParameterForId("ChoosenPhoto", e.ChosenPhoto);
 }
Пример #9
0
 public static void NavigateToEditWallPost(this WallPost wallPost, int adminLevel)
 {
     if (wallPost == null)
     {
         return;
     }
     ParametersRepository.SetParameterForId("EditWallPost", (object)wallPost);
     Navigator.Current.NavigateToNewWallPost(Math.Abs(wallPost.to_id), wallPost.to_id < 0L, adminLevel, false, false, false);
 }
Пример #10
0
 private void ShowAllBlock_OnTapped(object sender, System.Windows.Input.GestureEventArgs e)
 {
     if (this.Model == null)
     {
         return;
     }
     ParametersRepository.SetParameterForId("CommunityInvitationsUC", this);
     Navigator.Current.NavigateToGroupInvitations();
 }
Пример #11
0
 private void ShowAllBlock_OnTapped(object sender, System.Windows.Input.GestureEventArgs e)
 {
     if (this._model == null)
     {
         return;
     }
     ParametersRepository.SetParameterForId("FriendRequestsUC", this);
     Navigator.Current.NavigateToFriendRequests(this._model.are_suggested_friends);
 }
Пример #12
0
        private static void ProcessMoneyTransferSendResult(IDictionary <string, string> dict)
        {
            MoneyTransferSentResponse transferSentResponse = new MoneyTransferSentResponse();

            if (dict.ContainsKey("success"))
            {
                transferSentResponse.IsSucceeded = true;
            }
            ParametersRepository.SetParameterForId("MoneyTransferSentResponse", transferSentResponse);
        }
Пример #13
0
 public void StoreDataToRepository()
 {
     ParametersRepository.SetParameterForId("NewMessageContents", (this.Message ?? (this.Message = "")));
     ParametersRepository.SetParameterForId("WallPostAttachment", this.WallPost);
     ParametersRepository.SetParameterForId("PickedPhoto", this.Photo);
     ParametersRepository.SetParameterForId("PickedVideo", this.Video);
     ParametersRepository.SetParameterForId("ShareProduct", this.Product);
     ParametersRepository.SetParameterForId("MessagesToForward", this.ForwardedMessages);
     ParametersRepository.SetParameterForId("PickedDocument", this.Document);
 }
Пример #14
0
        private void Image_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
        {
            FrameworkElement           frameworkElement = sender as FrameworkElement;
            AlbumPhoto                 albumPhoto       = null;
            AlbumPhotoHeaderFourInARow dataContext      = frameworkElement.DataContext as AlbumPhotoHeaderFourInARow;

            if (dataContext != null)
            {
                string str = frameworkElement.Tag.ToString();
                if (!(str == "1"))
                {
                    if (!(str == "2"))
                    {
                        if (!(str == "3"))
                        {
                            if (str == "4")
                            {
                                albumPhoto = dataContext.Photo4;
                            }
                        }
                        else
                        {
                            albumPhoto = dataContext.Photo3;
                        }
                    }
                    else
                    {
                        albumPhoto = dataContext.Photo2;
                    }
                }
                else
                {
                    albumPhoto = dataContext.Photo1;
                }
            }
            else
            {
                albumPhoto = frameworkElement.DataContext as AlbumPhoto;
            }
            if (albumPhoto == null)
            {
                return;
            }
            if (this._pickMode)
            {
                ParametersRepository.SetParameterForId("PickedPhoto", albumPhoto.Photo);
                base.NavigationService.RemoveBackEntrySafe();
                base.NavigationService.GoBackSafe();
            }
            else
            {
                List <Photo> list = this.PhotoAlbumVM.AlbumPhotos.Select <AlbumPhoto, Photo>((Func <AlbumPhoto, Photo>)(ap => ap.Photo)).ToList <Photo>();
                Navigator.Current.NavigateToImageViewer(this.PhotoAlbumVM.AlbumId, (int)this.PhotoAlbumVM.AType, this._inputData.UserOrGroupId, this._inputData.IsGroup, this.PhotoAlbumVM.PhotosCount, list.IndexOf(albumPhoto.Photo), list, new Func <int, Image>(this.GetPhotoById));
            }
        }
Пример #15
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
     });
 }
Пример #16
0
        private void List_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DocumentHeader selectedItem = ((LongListSelector)sender).SelectedItem as DocumentHeader;

            if (selectedItem == null)
            {
                return;
            }
            this.list.SelectedItem = null;
            ParametersRepository.SetParameterForId("PickedDocument", selectedItem.Document);
            Navigator.Current.GoBack();
        }
Пример #17
0
 private void _appBarButtonAttachments_Click(object sender, EventArgs e)
 {
     if (this._commentVM.OutboundAttachments.Count == 0)
     {
         PickerUC.PickAttachmentTypeAndNavigate(AttachmentTypes.AttachmentTypesWithPhotoFromGallery, null, (() => Navigator.Current.NavigateToPhotoPickerPhotos(2, false, false)));
     }
     else
     {
         ParametersRepository.SetParameterForId("NewCommentVM", this._commentVM);
         Navigator.Current.NavigateToNewWallPost(0, false, 0, false, false, false);
     }
 }
Пример #18
0
        private void Attach_OnClick(object sender, RoutedEventArgs e)
        {
            if (!this._graffitiDrawService.CanUndo || this._isSaving)
            {
                return;
            }
            this._isSaving = true;
            WriteableBitmap bitmap = this.CreateRenderBitmap();
            int             orientationRotateAngle = this.GetOrientationRotateAngle();

            if (orientationRotateAngle != 0)
            {
                bitmap = bitmap.Rotate(orientationRotateAngle);
            }
            this._previewUC = new GraffitiPreviewUC();
            this.UpdatePreviewOrientation();
            bool graffitiSent = false;

            this._previewUC.SendButtonClickAction = (Action)(async() =>
            {
                graffitiSent = true;
                string uriString = string.Format("/{0}", (object)Guid.NewGuid());
                int width = bitmap.PixelWidth;
                int height = bitmap.PixelHeight;
                Stream responseStream = await new GraffitiEncoder(bitmap).Encode();
                if (responseStream == null)
                {
                    this._isSaving = false;
                }
                else
                {
                    ImageCache.Current.TrySetImageForUri(uriString, responseStream);
                    responseStream.Close();
                    this._isSaving = false;
                    ParametersRepository.SetParameterForId("Graffiti", (object)new GraffitiAttachmentItem(uriString, width, height));
                    GC.Collect();
                    Navigator.Current.GoBack();
                }
            });
            this._previewUC.HideCallback = (Action)(() =>
            {
                this._isSaving = false;
                if (graffitiSent)
                {
                    return;
                }

                this.SubscribeToFrameReported();
            });
            this.UnsubscribeFromFrameReported();
            this._previewUC.Show(bitmap, this._orientation);
        }
Пример #19
0
        private void ProcessMoneyTransferAcceptResult(IDictionary <string, string> dict)
        {
            MoneyTransferAcceptedResponse acceptedResponse = new MoneyTransferAcceptedResponse();

            if (dict.ContainsKey("success"))
            {
                acceptedResponse.IsSucceeded = true;
                acceptedResponse.TransferId  = this._transferId;
                acceptedResponse.FromId      = this._fromId;
                acceptedResponse.ToId        = this._toId;
            }
            ParametersRepository.SetParameterForId("MoneyTransferAcceptedResponse", acceptedResponse);
        }
Пример #20
0
 private void HandleUserSelection(FriendHeader selected)
 {
     if (this._mode == FriendsPageMode.Default)
     {
         Navigator.Current.NavigateToUserProfile(selected.UserId, selected.User.Name, "", false);
     }
     if (this._mode != FriendsPageMode.PickAndBack)
     {
         return;
     }
     ParametersRepository.SetParameterForId("PickedUser", selected);
     ((Page)this).NavigationService.GoBackSafe();
 }
Пример #21
0
        private void Image_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            FrameworkElement frameworkElement = sender as FrameworkElement;
            AlbumHeader      albumHeader      = (frameworkElement != null ? frameworkElement.DataContext : null) as AlbumHeader;

            if (albumHeader == null)
            {
                return;
            }
            if (!this._selectForMove)
            {
                INavigator current       = Navigator.Current;
                long       userOrGroupId = this.PhotoMainVM.UserOrGroupId;
                int        num1          = this.PhotoMainVM.IsGroup ? 1 : 0;
                string     type          = albumHeader.AlbumType.ToString();
                string     albumId       = albumHeader.AlbumId;
                string     albumName     = albumHeader.AlbumName;
                int        photosCount   = albumHeader.PhotosCount;
                string     title         = this.PhotoMainVM.Title;
                string     description   = albumHeader.Album == null ? "" : albumHeader.Album.description ?? "";
                int        num2          = this.CommonParameters.PickMode ? 1 : 0;
                int        adminLevel    = this._adminLevel;
                Album      album         = albumHeader.Album;
                int        num3          = album != null ? (album.can_upload == 1 ? 1 : 0) : 0;
                current.NavigateToPhotoAlbum(userOrGroupId, num1 != 0, type, albumId, albumName, photosCount, title, description, num2 != 0, adminLevel, num3 != 0);
            }
            else
            {
                PhotosToMoveInfo photosToMoveInfo = new PhotosToMoveInfo();
                photosToMoveInfo.albumId   = albumHeader.AlbumId;
                photosToMoveInfo.albumName = albumHeader.AlbumName;
                photosToMoveInfo.photos    = this._selectedPhotos;
                PhotoAlbumViewModel.PhotoAlbumViewModelInput albumViewModelInput = new PhotoAlbumViewModel.PhotoAlbumViewModelInput();
                albumViewModelInput.AlbumDescription = albumHeader.Album == null ? "" : albumHeader.Album.description ?? "";
                albumViewModelInput.AlbumId          = albumHeader.AlbumId;
                albumViewModelInput.AlbumName        = albumHeader.AlbumName;
                albumViewModelInput.AlbumType        = albumHeader.AlbumType;
                int num = this.PhotoMainVM.IsGroup ? 1 : 0;
                albumViewModelInput.IsGroup = num != 0;
                string photoPageTitle2 = this.PhotoMainVM.PhotoPageTitle2;
                albumViewModelInput.PageTitle = photoPageTitle2;
                int photosCount = albumHeader.PhotosCount;
                albumViewModelInput.PhotosCount = photosCount;
                long userOrGroupId = this.PhotoMainVM.UserOrGroupId;
                albumViewModelInput.UserOrGroupId     = userOrGroupId;
                photosToMoveInfo.TargetAlbumInputData = albumViewModelInput;
                ParametersRepository.SetParameterForId("PhotosToMove", photosToMoveInfo);
                ((Page)this).NavigationService.GoBackSafe();
            }
        }
Пример #22
0
        private void Application_ContractActivated(object sender, IActivatedEventArgs e)
        {
            FileOpenPickerContinuationEventArgs continuationEventArgs = e as FileOpenPickerContinuationEventArgs;

            if (continuationEventArgs == null)
            {
                return;
            }
            if (((IDictionary <string, object>)continuationEventArgs.ContinuationData).ContainsKey("FilePickedType"))
            {
                ParametersRepository.SetParameterForId("FilePickedType", (AttachmentType)((IDictionary <string, object>)continuationEventArgs.ContinuationData)["FilePickedType"]);
            }
            ParametersRepository.SetParameterForId("FilePicked", continuationEventArgs);
        }
Пример #23
0
        private void HandleAudioSelectionChanged(object sender, object selectedItem, bool fromSearch)
        {
            ListBox listBox = sender as ListBox;
            ExtendedLongListSelector longListSelector = sender as ExtendedLongListSelector;
            AudioHeader track = selectedItem as AudioHeader;

            if (listBox != null)
            {
                ((Selector)listBox).SelectedItem = null;
            }
            if (longListSelector != null)
            {
                longListSelector.SelectedItem = null;
            }
            if (track == null)
            {
                return;
            }
            if (this._pageMode == AudioPage.PageMode.PickAudio)
            {
                ParametersRepository.SetParameterForId("PickedAudio", track.Track);
                if (this._albumId != 0L)
                {
                    ((Page)this).NavigationService.RemoveBackEntrySafe();
                }
                Navigator.Current.GoBack();
            }
            else if (listBox != null)
            {
                if (fromSearch)
                {
                    CurrentMediaSource.AudioSource = StatisticsActionSource.search;
                }
                this.NavigateToAudioPlayer(track, ((ItemsControl)listBox).ItemsSource, true);
            }
            else
            {
                if (longListSelector == null)
                {
                    return;
                }
                if (fromSearch)
                {
                    CurrentMediaSource.AudioSource = StatisticsActionSource.search;
                }
                IEnumerable enumerable = !longListSelector.IsFlatList ? this.GetExtendedSelectorGroupedItems(longListSelector.ItemsSource) : longListSelector.ItemsSource;
                this.NavigateToAudioPlayer(track, enumerable, true);
            }
        }
Пример #24
0
 private void _photoChooserTask_Completed(object sender, PhotoResult e)
 {
     if (e.TaskResult != TaskResult.OK)
     {
         return;
     }
     if (e.Error != null)
     {
         Logger.Instance.Error("Error chosing photo", e.Error);
     }
     else
     {
         ParametersRepository.SetParameterForId("ChoosenNewProfilePhoto", (object)e.ChosenPhoto);
     }
 }
Пример #25
0
 private void SetChoosenPhoto(string fileId)
 {
     using (MediaLibrary mediaLibrary = new MediaLibrary())
     {
         using (Picture pictureFromToken = mediaLibrary.GetPictureFromToken(fileId))
         {
             ParametersRepository.SetParameterForId("ChoosenPhotosPreviews", new List <Stream>()
             {
                 pictureFromToken.GetThumbnail()
             });
             ParametersRepository.SetParameterForId("ChoosenPhotos", new List <Stream>()
             {
                 pictureFromToken.GetImage()
             });
         }
     }
 }
Пример #26
0
        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();
            }
        }
Пример #27
0
 private void SetCrop(object sender, System.Windows.Input.GestureEventArgs e)
 {
     if (this._inSelectOwnPhotoArea)
     {
         ParametersRepository.SetParameterForId("UserPicSquare", (object)this.imageViewer.RectangleFillRelative);
         this._inSelectOwnPhotoArea = false;
         ((UIElement)this.gridChooseThumbnail).Visibility = Visibility.Collapsed;
         this.EnsureSelectCurrentAndConfirm();
     }
     else
     {
         if (this._isInSetResetCrop)
         {
             return;
         }
         this._isInSetResetCrop = true;
         ParametersRepository.SetParameterForId("UserPicSquare", (object)new Rect(0.0, 0.0, 1.0, 1.0));
         Rect rectToCrop = this.imageViewer.RectangleFillInCurrentImageCoordinates;
         ((DependencyObject)Deployment.Current).Dispatcher.BeginInvoke((Action)(() =>
         {
             ImageEditorViewModel imageEditorVm = this._imageEditorVM;
             double rotate = 0.0;
             CropRegion rect = new CropRegion();
             // ISSUE: explicit reference operation
             rect.X = (int)((Rect)@rectToCrop).X;
             // ISSUE: explicit reference operation
             rect.Y = (int)((Rect)@rectToCrop).Y;
             // ISSUE: explicit reference operation
             rect.Width = (int)((Rect)@rectToCrop).Width;
             // ISSUE: explicit reference operation
             rect.Height = (int)((Rect)@rectToCrop).Height;
             WriteableBitmap source = this.imageViewer.CurrentImage.Source as WriteableBitmap;
             Action <BitmapSource> callback = (Action <BitmapSource>)(result =>
             {
                 this._isInSetResetCrop = false;
                 this.HandleEffectApplied(result);
                 this.ToggleCropMode();
                 ((UIElement)this.imageViewer.CurrentImage).RenderTransform = ((Transform)RectangleUtils.TransformRect(this.imageViewer.CurrentImageFitRectOriginal, this.imageViewer.RectangleFill, false));
                 this.imageViewer.AnimateImage(1.0, 1.0, 0.0, 0.0, (Action)null);
             });
             imageEditorVm.SetCrop(rotate, rect, source, callback);
         }));
     }
 }
Пример #28
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
         });
     }
 }
Пример #29
0
 private void EditComment(CommentItem commentItem)
 {
     if (this.VM.LikeObjectType == LikeObjectType.photo)
     {
         commentItem.Comment.owner_id = this.VM.OwnerId;
         ParametersRepository.SetParameterForId("EditPhotoComment", commentItem.Comment);
     }
     else if (this.VM.LikeObjectType == LikeObjectType.video)
     {
         commentItem.Comment.owner_id = this.VM.OwnerId;
         ParametersRepository.SetParameterForId("EditVideoComment", commentItem.Comment);
     }
     else if (this.VM.LikeObjectType == LikeObjectType.market)
     {
         commentItem.Comment.owner_id = this.VM.OwnerId;
         ParametersRepository.SetParameterForId("EditProductComment", commentItem.Comment);
     }
     Navigator.Current.NavigateToNewWallPost(Math.Abs(this.VM.OwnerId), this.VM.OwnerId < 0, 0, false, false, false);
 }
Пример #30
0
        private void NavigateToWallPostWithComments(bool toComments = false)
        {
            long postId = this._wallPost.id;
            long toId   = this._wallPost.to_id;

            if (!this._wallPost.IsReply)
            {
                ParametersRepository.SetParameterForId("WallPost", (object)new NewsItemDataWithUsersAndGroupsInfo()
                {
                    WallPost = this._wallPost,
                    Profiles = this._users,
                    Groups   = this._groups
                });
            }
            else if (this._wallPost.post_id != 0L)
            {
                postId = this._wallPost.post_id;
            }
            Navigator.Current.NavigateToWallPostComments(postId, toId, toComments, 0L, 0L, this.AdData);
        }