コード例 #1
0
 private void MakePhoto_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         cameraCaptureTask.Show();
     }
     catch { };
 }
コード例 #2
0
 protected override void OnManipulationStarted(ManipulationStartedEventArgs args)
 {
     camera.Show();
     args.Complete();
     args.Handled = true;
     base.OnManipulationStarted(args);
 }
コード例 #3
0
        //shared media load from store

        private void WP8Statics_FbSharedMediaClickHandle(object sender, EventArgs e)
        {
            CameraCaptureTask cameraCaptureTask = new CameraCaptureTask();

            cameraCaptureTask.Completed += cameraCaptureTask_Completed;
            cameraCaptureTask.Show();
        }
コード例 #4
0
        /// <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));
            }
        }
コード例 #5
0
        private void Button1Click(object sender, RoutedEventArgs e)
        {
            var cameraTask = new CameraCaptureTask();

            cameraTask.Completed += new EventHandler <PhotoResult>(cameraTask_Completed);
            cameraTask.Show();
        }
コード例 #6
0
        private void AttachmentPicker_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (AttachmentPicker == null)
            {
                return;
            }

            switch (AttachmentPicker.SelectedIndex)
            {
            // album
            case 0:
                _photoChooserTask.Show();
                break;

            // photo
            case 1:
                _cameraCaptureTask.Show();
                break;

            // video
            case 2:
                NavigationService.Navigate(new Uri("/Pages/Attachments/VideoRecorder.xaml", UriKind.Relative));
                break;

            // recording
            case 3:
                NavigationService.Navigate(new Uri("/Pages/Attachments/AudioRecorder.xaml", UriKind.Relative));
                break;
            }
        }
コード例 #7
0
        private void btCapturar_Click(object sender, RoutedEventArgs e)
        {
            CameraCaptureTask camera = new CameraCaptureTask();

            camera.Completed += Camera_Completed;
            camera.Show();
        }
コード例 #8
0
        private void iconCamera_Click(object sender, EventArgs e)
        {
            CameraCaptureTask task = new CameraCaptureTask( );

            Config.Cache_TweetPic = null;
            task.Completed       += (s, e1) =>
            {
                if (e1.ChosenPhoto != null)
                {
                    BitmapImage bmpSource = new BitmapImage( );
                    bmpSource.SetSource(e1.ChosenPhoto);
                    this.img.Source = bmpSource;
                    BitmapImage g_bmp = new BitmapImage( );
                    g_bmp.CreateOptions = BitmapCreateOptions.DelayCreation;
                    g_bmp.SetSource(e1.ChosenPhoto);
                    g_stream = Tool.ReduceSize(g_bmp);
                    Config.Cache_TweetPic = g_stream;
                }
            };
            try
            {
                task.Show( );
            }
            catch { }
        }
コード例 #9
0
        public void Execute(object parameter)
        {
            _viewModel.ActivityMessage = string.Empty;
            _viewModel.Processing      = true;

            _captureTask.Show();
        }
コード例 #10
0
        private void btnResimDegistir_Click(object sender, RoutedEventArgs e)
        {
            CameraCaptureTask kamera = new CameraCaptureTask();

            kamera.Show();
            kamera.Completed += Kamera_Completed;
        }
コード例 #11
0
ファイル: DriveLogic.cs プロジェクト: viperium/WatchDogWP8
        public static void StartLoop()
        {
            CameraCaptureTask cameraCaptureTask = new CameraCaptureTask();
            cameraCaptureTask.Completed += new EventHandler<PhotoResult>(cameraCaptureTask_Completed);

            cameraCaptureTask.Show();
        }
コード例 #12
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var cameraCaptureTask = new CameraCaptureTask();

            cameraCaptureTask.Completed += cameraCaptureTask_Completed;
            cameraCaptureTask.Show();
        }
コード例 #13
0
ファイル: SellHomeSec.xaml.cs プロジェクト: ahmednasir91/HOP
        private void CameraButton_Click(object sender, EventArgs e)
        {
            var _cameraTask = new CameraCaptureTask();

            _cameraTask.Completed += OnCameraAlbumTaskOnCompleted;
            _cameraTask.Show();
        }
コード例 #14
0
        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();
        }
コード例 #15
0
        void appBarButtonCamera_Click(object sender, EventArgs e)
        {
            CameraCaptureTask camCapture = new CameraCaptureTask();

            camCapture.Completed += new EventHandler <PhotoResult>(camCapture_Completed);
            camCapture.Show();
        }
コード例 #16
0
 private void btnSaveNewPhoto_Click(object sender, RoutedEventArgs e)
 {
     // Start the camera capture task.
     cameraCaptureTask            = new CameraCaptureTask();
     cameraCaptureTask.Completed += new EventHandler <PhotoResult>(cameraCaptureTask_Completed);
     cameraCaptureTask.Show();
 }
