当前位置: 首页>>代码示例>>C#>>正文


C# PhotoResult类代码示例

本文整理汇总了C#中PhotoResult的典型用法代码示例。如果您正苦于以下问题:C# PhotoResult类的具体用法?C# PhotoResult怎么用?C# PhotoResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PhotoResult类属于命名空间,在下文中一共展示了PhotoResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Task_Completed

        private void Task_Completed(object sender, PhotoResult e)
        {
            if (e.TaskResult == TaskResult.OK)
            {
                if (Helpers.FileHelpers.IsValidPicture(e.OriginalFileName))
                {
                    if (App.PhotoModel != null)
                    {
                        App.PhotoModel.Dispose();
                        App.PhotoModel = null;

                        GC.Collect();
                    }

                    using (MemoryStream stream = new MemoryStream())
                    {
                        e.ChosenPhoto.CopyTo(stream);

                        App.PhotoModel = new PhotoModel() { Buffer = stream.GetWindowsRuntimeBuffer() };
                        App.PhotoModel.Captured = (sender == _cameraCaptureTask);
                        App.PhotoModel.Dirty = App.PhotoModel.Captured;
                    }

                    Dispatcher.BeginInvoke(() => { NavigationService.Navigate(new Uri("/Pages/PhotoPage.xaml", UriKind.Relative)); });
                }
                else
                {
                    MessageBox.Show(AppResources.App_MessageBox_UnsupportedImage_Message,
                        AppResources.App_MessageBox_UnsupportedImage_Caption, MessageBoxButton.OK);
                }
            }
        }
开发者ID:JorgeCupi,项目名称:MusicLens,代码行数:32,代码来源:StreamPage.xaml.cs

示例2: cameraCaptureTask_Completed

        void cameraCaptureTask_Completed(object sender, PhotoResult e)
        {
            if (e.TaskResult == TaskResult.OK && e.ChosenPhoto != null)
            {

            }
        }
开发者ID:wadewegner,项目名称:TechEd_NZAU,代码行数:7,代码来源:MainPage.xaml.cs

示例3: task_Completed

        private async void task_Completed(object sender, PhotoResult e)
        {
            /* byte[] imageBits = new byte[(int)e.ChosenPhoto.Length];
            e.ChosenPhoto.Read(imageBits, 0, imageBits.Length);
            e.ChosenPhoto.Seek(0, System.IO.SeekOrigin.Begin);
            MemoryStream screenshot = new MemoryStream(imageBits);
            BitmapImage imageFromStream = new BitmapImage();
            imageFromStream.SetSource(screenshot); */
            Stream imgstream = e.ChosenPhoto;
            //System.Windows.Media.Imaging.BitmapImage bmp = new System.Windows.Media.Imaging.BitmapImage();
            //bmp.SetSource(e.ChosenPhoto);
            //img.Source = bmp;
            ApplyButton.Visibility = Visibility.Visible;
            session = await EditingSessionFactory.CreateEditingSessionAsync(imgstream);
            try
            {
                session.AddFilter(FilterFactory.CreateCartoonFilter(true));

                // Save the image as a jpeg to the camera roll
                using (MemoryStream stream = new MemoryStream())
                {
                    WriteableBitmap bitmap = new WriteableBitmap(3552, 2448);
                    await session.RenderToWriteableBitmapAsync(bitmap);
                    bitmap.SaveJpeg(stream, bitmap.PixelWidth, bitmap.PixelHeight, 0, 100);
                    img.Source = bitmap;
                }
                //Force the framework to redraw the Image.
            }
            catch (Exception exception)
            {
                MessageBox.Show("Exception:" + exception.Message);
            }
            
        }
开发者ID:ycaihua,项目名称:CartoonMaker,代码行数:34,代码来源:MainPage.xaml.cs

示例4: pcTask_Completed

 void pcTask_Completed(object sender, PhotoResult e)
 {
     //如果照相成功则把照片保存到独立存储空间并显示出来
     if (e.TaskResult == TaskResult.OK && e.Error == null)
     {
         BitmapImage bmpimg = new BitmapImage();
         bmpimg.SetSource(e.ChosenPhoto);
         App app = Application.Current as App;
         Image img = new Image();
         img.Source = bmpimg;
         //app.DIYImg = img;
         //image1.Source = bmpimg;
         //IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
         //if (!isf.DirectoryExists("UsersImage"))
         //{
         //    isf.CreateDirectory("UsersImage");
         //}
         //using (Stream storagefilestream = isf.OpenFile(MusicName + ".jpg", FileMode.OpenOrCreate, FileAccess.Write))
         //{
         //    WriteableBitmap wb = new WriteableBitmap(bmpimg);
         //    wb.SaveJpeg(storagefilestream, wb.PixelWidth, wb.PixelHeight, 0, 100);
         //}
         //NavigationService.Navigate(new Uri("/JigsawPuzzle;component/DIYPage.xaml", UriKind.Relative));
         thread.Start();
     }
 }
