Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.A))
     {
         new Thread(() =>
         {
             reddit = new Reddit(AuthHandler.AccessToken);
             Debug.Log("Authenticated");
         }).Start();
     }
     if (Input.GetKeyDown(KeyCode.S))
     {
         postLoader.reddit = reddit;
         postLoader.Start();
     }
     if (Input.GetKeyDown(KeyCode.D))
     {
     }
     if (postLoader != null)
     {
         if (postLoader.Update())
         {
             // Alternative to the OnFinished callback
             testStrings = postLoader.postTitles;
             displayPosts(testStrings);
             postLoader = null;
         }
     }
 }
Ejemplo n.º 2
0
        protected override void Seed(DataContext context)
        {
            // application values
            var applicationValues = new ApplicationValueLoader().LoadApplicationValues();

            applicationValues.ForEach(s => context.ApplicationValues.Add(s));
            context.SaveChanges();

            // users
            var users = new UserLoader().LoadUsers();

            users.ForEach(s => context.Users.Add(s));
            context.SaveChanges();

            // captions
            var captions = new CaptionLoader().LoadCaptions();

            captions.ForEach(s => context.Captions.Add(s));
            context.SaveChanges();

            // posts
            var posts = new PostLoader().LoadPosts();

            // assign captions to each post
            foreach (var post in posts)
            {
                var postCaptions = context.Captions.Take(new Random().Next(0, 10)).ToList();
                post.Captions = postCaptions;
            }
            posts.ForEach(s => context.Posts.Add(s));
            context.SaveChanges();
        }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     postLoader     = new PostLoader();
     displayedPosts = new ListingObject[15];
 }