コード例 #17
0
        private void ShowCameraCaptureTask(object sender, EventArgs e)
        {
            CameraCaptureTask photoCameraCapture = new CameraCaptureTask();

            photoCameraCapture.Completed += photoCompleted;
            photoCameraCapture.Show();
        }
コード例 #18
0
        private void Capture_Click(object sender, EventArgs e)
        {
            var task = new CameraCaptureTask();

            task.Completed += chooserTask_Completed;
            task.Show();
        }
コード例 #19
0
        public void Capture()
        {
            var cameraCaptureTask = new CameraCaptureTask();

            cameraCaptureTask.Completed += new EventHandler <PhotoResult>(cameraCaptureTask_Completed);
            cameraCaptureTask.Show();
        }
コード例 #20
0
        private void SelectButton_Click(object sender, EventArgs e)
        {
            var task = new CameraCaptureTask();

            task.Completed += CaptureTask_Completed;
            task.Show();
        }
コード例 #21
0
        private void bTakePhoto_OnTap(object sender, GestureEventArgs e)
        {
            var cc = new CameraCaptureTask();

            cc.Completed += (o, result) =>
            {
                if (result.TaskResult == TaskResult.Cancel)
                {
                    return;
                }
                var bi = new BitmapImage();
                bi.SetSource(result.ChosenPhoto);
                biTerrImage.Source = bi;

                var wb = new WriteableBitmap(biTerrImage, null);
                wb.Invalidate();

                var bmp = new BitmapImage();
                using (var ms = new MemoryStream()) {
                    wb.SaveJpeg(ms, 300, 300, 0, 100);
                    bmp.SetSource(ms);
                }
                ViewModel.TerritoryCardImage = bmp;
                biTerrImage.SetBinding(Image.SourceProperty,
                                       new Binding()
                {
                    Source = ViewModel.TerritoryCardImage
                });
            };
            cc.Show();
        }
コード例 #22
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            CameraCaptureTask ct = new CameraCaptureTask();

            ct.Completed += ct_Completed;
            ct.Show();
        }
コード例 #23
0
ファイル: Capture.cs プロジェクト: hermwong/phonegap-wp7
        /// <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));
            }
        }
コード例 #24
0
        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);
        }
コード例 #25
0
        private void btnMakePhoto_Click(object sender, RoutedEventArgs e)
        {
            var cameraCaptureTask = new CameraCaptureTask();

            cameraCaptureTask.Completed += TaskCompletedPhoto;
            cameraCaptureTask.Show();
        }
コード例 #26
0
        private void btFoto_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("camera");
            CameraCaptureTask camera = new CameraCaptureTask();

            camera.Completed += Camera_Completed;
            camera.Show();
        }
コード例 #27
0
        private void GetCaptureImageA(object obj)
        {
            CameraCaptureTask camera = new CameraCaptureTask();
            camera.Show();

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

        }
コード例 #28
0
        private void Camera_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            CameraCaptureTask cameraCaptureTask = new CameraCaptureTask();

            cameraCaptureTask.Completed += imageTask_Completed;

            cameraCaptureTask.Show();
        }
コード例 #29
0
ファイル: BabyViewModel.cs プロジェクト: hmiguellima/babyfeed
        private void HandleCapturePhoto()
        {
            CameraCaptureTask photoCameraCapture;

            photoCameraCapture            = new CameraCaptureTask();
            photoCameraCapture.Completed += new EventHandler <PhotoResult>(HandlePhotoResult);
            photoCameraCapture.Show();
        }
