示例#1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it

            var movieInputText       = this.FindViewById <EditText>(Resource.Id.movieTextInputLabel);
            var getMovieButton       = this.FindViewById <Button>(Resource.Id.getMovieButton);
            var displayMovieTextView = this.FindViewById <TextView>(Resource.Id.isplayMovieSearchLabel);

            MovieDbFactory.RegisterSettings(new MovieDbSettings());
            var movieApi     = MovieDbFactory.Create <IApiMovieRequest>().Value;
            var movieService = new MovieServices(movieApi);

            MovieDownload.StorageClient   storageClient   = new MovieDownload.StorageClient();
            MovieDownload.ImageDownloader imageDownloader = new MovieDownload.ImageDownloader(storageClient);

            getMovieButton.Click += async(object sender, EventArgs e) =>
            {
                this._movieList = await movieService.getListOfMoviesMatchingSearch(movieInputText.Text);

//                await imageDownloader.getLocalPath(this._movieList);

                //var answer = getListOfMoviesMatchingSearch(movieInputText.Text);
                var manager = (InputMethodManager)this.GetSystemService(InputMethodService);
                manager.HideSoftInputFromWindow(movieInputText.WindowToken, 0);
                displayMovieTextView.Text = this._movieList[0].Title;
            };
        }
示例#2
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method
            this.Window = new UIWindow(UIScreen.MainScreen.Bounds);

            MovieDbFactory.RegisterSettings(new MovieDbSettings());
            var movieApi     = MovieDbFactory.Create <IApiMovieRequest>().Value;
            var movieService = new MovieServices(movieApi);

            MovieDownload.StorageClient   storageClient   = new MovieDownload.StorageClient();
            MovieDownload.ImageDownloader imageDownloader = new MovieDownload.ImageDownloader(storageClient);

            var controller = new MovieSearchViewController(movieService, imageDownloader);
            var movieSearchNavigationController = new UINavigationController(controller);

            // List<Movie> topRatedMovies = new List<Movie>();
            //  topRatedMovies = movieService.getTopRatedMovies();

            var movieListController = new MovieListController(new List <Movie>()
            {
            }, new List <MovieDetail>()
            {
            });
            var movieListNavigationController = new UINavigationController(movieListController);
            var tabController = new TabController()
            {
                ViewControllers = new UIViewController[] { movieSearchNavigationController, movieListNavigationController }
            };



            this.Window.RootViewController = tabController;
            //new UINavigationController(controller);
            this.Window.MakeKeyAndVisible();

            return(true);
        }
示例#3
0
 public MovieSearchViewController(MovieServices movieService, MovieDownload.ImageDownloader imageDownloader)
 {
     _movieService    = movieService;
     _imageDownloader = imageDownloader;
 }