Exemplo n.º 1
0
        public void GetShows(Action<IList<Show>, Exception> callback)
        {
            GlobalLoading.Instance.IsLoading = true;

            // Create the client
            WebClient client = new WebClient();

            // Process the response from the server
            client.DownloadStringCompleted += (sender, e) =>
            {
                if (e.Error != null)
                {
                    callback(null, e.Error);
                    return;
                }

                // A list to store the movies
                var result = new List<Show>();

                // Parse the json response
                JObject o = JObject.Parse(e.Result);
                foreach (JToken jtShow in o["data"])
                {
                    var id = ((JProperty)jtShow).Name.ToString();

                    // Create the movies
                    var show = new Show();
                    show.Id = id;
                    show.Name = ((string)jtShow.First["show_name"]).ToUpper();
                    //tvshow.Plot = (string)jtShow["library"]["plot"];
                    show.NextAir = ((string)jtShow.First["next_ep_airdate"]);
                    show.Art = App.Current.Sick.GetPoster(id);

                        //movie.Backdrop = App.Current.Couch.FileCache((string)jtMovie["library"]["files"][2]["path"]);

                    result.Add(show);
                }

                GlobalLoading.Instance.IsLoading = false;

                callback(result, null);
            };

            // Make the call to the server
            client.DownloadStringAsync(App.Current.Sick.ShowList());
        }
Exemplo n.º 2
0
        public void GetShows(Action<IList<Show>, Exception> callback)
        {
            // Use this to create design time data
            var result = new List<Show>();

            // Create 15 new movies
            for (var index = 0; index < 15; index++)
            {
                var show = new Show
                {
                    Name = ("Name" + index).ToUpper(),
                    //Plot = "Plot" + index,
                    NextAir = "2012-02-13",
                    Art = "http://nas.blackjid.info:8081/api/f5d6701f555447546b6030432d15e229/show.getposter/75760"
                    //Backdrop = couch.FileCache("/volume1/downloads/dev/CouchPotatoServer/_data/cache/761d3c67b737bba21fae2acc6040bde5.jpg")
                };

                result.Add(show);
            }

            callback(result, null);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the ShowViewModel class.
 /// </summary>
 public ShowViewModel(Show model)
 {
     Model = model;
 }