コード例 #30
0
        //public ICommand RemoveItemCommand { get; set; }
        //public ICommand GetPreviewLinkItemCommand { get; set; }
        //public ICommand DownloadItemCommand { get; set; }
        //public ICommand RenameItemCommand { get; set; }
        //public ICommand CreateShortCutCommand { get; set; }
        //public ICommand ChangeViewCommand { get; set; }
        //public ICommand MultiSelectCommand { get; set; }
        //public ICommand UpgradeAccountCommand { get; set; }

        #endregion

        //#region Events

        //private void OnCommandStatusChanged(bool status)
        //{
        //    if (CommandStatusChanged == null) return;

        //    CommandStatusChanged(this, new CommandStatusArgs(status));
        //}

        //#endregion

        #region Services


        #endregion

        #region Public Methods

        //public void SetCommandStatus(bool status)
        //{
        //    OnCommandStatusChanged(status);
        //}

        //public void TranslateAppBar(IList iconButtons, IList menuItems, MenuType menuType)
        //{
        //    switch (menuType)
        //    {
        //        case MenuType.CloudDriveMenu:
        //        {
        //            ((ApplicationBarIconButton)iconButtons[0]).Text = UiResources.Upload.ToLower();
        //            ((ApplicationBarIconButton)iconButtons[1]).Text = UiResources.AddFolder.ToLower();
        //            //((ApplicationBarIconButton)iconButtons[2]).Text = UiResources.Refresh.ToLower();
        //            ((ApplicationBarIconButton)iconButtons[2]).Text = UiResources.OpenLink.ToLower();

        //            //((ApplicationBarMenuItem)menuItems[0]).Text = UiResources.MultiSelect.ToLower();
        //            //((ApplicationBarMenuItem)menuItems[1]).Text = UiResources.Transfers.ToLower();
        //            //((ApplicationBarMenuItem)menuItems[2]).Text = UiResources.MyAccount.ToLower();
        //            //((ApplicationBarMenuItem)menuItems[3]).Text = UiResources.Settings.ToLower();
        //            //((ApplicationBarMenuItem)menuItems[4]).Text = UiResources.About.ToLower();
        //            break;
        //        }
        //        case MenuType.RubbishBinMenu:
        //        {
        //            ((ApplicationBarIconButton)iconButtons[0]).Text = UiResources.Refresh.ToLower();

        //            ((ApplicationBarMenuItem)menuItems[0]).Text = UiResources.CloudDriveName.ToLower();
        //            //((ApplicationBarMenuItem)menuItems[1]).Text = UiResources.MultiSelect.ToLower();
        //            //((ApplicationBarMenuItem)menuItems[2]).Text = UiResources.Transfers.ToLower();
        //            //((ApplicationBarMenuItem)menuItems[3]).Text = UiResources.MyAccount.ToLower();
        //            //((ApplicationBarMenuItem)menuItems[4]).Text = UiResources.Settings.ToLower();
        //            //((ApplicationBarMenuItem)menuItems[5]).Text = UiResources.About.ToLower();
        //            break;
        //        }
        //        case MenuType.MoveMenu:
        //        {
        //            ((ApplicationBarIconButton)iconButtons[0]).Text = UiResources.Move.ToLower();
        //            ((ApplicationBarIconButton)iconButtons[1]).Text = UiResources.Cancel.ToLower();

        //            break;
        //        }
        //        case MenuType.MultiSelectMenu:
        //        {
        //            ((ApplicationBarIconButton)iconButtons[0]).Text = UiResources.Download.ToLower();
        //            ((ApplicationBarIconButton)iconButtons[1]).Text = UiResources.Move.ToLower();
        //            ((ApplicationBarIconButton)iconButtons[2]).Text = UiResources.Remove.ToLower();
        //            break;
        //        }
        //        case MenuType.ImportMenu:
        //        {
        //            ((ApplicationBarIconButton)iconButtons[0]).Text = UiResources.LinkOptions.ToLower();
        //            ((ApplicationBarIconButton)iconButtons[1]).Text = UiResources.Cancel.ToLower();
        //            break;
        //        }
        //    }

        //}


        //    this.IsMultiSelectActive = false;

        //    return true;
        //}

        //public bool SelectMultipleMove()
        //{
        //    int count = ChildNodes.Count(n => n.IsMultiSelected);

        //    if (count < 1) return false;

        //    SelectedNodes.Clear();

        //    foreach (var node in ChildNodes.Where(n => n.IsMultiSelected))
        //    {
        //        node.DisplayMode = NodeDisplayMode.SelectedForMove;
        //        SelectedNodes.Add(node);
        //    }

        //    this.IsMultiSelectActive = false;
        //    OldDriveDisplayMode = DriveDisplayMode;
        //    DriveDisplayMode = DriveDisplayMode.MoveItem;

        //    return true;
        //}

        //public async void MultipleDownload(StorageFolder downloadFolder = null)
        //{
        //    int count = ChildNodes.Count(n => n.IsMultiSelected);

        //    if (count < 1) return;

        //    #if WINDOWS_PHONE_80
        //    if (!SettingsService.LoadSetting<bool>(SettingsResources.QuestionAskedDownloadOption, false))
        //    {
        //        switch (await DialogService.ShowOptionsDialog(AppMessages.QuestionAskedDownloadOption_Title,
        //            AppMessages.QuestionAskedDownloadOption,
        //            new[] { AppMessages.QuestionAskedDownloadOption_YesButton, AppMessages.QuestionAskedDownloadOption_NoButton }))
        //        {
        //            case -1:
        //            {
        //                return;
        //            }
        //            case 0:
        //            {
        //                SettingsService.SaveSetting(SettingsResources.ExportImagesToPhotoAlbum, true);
        //                break;
        //            }
        //            case 1:
        //            {
        //                SettingsService.SaveSetting(SettingsResources.ExportImagesToPhotoAlbum, false);
        //                break;
        //            }
        //        }
        //        SettingsService.SaveSetting(SettingsResources.QuestionAskedDownloadOption, true);
        //    }
        //    #elif WINDOWS_PHONE_81
        //    // Only 1 Folder Picker can be open at 1 time
        //    if (PickerOrDialogIsOpen) return;

        //    if (downloadFolder == null)
        //    {
        //        PickerOrDialogIsOpen = true;
        //        if (!await FolderService.SelectDownloadFolder())return;
        //    }
        //    #endif

        //    ProgressService.SetProgressIndicator(true, ProgressMessages.PrepareDownloads);

        //    // Give the app the time to display the progress indicator
        //    await Task.Delay(5);

        //    // First count the number of downloads before proceeding to the transfers.
        //    int downloadCount = 0;
        //    var downloadNodes = new List<IMegaNode>();

        //    foreach (var node in ChildNodes.Where(n => n.IsMultiSelected))
        //    {
        //        // If selected file is a folder then also select it childnodes to download
        //        var folderNode = node as FolderNodeViewModel;
        //        if (folderNode != null)
        //        {
        //            List<NodeViewModel> recursiveNodes = NodeService.GetRecursiveNodes(MegaSdk, AppInformation, folderNode);
        //            foreach (var recursiveNode in recursiveNodes)
        //            {
        //                downloadNodes.Add(recursiveNode);
        //                downloadCount++;
        //            }
        //        }
        //        else
        //        {
        //            // No folder then just add node to transferlist
        //            downloadNodes.Add(node);
        //            downloadCount++;
        //        }

        //    }

        //    if (!DownloadLimitCheck(downloadCount))
        //    {
        //        ProgressService.SetProgressIndicator(false);
        //        return;
        //    }

        //    downloadNodes.ForEach(n =>
        //    {
        //        if (downloadFolder != null)
        //            n.Transfer.DownloadFolderPath = downloadFolder.Path;
        //        App.MegaTransfers.Add(n.Transfer);
        //        n.Transfer.StartTransfer();
        //    });

        //    ProgressService.SetProgressIndicator(false);

        //    this.IsMultiSelectActive = false;
        //    this.NoFolderUpAction = true;
        //    NavigateService.NavigateTo(typeof(TransferPage), NavigationParameter.Downloads);
        //}



        //private void CreateShortCut(object obj)
        //{
        //    var shortCutTile = new RadIconicTileData()
        //    {
        //        IconImage = new Uri("/Assets/Tiles/FolderIconImage.png", UriKind.Relative),
        //        SmallIconImage = new Uri("/Assets/Tiles/FolderSmallIconImage.png", UriKind.Relative),
        //        Title = FocusedNode.Name
        //    };

        //    LiveTileHelper.CreateOrUpdateTile(shortCutTile,
        //        new Uri("/Pages/MainPage.xaml?ShortCutHandle=" + FocusedNode.OriginalMNode.getHandle(), UriKind.Relative),
        //        false);
        //}

        //public bool HasChildNodes()
        //{
        //    return ChildNodes.Count > 0;
        //}

        public void CaptureCameraImage()
        {
            var cameraCaptureTask = new CameraCaptureTask();

            cameraCaptureTask.Completed += PhotoTaskOnCompleted;
            NoFolderUpAction             = true;
            cameraCaptureTask.Show();
        }
