public async override Task InitializeStore() { if (initialized) { return; } initialized = true; var categories = (await _categoryStore.GetItemsAsync()).ToArray(); var speakers = (await _speakerStore.GetItemsAsync().ConfigureAwait(false)).ToArray(); workshops = new List <Workshop>(); int speaker = 0; int speakerCount = 0; int room = 0; int category = 0; var day = new DateTime(2016, 4, 27, 13, 0, 0, DateTimeKind.Utc); int dayCount = 0; for (int i = 0; i < titles.Length; i++) { var workshopSpeakers = new List <Speaker>(); speakerCount++; for (int j = 0; j < speakerCount; j++) { workshopSpeakers.Add(speakers[speaker]); speaker++; if (speaker >= speakers.Length) { speaker = 0; } } if (i == 1) { workshopSpeakers.Add(workshops[0].Speakers.ElementAt(0)); } var cat = categories[category]; category++; if (category >= categories.Length) { category = 0; } var ro = rooms[room]; room++; if (room >= rooms.Length) { room = 0; } workshops.Add(new Workshop { Id = i.ToString(), Abstract = "This is an abstract that is going to tell us all about how awsome this workshop is and that you should go over there right now and get ready for awesome!.", MainCategory = cat, Room = ro, Speakers = workshopSpeakers, Title = titles[i], ShortTitle = titlesShort[i] }); workshops[i].IsFavorite = await _favoriteStore.IsFavoriteWorkshop(workshops[i].Id); workshops[i].FeedbackLeft = await _feedbackStore.LeftFeedback(workshops[i]); SetStartEnd(workshops[i], day); if (i == titles.Length / 2) { dayCount = 0; day = new DateTime(2016, 4, 28, 13, 0, 0, DateTimeKind.Utc); } else { dayCount++; if (dayCount == 2) { day = day.AddHours(1); dayCount = 0; } } if (speakerCount > 2) { speakerCount = 0; } } workshops.Add(new Workshop { Id = workshops.Count.ToString(), Abstract = "Coming soon", MainCategory = categories[0], Room = rooms[0], //Speakers = new List<Speaker>{ speakers[0] }, Title = "Something awesome!", ShortTitle = "Awesome", }); workshops[workshops.Count - 1].IsFavorite = await _favoriteStore.IsFavoriteWorkshop(workshops[workshops.Count - 1].Id); workshops[workshops.Count - 1].FeedbackLeft = await _feedbackStore.LeftFeedback(workshops[workshops.Count - 1]); workshops[workshops.Count - 1].StartTime = null; workshops[workshops.Count - 1].EndTime = null; }
public async override Task InitializeStore() { if (initialized) { return; } initialized = true; var categories = (await categoryStore.GetItemsAsync()).ToArray(); await speakerStore.InitializeStore(); var speakers = (await speakerStore.GetItemsAsync().ConfigureAwait(false)).ToArray(); sessions = new List <Session>(); int speaker = 0; int speakerCount = 0; int room = 0; int category = 0; var day = new DateTime(2016, 4, 27, 13, 0, 0, DateTimeKind.Utc); int dayCount = 0; for (int i = 0; i < titles.Length; i++) { var sessionSpeakers = new List <Speaker>(); speakerCount++; for (int j = 0; j < speakerCount; j++) { sessionSpeakers.Add(speakers[speaker]); speaker++; if (speaker >= speakers.Length) { speaker = 0; } } if (i == 1) { sessionSpeakers.Add(sessions[0].Speakers.ElementAt(0)); } var cat = categories[category]; category++; if (category >= categories.Length) { category = 0; } var ro = rooms[room]; room++; if (room >= rooms.Length) { room = 0; } sessions.Add(new Session { Id = i.ToString(), Abstract = "This is an abstract that is going to tell us all about how awsome this session is and that you should go over there right now and get ready for awesome!.", MainCategory = cat, Room = ro, Speakers = sessionSpeakers, Title = titles[i], ShortTitle = titlesShort[i], RemoteId = i.ToString() }); sessions[i].IsFavorite = await favoriteStore.IsFavorite(sessions[i].Id); sessions[i].FeedbackLeft = await feedbackStore.LeftFeedback(sessions[i]); SetStartEnd(sessions[i], day); if (i == titles.Length / 2) { dayCount = 0; day = new DateTime(2016, 4, 28, 13, 0, 0, DateTimeKind.Utc); } else { dayCount++; if (dayCount == 2) { day = day.AddHours(1); dayCount = 0; } } if (speakerCount > 2) { speakerCount = 0; } } sessions.Add(new Session { Id = sessions.Count.ToString(), Abstract = "Coming soon", MainCategory = categories[0], Room = rooms[0], //Speakers = new List<Speaker>{ speakers[0] }, Title = "http://rdgw.kaizen.massopencloud.org/swift/v1/Harry/pics/16602385_1413398652043672_4820266781039836011_o.jpg", ShortTitle = "Awesome", }); sessions[sessions.Count - 1].IsFavorite = await favoriteStore.IsFavorite(sessions[sessions.Count - 1].Id); sessions[sessions.Count - 1].FeedbackLeft = await feedbackStore.LeftFeedback(sessions[sessions.Count - 1]); sessions[sessions.Count - 1].StartTime = null; sessions[sessions.Count - 1].EndTime = null; }