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


C# CameraCaptureTask.Show方法代码示例

本文整理汇总了C#中CameraCaptureTask.Show方法的典型用法代码示例。如果您正苦于以下问题:C# CameraCaptureTask.Show方法的具体用法?C# CameraCaptureTask.Show怎么用?C# CameraCaptureTask.Show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CameraCaptureTask的用法示例。


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

示例1: NewImageVM

        public NewImageVM(IMessageBus Messenger,
            IStoreImages ImageStore) {
            Messenger.Listen<IElementVM<MultimediaObject>>(MessageContracts.EDIT)
                .Where(vm => vm.Model.MediaType == MediaType.Image && vm.Model.IsNew())
                .SelectMany(mmo => {
                        var capture = new CameraCaptureTask();
                        var results =
                            Observable.FromEventPattern<PhotoResult>(h => capture.Completed += h, h => capture.Completed -= h)
                            .Select(ev => ev.EventArgs)
                            .Catch(Observable.Empty<PhotoResult>())
                            .Select(res => new { VM = mmo, Result = res })
                            .Take(1)
                            .Replay(1);
                        results.Connect();
                        try {
                            capture.Show();
                        }
                        catch (InvalidOperationException) {
                        }
                        return results;
                    })
                .Where(tuple => tuple.VM != null
                    && tuple.Result != null
                    && tuple.Result.TaskResult == TaskResult.OK)
                .Do(tuple => {
                        tuple.VM.Model.Uri = ImageStore.StoreImage(tuple.VM.Model.NewFileName(), tuple.Result);

                    })
                .Select(t => t.VM as IElementVM<MultimediaObject>)
                .ToMessage(Messenger, MessageContracts.SAVE);
        }
开发者ID:rollingthunder,项目名称:DiversityMobile,代码行数:31,代码来源:NewImageVM.cs

示例2: BtnTakePictureClick

        private void BtnTakePictureClick(object sender, RoutedEventArgs e)
        {
            var captureTask = new CameraCaptureTask();
            _geoLocationManager.RetrieveCurrentLocation();
            captureTask.Completed += (s, a) =>
                                         {
                                             try
                                             {
                                                 if (a.Error == null && a.TaskResult == TaskResult.OK && a.ChosenPhoto != null)
                                                 {
                                                     var photo = new Photo
                                                                     {
                                                                         Latitude = _geoLocationManager.Latitude,
                                                                         Longitude = _geoLocationManager.Longitude
                                                                     };
                                                     var bytes = new byte[a.ChosenPhoto.Length];
                                                     a.ChosenPhoto.Read(bytes, 0, bytes.Length);
                                                     a.ChosenPhoto.Close();
                                                     photo.ImageBytes = bytes;

                                                     _persistenceManager.Add(photo);
                                                 }
                                             }
                                             catch (Exception ex)
                                             {
                                                Console.WriteLine(ex.Message);
                                             }
                                         };
            captureTask.Show();
        }
开发者ID:douglaszuniga,项目名称:Reportero-Digital,代码行数:30,代码来源:MainPage.xaml.cs

示例3: StartLoop

        public static void StartLoop()
        {
            CameraCaptureTask cameraCaptureTask = new CameraCaptureTask();
            cameraCaptureTask.Completed += new EventHandler<PhotoResult>(cameraCaptureTask_Completed);

            cameraCaptureTask.Show();
        }
开发者ID:viperium,项目名称:WatchDogWP8,代码行数:7,代码来源:DriveLogic.cs

示例4: captureImage

        /// <summary>
        /// Launches default camera application to capture image
        /// </summary>
        /// <param name="options">may contains limit or mode parameters</param>
        public void captureImage(string options)
        {
            try
            {
                try
                {
                    this.captureImageOptions = String.IsNullOrEmpty(options) ?
                        CaptureImageOptions.Default : JSON.JsonHelper.Deserialize<CaptureImageOptions>(options);

                }
                catch (Exception ex)
                {
                    this.DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, ex.Message));
                    return;
                }

                cameraTask = new CameraCaptureTask();
                cameraTask.Completed += this.cameraTask_Completed;
                cameraTask.Show();
            }
            catch (Exception e)
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, e.Message));
            }
        }
开发者ID:hermwong,项目名称:phonegap-wp7,代码行数:29,代码来源:Capture.cs

示例5: GetCaptureImageA

        private void GetCaptureImageA(object obj)
        {
            CameraCaptureTask camera = new CameraCaptureTask();
            camera.Show();

            camera.Completed += new EventHandler<PhotoResult>(camera_a);

        }
开发者ID:Handika-GEMkey,项目名称:SolidareNew,代码行数:8,代码来源:ViewModelRekomendasi.cs

示例6: CameraButtonClick

        private void CameraButtonClick(object sender,
                                      RoutedEventArgs e)
        {
            CameraCaptureTask camera = new CameraCaptureTask();
            camera.Completed += new EventHandler
                                     <PhotoResult>(camera_Result);

            camera.Show();
        }
开发者ID:GregOnNet,项目名称:WP8BookSamples,代码行数:9,代码来源:MainPage.xaml.cs

