PageRenderTime 50ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/cpwp7/Services/DesignMovieService.cs

https://github.com/blackjid/CouchPotatoWp7
C# | 77 lines | 60 code | 11 blank | 6 comment | 2 complexity | 87fe3b80e286a93ea9a1b90146e4db27 MD5 | raw file
  1. using System;
  2. using cpwp7.Model;
  3. using cpwp7.Utilities;
  4. using System.Collections.Generic;
  5. namespace cpwp7.Services
  6. {
  7. public class DesignMovieDataService : IMovieService
  8. {
  9. // To store the Couch Api to be used in the Design Data Service
  10. private CouchApi couch;
  11. public void GetMovies(Action<IList<Movie>, Exception> callback)
  12. {
  13. // Use this to create design time data
  14. var result = new List<Movie>();
  15. // Create 15 new movies
  16. for (var index = 0; index < 15; index++)
  17. {
  18. var movie = new Movie
  19. {
  20. Name = ("Name" + index).ToUpper(),
  21. Plot = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting",
  22. Art = "http://nas.blackjid.info:5050/7c9fad341b764a5f8c4781c76f3cbc24/file.cache/0e805a1c080eee97ae227f73cd5b02fc.jpg",
  23. Year = 2011,
  24. ImdbRating = 7.5,
  25. ImdbRatingCount = 0,
  26. RottenRating = 86,
  27. RottenRatingCount = 0,
  28. Backdrop = couch.FileCache("/root/.couchpotato/cache/e6317f1d41614f9c9567c3a5a01ce45d.jpg")
  29. };
  30. result.Add(movie);
  31. }
  32. callback(result, null);
  33. }
  34. public void GetWanted(Action<IList<Movie>, Exception> callback)
  35. {
  36. // Use this to create design time data
  37. var result = new List<Movie>();
  38. // Create 15 new movies
  39. for (var index = 0; index < 15; index++)
  40. {
  41. var movie = new Movie
  42. {
  43. Name = ("Name Wanted " + index).ToUpper(),
  44. Plot = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting",
  45. Art = "http://nas.blackjid.info:5050/7c9fad341b764a5f8c4781c76f3cbc24/file.cache/0e805a1c080eee97ae227f73cd5b02fc.jpg",
  46. Year = 2011,
  47. ImdbRating = 7.5,
  48. ImdbRatingCount = 0,
  49. RottenRating = 86,
  50. RottenRatingCount = 0,
  51. Backdrop = couch.FileCache("/root/.couchpotato/cache/e6317f1d41614f9c9567c3a5a01ce45d.jpg")
  52. };
  53. result.Add(movie);
  54. }
  55. callback(result, null);
  56. }
  57. public DesignMovieDataService()
  58. {
  59. // Initialize the CouchPotat API
  60. couch = new CouchApi();
  61. couch.ApiKey = "7c9fad341b764a5f8c4781c76f3cbc24";
  62. couch.Host = "nas.blackjid.info";
  63. couch.Port = "5050";
  64. }
  65. }
  66. }