Exemplo n.º 1
0
 private async void IconFavorito(FilmesJson filme)
 {
     if (await Favorites.IsFavorite(filme))
     {
         Iconfav.Tag     = "";
         Iconfav.Content = "Unfavorite";
     }
     else
     {
         Iconfav.Tag     = "";
         Iconfav.Content = "Favorite";
     }
 }
Exemplo n.º 2
0
        private async void AppBarButton_Click(object sender, RoutedEventArgs e)
        {
            FilmesJson fjson = (FilmesJson)DataContext;
            bool       x     = await Favorites.IsFavorite(fjson);

            if (x)
            {
                await Favorites.UnFavorite(fjson);
            }
            else
            {
                await Favorites.AddFavorite(fjson);
            }
            IconFavorito(fjson);
        }
Exemplo n.º 3
0
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            string data = await Favorites.ReadFavorites();

            if (!string.IsNullOrEmpty(data))
            {
                lista.ItemsSource = Favorites.GetFavorites(data);
            }
            StackSearch.Visibility = Visibility.Collapsed;
            SeasonS.Visibility     = Visibility.Collapsed;
            EpisodeS.Visibility    = Visibility.Collapsed;
            Voltapag.Visibility    = Visibility.Collapsed;
            Avpag.Visibility       = Visibility.Collapsed;
            lista.SetValue(Grid.RowSpanProperty, 2);
            //lista rowspan 2
        }
Exemplo n.º 4
0
        private async void AppBarButton_Click_Home(object sender, RoutedEventArgs e)
        {
            string data = await Favorites.ReadFavorites();

            if (!string.IsNullOrEmpty(data))
            {
                lista.ItemsSource = Favorites.GetFavorites(data);
            }
            this.DataContext = null;
            rating.Children.Clear();
            IconFilme.Source    = null;
            Voltapag.Visibility = Visibility.Collapsed;
            Avpag.Visibility    = Visibility.Collapsed;
            lista.SetValue(Grid.RowSpanProperty, 2);
            Pagina.Text = "";
            busca       = "";
        }
Exemplo n.º 5
0
        private async void BotaoBusca_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                i       = 1;
                season  = SeasonS.Text;
                episode = EpisodeS.Text;
                busca   = BuscaS.Text;
                if (season.Equals("") || episode.Equals(""))
                {
                    data = await GetResponseFromUrl(string.Format("http://www.omdbapi.com/?t={0}&plot=full", busca));
                }
                else
                {
                    data = await GetResponseFromUrl(string.Format("http://www.omdbapi.com/?t={0}&Season={1}&Episode={2}", busca, season, episode));
                }
                FilmesJson movie = JsonConvert.DeserializeObject <FilmesJson>(data);
                Bind(movie);
                data = await GetResponseFromUrl(string.Format("http://www.omdbapi.com/?s={0}", busca));

                string            raw       = JObject.Parse(data).SelectToken("Search").ToString();
                List <FilmesJson> movieList = JsonConvert.DeserializeObject <List <FilmesJson> >(raw);
                lista.ItemsSource = movieList;
                FilmesJson fjson = (FilmesJson)DataContext;
                bool       x     = await Favorites.IsFavorite(fjson);

                paginasmax  = Math.Ceiling(Convert.ToDouble(JObject.Parse(data)["totalResults"].ToString()) / 10);
                Pagina.Text = i + "/" + paginasmax;
                IconFavorito(fjson);
                Voltapag.Visibility = Visibility.Visible;
                Avpag.Visibility    = Visibility.Visible;
                lista.SetValue(Grid.RowSpanProperty, 2);
            }
            catch
            {
                bool k = IsInternet();
                if (k == true)
                {
                }
                else
                {
                    NotificacaoNet();
                }
            }
        }