コード例 #31
0
        public static void CaptureCameraImage(FolderViewModel currentFolder)
        {
            try
            {
                var cameraCaptureTask = new CameraCaptureTask();

                cameraCaptureTask.Completed += async(sender, result) =>
                {
                    if (result == null || result.TaskResult != TaskResult.OK)
                    {
                        return;
                    }

                    try
                    {
                        string fileName = Path.GetFileName(result.OriginalFileName);
                        if (fileName != null)
                        {
                            string newFilePath = Path.Combine(AppService.GetUploadDirectoryPath(), fileName);
                            using (var fs = new FileStream(newFilePath, FileMode.Create))
                            {
                                await result.ChosenPhoto.CopyToAsync(fs);

                                await fs.FlushAsync();

                                fs.Close();
                            }
                            var uploadTransfer = new TransferObjectModel(currentFolder.MegaSdk,
                                                                         currentFolder.FolderRootNode,
                                                                         TransferType.Upload,
                                                                         newFilePath);
                            App.MegaTransfers.Insert(0, uploadTransfer);
                            uploadTransfer.StartTransfer();
                        }

                        NavigateService.NavigateTo(typeof(TransferPage), NavigationParameter.Normal);
                    }
                    catch (Exception)
                    {
                        new CustomMessageDialog(
                            AppMessages.PhotoUploadError_Title,
                            AppMessages.PhotoUploadError,
                            App.AppInformation,
                            MessageDialogButtons.Ok).ShowDialog();
                    }
                };

                cameraCaptureTask.Show();
            }
            catch (Exception e)
            {
                new CustomMessageDialog(
                    AppMessages.CapturePhotoFailed_Title,
                    String.Format(AppMessages.CapturePhotoFailed, e.Message),
                    App.AppInformation,
                    MessageDialogButtons.Ok).ShowDialog();
            }
        }
