private async void SearchTextBox_KeyDown(object sender, KeyRoutedEventArgs e)
 {
     if (e.Key == Windows.System.VirtualKey.Enter)
     {
         GalleryScrollViewer.ChangeView(null, 0, null);
         await _galleryViewModel.SetSearchString(SearchTextBox.Text);
     }
 }
        protected async void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.Parameter != null && e.Parameter is SplitViewPage)
            {
                _parent = (SplitViewPage)e.Parameter;
            }

            if (_isNewPageInstance)
            {
                _galleryViewModel = GalleryViewModel.Instance();

                _activeService     = _galleryViewModel.ActiveService;
                SearchTextBox.Text = _galleryViewModel.GetSearchString();

                GalleryViewSource.Source = _galleryViewModel.ImageCollection;
                await _galleryViewModel.GetFirstImages();
            }

            // re sync images when we switch between services
            if (_activeService != _galleryViewModel.ActiveService)
            {
                _activeService = _galleryViewModel.ActiveService;

                GalleryScrollViewer.ChangeView(null, 0, null);
                await _galleryViewModel.GetFirstImages();
            }

            // set title
            if (_galleryViewModel.ActiveService == ImageService.Instagram)
            {
                TitleText.Text = "Instagram";
            }
            else if (_galleryViewModel.ActiveService == ImageService.Flickr)
            {
                TitleText.Text = "Flickr";
            }
            else
            {
                TitleText.Text = "Giphy";
            }

            _isNewPageInstance = false;
        }
 private async void RefreshButton_Click(object sender, RoutedEventArgs e)
 {
     GalleryScrollViewer.ChangeView(null, 0, null);
     await _galleryViewModel.GetFirstImages();
 }