开发者ID:GhostSoar,项目名称:JigsawPuzzle,代码行数:26,代码来源:CameraOrPhotosLibrary.xaml.cs

示例5: ReadMetadataFromImage

 private void ReadMetadataFromImage(object sender, PhotoResult photoResult)
 {
     //Setting the fileName
     string fileName = "myWP7.dat";
     new IsolatedStorageService().WriteOutToFile(fileName, photoResult.ChosenPhoto);
     missingPetUploadViewModel.ImageUri = new Uri(photoResult.OriginalFileName);
 }
开发者ID:KnownSubset,项目名称:LostPets,代码行数:7,代码来源:missingUploadPage.xaml.cs

示例6: task_Completed

        void task_Completed(object sender, PhotoResult e)
        {
            if(e.TaskResult == TaskResult.OK)
            {

                var bmp = new WriteableBitmap(0,0);
                bmp.SetSource(e.ChosenPhoto);

                var bmpres = new WriteableBitmap(bmp.PixelWidth,bmp.PixelHeight);

                var txt = new WindowsPhoneControl1();
                txt.Text = txtInput.Text;
                txt.FontSize = 36 * bmpres.PixelHeight / 480;
                txt.Width = bmpres.PixelWidth;
                txt.Height = bmpres.PixelHeight;

                //should call Measure and  when uicomponent is not in visual tree
                txt.Measure(new Size(bmpres.PixelWidth, bmpres.PixelHeight));
                txt.Arrange(new Rect(0, 0, bmpres.PixelWidth, bmpres.PixelHeight));

                bmpres.Render(new Image() { Source = bmp }, null);
                bmpres.Render(txt, null);

                bmpres.Invalidate();
                display.Source = bmpres;

            }
        }
开发者ID:Nokia-Developer-Community-Projects,项目名称:wp8-sample,代码行数:28,代码来源:MainPage.xaml.cs

示例7: photoChooserTask_Completed

 private void photoChooserTask_Completed(object sender, PhotoResult e)
 {
     BitmapImage image = new BitmapImage();
     image.SetSource(e.ChosenPhoto);
     bitmapFotoDonatur = e.ChosenPhoto;
     FotoDonatur = (image);
 }
开发者ID:Handika-GEMkey,项目名称:SolidareNew,代码行数:7,代码来源:ViewModelSetting.cs

示例8: ctask_Completed

        void ctask_Completed(object sender, PhotoResult e)
        {
            if (e.TaskResult == TaskResult.OK)
            {
                //CapturedImage = new WriteableBitmap();

                CapturedImage = PictureDecoder.DecodeJpeg(e.ChosenPhoto);
                //CapturedImage.Resize();

                string imgSize = (e.ChosenPhoto.Length / 1024).ToString();
                string Height = CapturedImage.PixelHeight.ToString();
                string Width = CapturedImage.PixelWidth.ToString();
                long memoryRemaining = (long) DeviceExtendedProperties.GetValue("ApplicationCurrentMemoryUsage");
                MessageBox.Show("Mem: " + memoryRemaining + "Size: " + imgSize + Environment.NewLine + "Dim: " + Height + "x" + Width);
                StoreImageItem();
                //CapturedImage = PictureDecoder.DecodeJpeg(e.ChosenPhoto);
                //myImage.Source = bmp;
                //myImage.Stretch = Stretch.Uniform;
                // swap UI element states
                //savePhotoButton.IsEnabled = true;
                //statusText.Text = "";
            }
            else
            {
                //savePhotoButton.IsEnabled = false;
                //statusText.Text = "Task Result Error: " + e.TaskResult.ToString();
                MessageBox.Show("Error");
            }

            CapturedImage = null;
        }
开发者ID:Sliverb,项目名称:NoraPic,代码行数:31,代码来源:MainPage.xaml.cs

示例9: cct_Completed

        private void cct_Completed(object sender, PhotoResult e)
        {
            if (e.Error == null)
            {
                this.CallbackName = this.successCallback;

                switch (e.TaskResult)
                {
                    case TaskResult.OK:
                        int streamLength = Convert.ToInt32(e.ChosenPhoto.Length);
                        byte[] fileData = new byte[streamLength + 1];

                        e.ChosenPhoto.Read(fileData, 0, streamLength);
                        e.ChosenPhoto.Close();

                        string base64 = Convert.ToBase64String(fileData);

                        this.CallbackArgs = new[] { base64 };
                        break;
                    default:
                        this.CallbackArgs = new[] { string.Empty };
                        break;
                }
            }
            else
            {
                this.CallbackName = this.errorCallback;
                this.CallbackArgs = new[] { e.Error.Message };
            }
        }
开发者ID:ARenzi,项目名称:phonegap-wp7,代码行数:30,代码来源:CameraGetPictureCommand.cs