コード例 #32
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (App.PhotoModel != null)
            {
                _saveButton.IsEnabled = App.PhotoModel.Dirty;

                if (!Busy)
                {
                    await SetupAsync();
                }
            }
            else if (e.Uri.ToString().Contains("ViewfinderLaunch"))
            {
                if (e.NavigationMode == NavigationMode.Back)
                {
                    Application.Current.Terminate();
                }
                else
                {
                    // uncomment the following lines to test tombstoning (without tasks)

                    //if (App.PhotoModel != null)
                    //{
                    //    App.PhotoModel.Dispose();
                    //}

                    //using (MemoryStream stream = new MemoryStream())
                    //{
                    //    Application.GetResourceStream(new Uri("SplashScreenImage.jpg", UriKind.Relative)).Stream.CopyTo(stream);

                    //    App.PhotoModel = new PhotoModel() { Buffer = stream.GetWindowsRuntimeBuffer() };
                    //    App.PhotoModel.Captured = true;
                    //    App.PhotoModel.Dirty = App.PhotoModel.Captured;
                    //}

                    //await SetupAsync(true, true);

                    //return;

                    _cameraCaptureTask.Show();
                }
            }
        }
コード例 #33
0
        private void CameraButtonClick(object sender,
                                      RoutedEventArgs e)
        {
            CameraCaptureTask camera = new CameraCaptureTask();
            camera.Completed += new EventHandler
                                     <PhotoResult>(camera_Result);

            camera.Show();
        }
コード例 #34
0
        private void rdoCamera_Checked(object sender, RoutedEventArgs e)
        {
            CameraCaptureTask cct = new CameraCaptureTask();

            //Launch the Camera
            cct.Show();
            //Add Event
            cct.Completed += cct_Completed;
        }
コード例 #35
0
 private void btnShot_Click(object sender, RoutedEventArgs e)
 {
     //创建一个捕获相机拍照的选择器
     cct = new CameraCaptureTask();
     //注册选择器完成的事件
     cct.Completed += new EventHandler <PhotoResult>(cct_Completed);
     //启动拍照选择器
     cct.Show();
 }
コード例 #36
0
ファイル: MainPage.xaml.cs プロジェクト: Arthraim/WbtoMongo
        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();
        }
コード例 #37
0
ファイル: MainPage.xaml.cs プロジェクト: hkgumbs/panes
        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();
        }
コード例 #38
0
        private void Foto_Click(object sender, EventArgs e)
        {
            //Show the camera.
            _cameraCapture.Show();

            //Set progress bar to visible to show time between user snapshot and decoding
            //of image into a writeable bitmap object.
            progressBar.Visibility = Visibility.Visible;
        }
コード例 #39
0
 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;
       }
 }
コード例 #40
0
        public Task<CameraResult> TakePictureAsync()
        {
            CameraCaptureTask cameraCaptureTask = new CameraCaptureTask();
            cameraCaptureTask.Completed += CameraCaptureTaskOnCompleted;

            cameraCaptureTask.Show();

            tcs = new TaskCompletionSource<CameraResult>();

            return tcs.Task;
        }
コード例 #41
0
 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.");
     }
 }
コード例 #42
0
 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();
 }
コード例 #43
0
        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
            }
        }
コード例 #44
0
        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;
        }
コード例 #45
0
		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();
			};
		}
コード例 #46
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (executedOnce)
            {
                return;
            }

            executedOnce = true;

            if (NavigationContext.QueryString.ContainsKey("upload_to_set_id"))
            {
                // Upload to the photo set after editing
                uploadToSetId = NavigationContext.QueryString["upload_to_set_id"];
            }

            if (NavigationContext.QueryString.ContainsKey("is_from_library"))
            {
                // Choose from media library
                photoChooserTask = new PhotoChooserTask();
                photoChooserTask.Completed += OnCaptureTaskCompleted;
                photoChooserTask.Show();
            }
            else if (PolicyKit.ShouldUseProCamera)
            {
                // Use ProCam
                if (uploadToSetId != null)
                {
                    NavigationService.Navigate(new Uri("/Plugins/ProCam/ProCamPage.xaml?upload_to_set_id=" + uploadToSetId, UriKind.Relative));
                }
                else
                {
                    NavigationService.Navigate(new Uri("/Plugins/ProCam/ProCamPage.xaml", UriKind.Relative));
                }

                NavigationService.RemoveBackEntry();
            }
            else
            {
                // Use system default camera
                camTask = new CameraCaptureTask();
                camTask.Completed += new EventHandler<PhotoResult>(OnCaptureTaskCompleted);
                camTask.Show();
            }
        }
