• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# PhotoResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: cct_Completed

 void cct_Completed(object sender, PhotoResult e)
 {
     BitmapImage bi = new BitmapImage();
     bi.SetSource(e.ChosenPhoto);
     SaveImage(bi);
     PageSource.InvokeScript("getImage", "pic.jpg");
 }
开发者ID:jeffblankenburg,项目名称:CameraWebViewPOC,代码行数:7,代码来源:MainPage.xaml.cs


示例17: photoChooserTask_Completed

        void photoChooserTask_Completed(object sender, PhotoResult e)
        {
            if (e.TaskResult != TaskResult.OK)
            {
                return;
            }

            WebClient webClient = new WebClient();
            webClient.OpenWriteCompleted += (s, args) =>
                {
                    using (BinaryReader br = new BinaryReader(e.ChosenPhoto))
                    {
                        using (BinaryWriter bw = new BinaryWriter(args.Result))
                        {
                            long bCount = 0;
                            long fileSize = e.ChosenPhoto.Length;
                            byte[] bytes = new byte[2 * 1024];
                            do
                            {
                                bytes = br.ReadBytes(2 * 1024);
                                bCount += bytes.Length;
                                bw.Write(bytes);

                            } while (bCount < fileSize);
                        }
                    }
                };
            webClient.WriteStreamClosed += webClient_WriteStreamClosed;
            webClient.OpenWriteAsync(new Uri("http://www.cnblogs.com"));
        }
开发者ID:peepo3663,项目名称:WindowsPhone8,代码行数:30,代码来源:MainPage.xaml.cs


示例18: PhotoChooserCompleted

        private void PhotoChooserCompleted(object sender, PhotoResult e)
        {
           
            this.showInProgress = false;
            if (e.TaskResult == TaskResult.OK)
            {
                // Defensive. This should not happen unless maybe someone programmatically saved a 0 length image in 
                // the picture gallery which I am not even sure the phone API will allow. 
                // Since this.ocrData.PhotoStream will not accept a zero length stream we'll act defensively here.
                if (e.ChosenPhoto.Length > 0)
                {
                    Stream photoStream;

                    // This is the point where we have a photo available. 
                    photoStream = e.ChosenPhoto;

                    // Extract the orientation flag from the photo before we do the scaling down. 
                    // If the scaling down is performed we'll no longer have the Exif info in the photo stream.
                    ExifUtils exifUtils = new ExifUtils(OcrClientUtils.GetPhotoBits(photoStream));
                    this.ocrData.ExifOrientationFlag = exifUtils.GetOrientationFlag();

                    if (DoLimitPhotoSize)
                    {
                        photoStream = OcrClientUtils.LimitPhotoSize(photoStream, PhotoMaxSizeDiagonal);
                    }

                    // When setting this.ocrData.PhotoStream, the ocrData instance will notify anyone who subscribed
                    // to its PropertyChanged event. One of the subscribers to PropertyChanged will see that 
                    // the PhotoStream became available and it will trigger the OCR conversion.
                    this.ocrData.PhotoStream = photoStream;
                }
            }
        }
开发者ID:ProjPossibility,项目名称:CSUN-MobileMapMagnifier,代码行数:33,代码来源:PhotoSelector.xaml.cs


示例19: camera_Completed

        void camera_Completed(object sender, PhotoResult e)
        {
            if (e.TaskResult == TaskResult.OK)
            {
                //Code to display the photo on the page in an image control named myImage.
                System.Windows.Media.Imaging.BitmapImage bmp = new System.Windows.Media.Imaging.BitmapImage();
                bmp.SetSource(e.ChosenPhoto);

                using (System.IO.IsolatedStorage.IsolatedStorageFile isoStore = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication())
                {
                    if (!isoStore.DirectoryExists(item.Group.Title))
                        isoStore.CreateDirectory(item.Group.Title);

                    string fileName = string.Format("{0}/{1}.jpg", item.Group.Title, DateTime.Now.ToString("dd-MM-yyyy HH-mm-ss"));

                    using (System.IO.IsolatedStorage.IsolatedStorageFileStream targetStream = isoStore.CreateFile(fileName))
                    {
                        WriteableBitmap wb = new WriteableBitmap(bmp);
                        wb.SaveJpeg(targetStream, wb.PixelWidth, wb.PixelHeight, 0, 100);
                        targetStream.Close();
                    }

                    if (null == item.UserImages)
                        item.UserImages = new System.Collections.ObjectModel.ObservableCollection<string>();

                    item.UserImages.Add(fileName);
                }
            }
        }
开发者ID:WindowsPhone-8-TrainingKit,项目名称:HOL-WPNotifications,代码行数:29,代码来源:RecipeDetailPage.xaml.cs


示例20: OnPhotoChooserTaskCompleted

        private void OnPhotoChooserTaskCompleted(object sender, PhotoResult e)
        {
            var stream = e.ChosenPhoto;
            if (stream == null)
            {
                // If connected to Zune and debugging (WP7), the PhotoChooserTask won't open so we just pick the first image available.
            #if DEBUG
                var mediaLibrary = new MediaLibrary();
                if (mediaLibrary.SavedPictures.Count > 0)
                {
                    var firstPicture = mediaLibrary.SavedPictures[0];
                    stream = firstPicture.GetImage();
                }
            #else
                return;
            #endif
            }

            var bitmapImage = new BitmapImage();
            bitmapImage.SetSource(stream);

            //TODO: close stream?

            _writableBitmap = new WriteableBitmap(bitmapImage);
            pixelatedImage.Source = _writableBitmap;
            _originalPixels = new int[_writableBitmap.Pixels.Length];
            _writableBitmap.Pixels.CopyTo(_originalPixels, 0);

            PixelateWriteableBitmap();
        }
开发者ID:petermorlion,项目名称:EightBitCamera,代码行数:30,代码来源:Existing.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PhotoSearchExtras类代码示例发布时间:2022-05-24
下一篇:
C# PhotoPost类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap