Esempio n. 1
0
 private void MenuItem_Add(object sender, RoutedEventArgs e)
 {
     for (int i = 0; i < 100000; i++)
     {
         MoviesList.Add(new Movie()
         {
             Title    = "Rubber",
             Director = "Quentin Dupieux",
             Rating   = Rating.Awesome,
             Type     = Type.Horror
         });
     }
 }
Esempio n. 2
0
        private void MenuItem_Import(object sender, RoutedEventArgs e)
        {
            XmlSerializer  SerializerObj  = new XmlSerializer(MoviesList.GetType());
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.DefaultExt = ".xml";
            openFileDialog.Filter     = "XML documents (.xml) |*.xml";

            Nullable <bool> result = openFileDialog.ShowDialog();

            if (result == true)
            {
                var          path = openFileDialog.FileName;
                StreamReader rd   = new StreamReader(path);
                ObservableCollection <Movie> list = new ObservableCollection <Movie>();

                list = (ObservableCollection <Movie>)SerializerObj.Deserialize(rd);
                foreach (Movie item in list)
                {
                    MoviesList.Add(item);
                }
            }
        }
Esempio n. 3
0
        public async Task Init()
        {
            string route = "now-showing";
            var    list  = await _moviesApi.Get <List <MovieDto> >(null, route);

            MoviesList.Clear();

            foreach (var movie in list)
            {
                MoviesList.Add(movie);
            }


            var userId = await _moviesApi.GetCurrentUserId();

            var listRecommended = await _moviesApi.Get <List <MovieDto> >(userId, "recommended");

            MoviesRecommendedList.Clear();

            foreach (var movie in listRecommended)
            {
                MoviesRecommendedList.Add(movie);
            }
        }
 private void AddMovie(Movie movie)
 {
     MoviesList.Add(movie);
 }