コード例 #47
0
        private void ApplicationBarIconButton_OnClick(object sender, EventArgs e)
        {
            var cc = new CameraCaptureTask();
            cc.Completed += (o, result) =>
            {
                var bmp = new BitmapImage();
                if (result.ChosenPhoto == null) return;
                bmp.SetSource(result.ChosenPhoto);
                imgPresentationPic.Source = bmp;

                using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication()) {
                    var wb = new WriteableBitmap(bmp);
                    using (var isoFileStream = isoStore.CreateFile("Presentation.jpg"))
                        Extensions.SaveJpeg(wb, isoFileStream, bmp.PixelWidth, wb.PixelHeight, 0, 100);
                }
            };
            cc.Show();
        }
コード例 #48
0
ファイル: RhoCamera.cs プロジェクト: arissetyawan/rhodes
 public static void takePicture(RubyModule/*!*/ self, [NotNull]String/*!*/ callback)
 {
     try
     {
         m_callback = callback;
         CameraCaptureTask cameraCaptureTask;
         cameraCaptureTask = new CameraCaptureTask();
         cameraCaptureTask.Completed += new EventHandler<PhotoResult>(cameraTask_Completed);
         cameraCaptureTask.Show();
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("take_picture", ex);
         throw rubyEx;
     }
 }
コード例 #49
0
        public override void Execute(params string[] args)
        {
            this.HasCallback = false; // This uses an AsyncCallback

            this.successCallback = args[0];
            this.errorCallback = args[1];

            // args[2] contains a quality option but we ignore it in WP7
            try
            {
                // Tombstoning causes real problems at the moment, not least with subscribed events (like below), but also with just reloading the page
                // May need to reconsider how/if we wish to support this
                var cct = new CameraCaptureTask();
                cct.Completed += this.cct_Completed;
                cct.Show();
            }
            catch (Exception exc)
            {
                this.CallbackName = this.errorCallback;
                this.CallbackArgs = new[] { exc.Message };
            }
        }
コード例 #50
0
        private void bTakePhoto_OnTap(object sender, GestureEventArgs e)
        {
            var cc = new CameraCaptureTask();
                    cc.Completed += (o, result) =>
                    {
                        if (result.TaskResult == TaskResult.Cancel) return;
                        var bi = new BitmapImage();
                        bi.SetSource(result.ChosenPhoto);
                        biTerrImage.Source = bi;

                        var wb = new WriteableBitmap(biTerrImage, null);
                        wb.Invalidate();

                        var bmp = new BitmapImage();
                        using (var ms = new MemoryStream()) {
                            wb.SaveJpeg(ms, 300, 300, 0, 100);
                            bmp.SetSource(ms);
                        }
                        ViewModel.TerritoryCardImage = bmp;
                        biTerrImage.SetBinding(Image.SourceProperty,
                            new Binding() {Source = ViewModel.TerritoryCardImage});
                    };
                        cc.Show();
        }
コード例 #51
0
 private void Capture_Click(object sender, EventArgs e)
 {
    var task = new CameraCaptureTask();
    task.Completed += chooserTask_Completed;
    task.Show();
 }
コード例 #52
0
        private void Button_clicked(object sender, RoutedEventArgs e)
        {
            Button current_button = (Button)sender;
            String button_name = current_button.Name;
            switch (button_name)
            {
                case "message":
                    //MessageBox.Show("message button clicked");
                    SmsComposeTask sms = new SmsComposeTask();
                    sms.To = "";
                    sms.Show();
                    break;
                case "calendar":
                    //MessageBox.Show("Canlendar button clicked");
                    WebBrowserTask webBrowserTask1 = new WebBrowserTask();
                    webBrowserTask1.Uri = new Uri("http://calendar.google.com/", UriKind.Absolute);
            webBrowserTask1.Show();
                    break;
                case "photos":
                     PhotoChooserTask photo = new PhotoChooserTask();
            photo.Show();
                    break;
                case "camera":
                    CameraCaptureTask cam = new CameraCaptureTask();
                    cam.Show();
                    break;
                case "youtube":
                     WebBrowserTask webBrowserTask2 = new WebBrowserTask();
                     webBrowserTask2.Uri = new Uri("http://m.youtube.com/", UriKind.Absolute);
            webBrowserTask2.Show();
                    break;
                case "stocks":
                    break;
                case "maps":
                    //MessageBox.Show("maps clicked");
                    BingMapsTask bmt = new BingMapsTask();
            //bmt.Center = new GeoCoordinate(-27.5, 153);
            bmt.SearchTerm = "New York";
            bmt.Show();
                    break;
                case "weather":
                    WebBrowserTask webBrowserTask3 = new WebBrowserTask();
                    webBrowserTask3.Uri = new Uri("http://www.weather.com/", UriKind.Absolute);
            webBrowserTask3.Show();

                    break;
                case "notes":
                    break;
                case "voice_memos":
                    break;
                case "itunes":
                     MarketplaceHubTask market1 = new MarketplaceHubTask();
                    market1.Show();
                    break;
                case "app_store":
                     MarketplaceHubTask market = new MarketplaceHubTask();
                    market.Show();
                    break;
                case "settings":
                    break;
                case "phone":
                    phoneNumberChooserTask = new PhoneNumberChooserTask();
                    phoneNumberChooserTask.Completed += new EventHandler<PhoneNumberResult>(phoneNumberChooserTask_Completed);
                    try
                    {
                        phoneNumberChooserTask.Show();
                    }
                    catch (System.InvalidOperationException ex)
                    {
                        MessageBox.Show("An error occurred.");
                    }
                    //PhoneCallTask phoneCallTask = new PhoneCallTask();

                    //phoneCallTask.PhoneNumber = "123456789";
                    //phoneCallTask.DisplayName = "Shadowfax Apps";

                    //phoneCallTask.Show();
                    break;
                case "mail":
                    EmailComposeTask emailComposeTask = new EmailComposeTask();
            emailComposeTask.Subject = "";
            emailComposeTask.Body = "";
            emailComposeTask.To = "";
            emailComposeTask.Show();
                    break;
                case "safari":
                    WebBrowserTask webBrowserTask4 = new WebBrowserTask();
            webBrowserTask4.Uri = new Uri("http://www.google.com", UriKind.Absolute);
            webBrowserTask4.Show();
                    break;
                case "ipod":

                    break;

                default:
                    break;
            }
        }