示例10: cameraTask_Completed

        void cameraTask_Completed(object sender, PhotoResult e)
        {
            
            if (e.TaskResult == TaskResult.OK)
            {
                JpegInfo info = ExifLib.ExifReader.ReadJpeg(e.ChosenPhoto, e.OriginalFileName);
                // Load the picture in a BitmapImage
                System.Windows.Media.Imaging.BitmapImage bitmap = new System.Windows.Media.Imaging.BitmapImage();
                bitmap.SetSource(e.ChosenPhoto);
                // Place the loaded image in a WriteableBitmap
                WriteableBitmap writeableBitmap = new WriteableBitmap(bitmap);
                // Execute the filter on the pixels of the bitmap
                ApplyFilter(writeableBitmap.Pixels);

                // Set the source of our image to the WriteableBitmap
                photoImage.Source = writeableBitmap;

                

                //start count doown timer
                countDownTimer = new DispatcherTimer();
                countDownTimer.Interval = new TimeSpan(0, 0, 0, 1);
                countDownTimer.Tick += new EventHandler(countDownTimerEvent);
                // countDownTimer.Start();

                txtCountdown.Text = "\n" + "seconds remaining";

                ReadExif(info);
                
            }

        }
开发者ID:gibratim,项目名称:pdis,代码行数:32,代码来源:proces.xaml.cs

示例11: ptsk_Completed

 void ptsk_Completed(object sender, PhotoResult e)
 {
     BitmapImage bi = new BitmapImage();
     if(e.ChosenPhoto !=null)
         bi.SetSource(e.ChosenPhoto);
     img.Source = bi;
 }
开发者ID:ahmeda8,项目名称:RodeDog,代码行数:7,代码来源:createpack.xaml.cs

示例12: photoChooserTask_Completed

 void photoChooserTask_Completed(object sender, PhotoResult e)
 {
     if (e.TaskResult == TaskResult.OK)
     {
        firstimage.Source = new BitmapImage(new Uri(e.OriginalFileName));                
     }
 }
开发者ID:trilok567,项目名称:Windows-Phone,代码行数:7,代码来源:MergeImageVsText.xaml.cs

示例13: OnPhotoChooserTaskCompleted

        // Called when an existing photo is chosen with the photo chooser.
        private void OnPhotoChooserTaskCompleted(object sender, PhotoResult e)
        {
            // Hide text messages
            txtError.Visibility = Visibility.Collapsed;
            txtMessage.Visibility = Visibility.Collapsed;

            // Make sure the PhotoChooserTask is resurning OK
            if (e.TaskResult == TaskResult.OK)
            {
                // initialize the result photo stream
                photoStream = new MemoryStream();

                // Save the stream result (copying the resulting stream)
                e.ChosenPhoto.CopyTo(photoStream);

                // save the original file name
                fileName = e.OriginalFileName;

                // display the chosen picture
                var bitmapImage = new System.Windows.Media.Imaging.BitmapImage();
                bitmapImage.SetSource(photoStream);
                imgSelectedImage.Source = bitmapImage;

                // enable the upload button
                btnUpload.IsEnabled = true;
            }
            else
            {
                // if result is not ok, make sure user can't upload
                btnUpload.IsEnabled = false;
            }
        }
开发者ID:kgrzelewski,项目名称:WP8.FileUpload.Sample01,代码行数:33,代码来源:MainPage.xaml.cs

示例14: pct_Completed

        async void pct_Completed(object sender, PhotoResult e)
        {
            if (e.TaskResult != TaskResult.OK || e.ChosenPhoto == null)
                return;

            try
            {
                // Create a source to read the image from PhotoResult stream
                using (var source = new StreamImageSource(e.ChosenPhoto))
                {
                    using (var effect = new PixlateEffect(source))
                    {
                        _effect = effect;
                        var target = new WriteableBitmap((int)ResultImage.ActualWidth, (int)ResultImage.ActualHeight);
                        // Create a new renderer which outputs WriteableBitmaps
                        using (var renderer = new WriteableBitmapRenderer(effect, target))
                        {
                            // Render the image with the filter(s)
                            await renderer.RenderAsync();
                            // Set the output image to Image control as a source
                            ResultImage.Source = target;
                        }

                    }
                }

            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                return;
            }
        }
开发者ID:hlabadi,项目名称:Pixlate,代码行数:33,代码来源:MainPage.xaml.cs

示例15: photoChooserTask_Completed

        void photoChooserTask_Completed(object sender, PhotoResult e)
        {
            ShareMediaTask shareMediaTask = new ShareMediaTask();
            shareMediaTask.FilePath = e.OriginalFileName;

            shareMediaTask.Show();
        }
开发者ID:rwecho,项目名称:Windows-Phone-Samples,代码行数:7,代码来源:MainPage.xaml.cs


注:本文中的PhotoResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。