示例7: PlayCreate_Click

        private void PlayCreate_Click(object sender, RoutedEventArgs e)
        {
            //Create new instance of CameraCaptureClass
               ctask = new CameraCaptureTask();

            //Create new event handler for capturing a photo
            ctask.Completed += new EventHandler<PhotoResult>(ctask_Completed);
            ctask.Show();
        }
开发者ID:hkgumbs,项目名称:panes,代码行数:9,代码来源:MainPage.xaml.cs

示例8: btnCapPhoto_Click

        private void btnCapPhoto_Click(object sender, EventArgs e)
        {
            imageFileName = string.Empty;
            imageStream = null;

            cameraCapture = new CameraCaptureTask();
            cameraCapture.Completed += new EventHandler<PhotoResult>(cameracapture_Completed);
            cameraCapture.Show();
        }
开发者ID:Arthraim,项目名称:WbtoMongo,代码行数:9,代码来源:MainPage.xaml.cs

示例9: btnCamera_Click

 private void btnCamera_Click(object sender, RoutedEventArgs e)
 {
     lock (this)
       {
     CameraCaptureTask cameraCaptureTask = new CameraCaptureTask();
     cameraCaptureTask.Completed -= Task_Completed;
     cameraCaptureTask.Completed += Task_Completed;
     cameraCaptureTask.Show();
     isGaleryCameraOpen = true;
       }
 }
开发者ID:kernelhunter92,项目名称:CatrobatForWindows,代码行数:11,代码来源:AddNewCostume.xaml.cs

示例10: TakePictureAsync

        public Task<CameraResult> TakePictureAsync()
        {
            CameraCaptureTask cameraCaptureTask = new CameraCaptureTask();
            cameraCaptureTask.Completed += CameraCaptureTaskOnCompleted;

            cameraCaptureTask.Show();

            tcs = new TaskCompletionSource<CameraResult>();

            return tcs.Task;
        }
开发者ID:mehul19851,项目名称:xamarin-forms-camera,代码行数:11,代码来源:CameraProvider.cs

示例11: LaunchCameraCapture

 private void LaunchCameraCapture(object sender, RoutedEventArgs e)
 {
     var cameraCaptureTask = new CameraCaptureTask();
     cameraCaptureTask.Completed += CameraCaptureTaskCompleted;
     try
     {
         cameraCaptureTask.Show();
     }
     catch (System.InvalidOperationException ex)
     {
         MessageBox.Show("An error occurred.");
     }
 }
开发者ID:SonLamUIT,项目名称:WPSamples,代码行数:13,代码来源:ChoosersSamplePage.xaml.cs

示例12: btnCapturePhoto_Click

 private void btnCapturePhoto_Click(object sender, RoutedEventArgs e)
 {
     CameraCaptureTask cTask = new CameraCaptureTask();
     cTask.Completed += (s, evt) =>
     {
         if (evt.Error == null && evt.TaskResult == TaskResult.OK)
         {
             //BitmapImage bmpImage = new BitmapImage();
             //bmpImage.SetSource(evt.ChosenPhoto);
             //image.Source = bmpImage;
         }
     };
     cTask.Show();
 }
开发者ID:solondon,项目名称:VisualStudio2013andNETCookbookCode,代码行数:14,代码来源:MainPage.xaml.cs

示例13: GetCaptureImageB

        private void GetCaptureImageB(object obj)
        {
            if (MessageBox.Show("Are you sure?", "Confirm", MessageBoxButton.OKCancel) == MessageBoxResult.Yes)
            {
                // If yes
                CameraCaptureTask camera = new CameraCaptureTask();
                camera.Show();

                camera.Completed += new EventHandler<PhotoResult>(camera_b);
            }
            else
            {
                // If no
            }
        }
开发者ID:Handika-GEMkey,项目名称:SolidareNew,代码行数:15,代码来源:ViewModelRekomendasi.cs

示例14: CaptureAsync

        public Task<Stream> CaptureAsync()
        {
            var cameraCompletionTask = new TaskCompletionSource<Stream>();
            var cameraCaptureTask = new CameraCaptureTask();
            cameraCaptureTask.Completed += (s, e) =>
                {
                    if (e.Error != null)
                    {
                        cameraCompletionTask.SetException(e.Error);
                    }

                    cameraCompletionTask.SetResult(e.ChosenPhoto);
                };

            Task.Run(() => cameraCaptureTask.Show());
            return cameraCompletionTask.Task;
        }
开发者ID:bendewey,项目名称:LeadPro,代码行数:17,代码来源:PhoneImageCaptureService.cs

示例15: MainPage

		public MainPage ()
		{
			InitializeComponent ();
			SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;

			global::Xamarin.Forms.Forms.Init ();

		   
			LoadApplication(new ContosoMoments.App ());

			ContosoMoments.App.Instance.ShouldTakePicture += () => {
				CameraCaptureTask cameraCaptureTask = new CameraCaptureTask();
				cameraCaptureTask.Completed += CameraCaptureTaskOnCompleted;

				cameraCaptureTask.Show();
			};
		}
开发者ID:lindydonna,项目名称:ContosoMoments,代码行数:17,代码来源:MainPage.xaml.cs


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