public MyRedditClientDbContext() : base() { Database.EnsureCreated(); var task = SubReddits.CountAsync(); if (task.Result <= 0) { SubReddits.Add(new SubReddit { Name = "science" }); SaveChanges(); } }
public MainVM() { var subList = JsonConvert.DeserializeObject <List <string> >(AppPCL.SettingVM.SubList); foreach (var sub in subList) { SubReddits.Add(sub); } SubReddits.CollectionChanged += (s, arg) => { AppPCL.SettingVM.SubList = JsonConvert.SerializeObject(SubReddits.ToList()); }; if (SubReddits.Count > 0) { SubReddit = SubReddits[0]; } }