コード例 #1
0
        /// <summary>
        /// Executes the camera command.
        /// </summary>
        /// <returns>The camera command.</returns>
        public async Task ExecutePickCommand()
        {
            try
            {
                ChangeMediaButtonEnableState(enable: false);

                //await Task.Factory.StartNew(async () =>
                //{
                CameraHelpers ch = new CameraHelpers();
                GalleryImage  gi = await ch.PickPicture();

                if (gi != null)
                {
                    _images.Add(gi);
                }
                ch.Dispose();
                ch              = null;
                NumberOfImages += 1;
                //});
            }
            catch (Exception ex)
            {
            }
            finally
            {
                ChangeMediaButtonEnableState(enable: true);
            }
        }
コード例 #2
0
        /// <summary>
        /// Executes the camera command.
        /// </summary>
        /// <returns>The camera command.</returns>
        public async Task ExecuteCameraCommand()
        {
            IsBusy = true;

            try
            {
                ChangeMediaButtonEnableState(enable: false);

                using (CameraHelpers ch = new CameraHelpers())
                {
                    GalleryImage gi = await ch.TakePictureFromCamera();

                    if (gi != null)
                    {
                        _images.Add(gi);
                    }
                    ch.Dispose();
                };
                NumberOfImages += 1;

                IsLoading = false;
                IsBusy    = false;
            }
            catch (Exception ex)
            {
            }
            finally
            {
                ChangeMediaButtonEnableState(enable: true);
            }
        }