Beispiel #1
0
        private async void ChangePictureBtn_Click(object sender, RoutedEventArgs e)
        {
            var pictureDialog = new SelectPictureSourceDialog(false);
            await pictureDialog.ShowAsync();

            if (pictureDialog.Result == DialogResultEnum.Cancel)
            {
                return;
            }

            ProgRing.IsActive = true;
            StorageFile imgFile;

            if (pictureDialog.SelectedPicrureStore == PictureSourceEnum.Gallery)
            {
                imgFile = await LogicHelper.OpenImage();
            }
            else
            {
                CameraCaptureUI captureUI = new CameraCaptureUI();
                captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;
                imgFile = await captureUI.CaptureFileAsync(CameraCaptureUIMode.Photo);
            }
            await UpdatePhoto(imgFile);

            ProgRing.IsActive = false;
        }
Beispiel #2
0
        private async void AddNewGame_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new SelectPictureSourceDialog(false);
            await dialog.ShowAsync();

            if (dialog.Result == DialogResultEnum.Accept)
            {
                Frame.Navigate(typeof(AddNewGamePage), new AddNewGameViewModel(dialog.SelectedPicrureStore));
            }
        }
Beispiel #3
0
        //private void Pane_Hiding(InputPane sender, InputPaneVisibilityEventArgs args)
        //{
        //    this.ScrollViewer.Height = this.ActualHeight;
        //}

        //private void Pane_Showing(InputPane sender, InputPaneVisibilityEventArgs args)
        //{
        //    this.ScrollViewer.Height = this.ActualHeight - args.OccludedRect.Height - 50;
        //}

        private async void ChangePictureBtn_Click(object sender, RoutedEventArgs e)
        {
            var pictureDialog = new SelectPictureSourceDialog(AppInfo.AppUser?.FbId != null && AppInfo.AppUser.FbId != "no_email_accept" && AppInfo.AppUser.FbId != "no_facebook");
            await pictureDialog.ShowAsync();

            if (pictureDialog.Result == DialogResultEnum.Cancel)
            {
                return;
            }

            ProgRing.IsActive = true;
            StorageFile imgFile;

            if (pictureDialog.SelectedPicrureStore == PictureSourceEnum.Gallery)
            {
                imgFile = await LogicHelper.OpenImage();
                await UpdatePhoto(imgFile);
            }
            else if (pictureDialog.SelectedPicrureStore == PictureSourceEnum.Camera)
            {
                CameraCaptureUI captureUI = new CameraCaptureUI();
                captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;
                imgFile = await captureUI.CaptureFileAsync(CameraCaptureUIMode.Photo);
                await UpdatePhoto(imgFile);
            }
            else
            {
                FacebookHelper fb         = new FacebookHelper();
                string         pictureUrl = await fb.GetFbProfilePicture(AppInfo.AppUser.FbId);

                if (!string.IsNullOrWhiteSpace(pictureUrl))
                {
                    WriteableBitmap wbm        = new WriteableBitmap(320, 320);
                    var             httpClient = new HttpClient();
                    var             buffer     = await httpClient.GetBufferAsync(new Uri(pictureUrl));

                    using (var stream = buffer.AsStream())
                    {
                        await wbm.SetSourceAsync(stream.AsRandomAccessStream());
                    }
                    //ViewModel.UpdateImage(wbm, true);
                    await CropImage(wbm);
                }
            }

            ProgRing.IsActive = false;
        }