コード例 #53
0
 /*Scan button: will Launch camera so that the user can take a picture of the Microsoft tag/QR code.
  * Once the user has taken the picture, it will be analyzed and the tag references will be loaded*/
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     cameraCaptureTask1 = new CameraCaptureTask();
     cameraCaptureTask1.Completed += new EventHandler<PhotoResult>(cameraCaptureTask_Completed);
     try
     {
         cameraCaptureTask1.Show();
     }
     catch (System.InvalidOperationException ex)
     {
            //do nothing
     }
 }
コード例 #54
0
ファイル: Camera.cs プロジェクト: rudolfo/phonegap
        public void getPicture(string options)
        {
            try
            {
                this.cameraOptions = String.IsNullOrEmpty(options) ?
                        new CameraOptions() : JSON.JsonHelper.Deserialize<CameraOptions>(options);
            }
            catch (Exception ex)
            {
                this.DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, ex.Message));
                return;
            }

            //TODO Check if all the options are acceptable

            if (cameraOptions.PictureSourceType == CAMERA)
            {
                cameraTask = new CameraCaptureTask();
                cameraTask.Completed += onTaskCompleted;
                cameraTask.Show();
            }
            else
            {
                if ((cameraOptions.PictureSourceType == PHOTOLIBRARY) || (cameraOptions.PictureSourceType == SAVEDPHOTOALBUM))
                {
                    photoChooserTask = new PhotoChooserTask();
                    photoChooserTask.Completed += onTaskCompleted;
                    photoChooserTask.Show();
                }
                else
                {
                    DispatchCommandResult(new PluginResult(PluginResult.Status.NO_RESULT));
                }
            }
        }
コード例 #55
0
ファイル: Camera.cs プロジェクト: ChristianWeyer/tUdUs
        public void takePicture(string options)
        {
            try
            {
                string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
                // ["quality", "destinationType", "sourceType", "targetWidth", "targetHeight", "encodingType",
                //     "mediaType", "allowEdit", "correctOrientation", "saveToPhotoAlbum" ]
                this.cameraOptions = new CameraOptions();
                this.cameraOptions.Quality = int.Parse(args[0]);
                this.cameraOptions.DestinationType = int.Parse(args[1]);
                this.cameraOptions.PictureSourceType = int.Parse(args[2]);
                this.cameraOptions.TargetWidth = int.Parse(args[3]);
                this.cameraOptions.TargetHeight = int.Parse(args[4]);
                this.cameraOptions.EncodingType = int.Parse(args[5]);
                this.cameraOptions.MediaType = int.Parse(args[6]);
                this.cameraOptions.AllowEdit = bool.Parse(args[7]);
                this.cameraOptions.CorrectOrientation = bool.Parse(args[8]);
                this.cameraOptions.SaveToPhotoAlbum = bool.Parse(args[9]);

                //this.cameraOptions = String.IsNullOrEmpty(options) ?
                //        new CameraOptions() : JSON.JsonHelper.Deserialize<CameraOptions>(options);
            }
            catch (Exception ex)
            {
                this.DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, ex.Message));
                return;
            }

            //TODO Check if all the options are acceptable

            if (cameraOptions.PictureSourceType == CAMERA)
            {
                cameraTask = new CameraCaptureTask();
                cameraTask.Completed += onCameraTaskCompleted;
                cameraTask.Show();
            }
            else
            {
                if ((cameraOptions.PictureSourceType == PHOTOLIBRARY) || (cameraOptions.PictureSourceType == SAVEDPHOTOALBUM))
                {
                    photoChooserTask = new PhotoChooserTask();
                    photoChooserTask.Completed += onPickerTaskCompleted;
                    photoChooserTask.Show();
                }
                else
                {
                    DispatchCommandResult(new PluginResult(PluginResult.Status.NO_RESULT));
                }
            }
        }
