Exemple #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            //iOS Image Search code
            viewModel = new ImageSearchViewModel();
            CollectionViewImages.WeakDataSource = this;

            //Button Click event to get images
            ButtonSearch.TouchUpInside += async(sender, args) =>
            {
                ButtonSearch.Enabled = false;
                ActivityIsLoading.StartAnimating();

                await viewModel.SearchForImagesAsync(TextFieldQuery.Text);

                CollectionViewImages.ReloadData();

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


            //IOS Keyboard Done Code
            var toolbar = new UIToolbar(new CGRect(0.0f, 0.0f, TextFieldQuery.Frame.Size.Width, 44.0f));

            toolbar.Items = new[]
            {
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { TextFieldQuery.ResignFirstResponder(); })
            };
            TextFieldQuery.InputAccessoryView = toolbar;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            viewModel = new ImageSearchViewModel();

            CollectionViewImages.WeakDataSource = this;


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

                // iOS 빌트인 애니메이션
                await UIView.AnimateAsync(1.0, () => CollectionViewImages.Alpha = 0);

                // Shared 코드 호출
                await viewModel.SearchForImagesAsync(TextFieldQuery.Text);

                CollectionViewImages.ReloadData();

                await UIView.AnimateAsync(1.0, () => CollectionViewImages.Alpha = 1);

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

            SetupCamera();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            viewModel = new ImageSearchViewModel();

            CollectionViewImages.WeakDataSource = this;

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

                await viewModel.SearchForImagesAsync(TextFieldQuery.Text);

                CollectionViewImages.ReloadData();

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


            NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Camera, async delegate
            {
                await viewModel.TakePhotoAndAnalyzeAsync(false);
            });
        }
Exemple #4
0
        void ReleaseDesignerOutlets()
        {
            if (ActivityIsLoading != null)
            {
                ActivityIsLoading.Dispose();
                ActivityIsLoading = null;
            }

            if (ButtonSearch != null)
            {
                ButtonSearch.Dispose();
                ButtonSearch = null;
            }

            if (CollectionViewImages != null)
            {
                CollectionViewImages.Dispose();
                CollectionViewImages = null;
            }

            if (TextFieldQuery != null)
            {
                TextFieldQuery.Dispose();
                TextFieldQuery = null;
            }
        }
Exemple #5
0
        public async void FillImageCells()
        {
            viewModel = new ImageSearchViewModel();
            CollectionViewImages.WeakDataSource = this;


            ActivityIsLoading.StartAnimating();

            await viewModel.SearchForImagesAsync(_query);

            CollectionViewImages.ReloadData();

            ActivityIsLoading.StopAnimating();
        }
        async void HandleButtonSearchTouchUpInside(object sender, EventArgs e)
        {
            //Dismiss Keyboard
            View.EndEditing(true);

            ButtonSearch.Enabled = false;
            ActivityIsLoading.StartAnimating();

            await viewModel.SearchForImagesAsync(TextFieldQuery.Text);

            CollectionViewImages.ReloadData();

            ButtonSearch.Enabled = true;
            ActivityIsLoading.StopAnimating();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            viewModel = new ImageSearchViewModel();

            CollectionViewImages.WeakDataSource = this;

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

                await viewModel.SearchForImagesAsync(TextFieldQuery.Text);

                CollectionViewImages.ReloadData();

                ButtonSearch.Enabled = true;
                ActivityIsLoading.StopAnimating();
            };
        }
        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 };
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            viewModel = new ImageSearchViewModel();

            CollectionViewImages.WeakDataSource = this;
            CollectionViewImages.WeakDelegate   = this;

            viewModel.Images.CollectionChanged += (sender, args) => BeginInvokeOnMainThread(() => CollectionViewImages.ReloadData());
            viewModel.PropertyChanged          += ViewModel_PropertyChanged;
            TextFieldQuery.Text            = viewModel.SearchQuery;
            TextFieldQuery.EditingChanged += (sender, args) => viewModel.SearchQuery = TextFieldQuery.Text;

            ButtonSearch.TouchUpInside += (sender, args) =>
            {
                viewModel.SearchForImageCommand.Execute(null);
            };

            SetupCamera();
        }