コード例 #1
0
        private async Task SelectImage(bool UseCamera)
        {
            progressBar.Visibility = ViewStates.Visible;
            await viewModel.TakePhotAsync(UseCamera);

            progressBar.Visibility = ViewStates.Gone;
        }
コード例 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            viewModel = new ImageSearchViewModel();

            CollectionViewImages.WeakDataSource  = this;
            CollectionViewImages.AllowsSelection = true;

            CollectionViewImages.Delegate = this;

            ButtonSearch.TouchUpInside += async(sender, e) =>
            {
                ButtonSearch.Enabled = false;
                ActivityIsLoading.StartAnimating();

                await viewModel.SearchForImagesAsync(TextFieldQuery.Text);

                CollectionViewImages.ReloadData();

                ButtonSearch.Enabled = true;
                ActivityIsLoading.StopAnimating();
            };

            var cameraButton = new UIBarButtonItem(UIBarButtonSystemItem.Camera,
                                                   async(sender, e) =>
            {
                ActivityIsLoading.StartAnimating();
                await viewModel.TakePhotAsync();
                ActivityIsLoading.StopAnimating();
            });

            var pickButton = new UIBarButtonItem(UIBarButtonSystemItem.Organize,
                                                 async(sender, e) =>
            {
                ActivityIsLoading.StartAnimating();
                await viewModel.TakePhotAsync(false);
                ActivityIsLoading.StopAnimating();
            });

            this.NavigationItem.RightBarButtonItems = new UIBarButtonItem[] { cameraButton, pickButton };
        }