コード例 #56
0
 private void OnLaunchCamera(object sender, EventArgs e)
 {
     var cameraCaptureTask = new CameraCaptureTask();
     cameraCaptureTask.Completed += this.OnCameraCaptureTaskCompleted;
     cameraCaptureTask.Show();
 }
コード例 #57
0
 /// <summary>
 /// Launches the camera cand save the captured photo for future upload.
 /// </summary>
 /// <param name="obj">Useless </param>
 private void TakePhoto(object obj)
 {
     CameraCaptureTask task = new CameraCaptureTask();
     task.Completed += (sender, e) =>
     {
         if (e.TaskResult == TaskResult.OK)
         {
             using (BinaryReader reader = new BinaryReader(e.ChosenPhoto))
             {
                 bytes = reader.ReadBytes(Convert.ToInt32(e.ChosenPhoto.Length));
                 BitmapImage bmp = new BitmapImage();
                 bmp.SetSource(e.ChosenPhoto);
                 FacebookImage = bmp;
             }
             (UploadPhotoToFacebookCommand as DelegateCommand).RaiseCanExecuteChanged();
         }
     };
     task.Show();
 }
コード例 #58
0
 private void ShowCameraCaptureTask()
 {
     CameraCaptureTask photoCameraCapture = new CameraCaptureTask();
     photoCameraCapture = new CameraCaptureTask();
     photoCameraCapture.Completed += new EventHandler<PhotoResult>(photoCameraCapture_Completed);
     photoCameraCapture.Show();
 }
コード例 #59
0
		private async void loadCameraPickerAsync(CameraQuality quality, int maxWidth, int maxHeight, StreamLoadedCallbackMethod streamLoadedCallback)
		#endif
		{
			#if WINDOWS_PHONE
			WinRTPlugin.Dispatcher.BeginInvoke(delegate()
			{
				loadCameraPicker_streamLoadedCallback = streamLoadedCallback;
				loadCameraPicker_maxWidth = maxWidth;
				loadCameraPicker_maxHeight = maxHeight;

				var cameraCaptureTask = new CameraCaptureTask();
				cameraCaptureTask.Completed += new EventHandler<PhotoResult>(cameraCaptureTask_Completed);
				cameraCaptureTask.Show();
			});
			#elif UNITY_WP_8_1
			loadFileDialogAsync(FolderLocations.Pictures, maxWidth, maxHeight, new string[]{".jpg"}, streamLoadedCallback);
			#else
			await WinRTPlugin.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async delegate()
			{
				try
				{
					var cameraUI = new CameraCaptureUI();
					cameraUI.PhotoSettings.AllowCropping = false;
					switch (quality)
					{
						case CameraQuality.Low: cameraUI.PhotoSettings.MaxResolution = CameraCaptureUIMaxPhotoResolution.SmallVga; break;
						case CameraQuality.Med: cameraUI.PhotoSettings.MaxResolution = CameraCaptureUIMaxPhotoResolution.MediumXga; break;
						case CameraQuality.High: cameraUI.PhotoSettings.MaxResolution = CameraCaptureUIMaxPhotoResolution.HighestAvailable; break;
					}

					var capturedMedia = await cameraUI.CaptureFileAsync(CameraCaptureUIMode.Photo);
					if (capturedMedia != null)
					{
						using (var cameraStream = await capturedMedia.OpenAsync(FileAccessMode.Read))
						{
							if (maxWidth == 0 || maxHeight == 0)
							{
								ReignServices.InvokeOnUnityThread(delegate
								{
									streamLoadedCallback(cameraStream.AsStream(), true);
								});
							}
							else
							{
								var stream = await resizeImageStream(cameraStream, maxWidth, maxHeight);
								ReignServices.InvokeOnUnityThread(delegate
								{
									streamLoadedCallback(stream, true);
								});
							}
						}
					}
					else
					{
						ReignServices.InvokeOnUnityThread(delegate
						{
							streamLoadedCallback(null, false);
						});
					}
				}
				catch (Exception e)
				{
					Debug.LogError(e.Message);
					ReignServices.InvokeOnUnityThread(delegate
					{
						streamLoadedCallback(null, false);
					});
				}
			});
			#endif
		}
コード例 #60
0
ファイル: AddVehicle.xaml.cs プロジェクト: kleitz/WPApp
 private void btnCaptureMotorInsuranceImg_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     cameraCaptureTask = new CameraCaptureTask();
     cameraCaptureTask.Completed += new EventHandler<PhotoResult>(cameraCaptureMotorInsuranceTask_Completed);
     cameraCaptureTask.Show();
 }