Esempio n. 1
0
        private void LoadCategories()
        {
            TreeVnCategories.Clear();

            try
            {
                using (var context = new DatabaseContext())
                {
                    if (context.VnInfo != null)
                    {
                        VnNameCollection.InsertRange(context.VnInfo.Select(x => x.Title).ToList());
                        return;
                    }
                }


                //using (var context = new DatabaseContext())
                //{
                //    MenuItem root = new MenuItem(){Header = "Visual Novels"};
                //    MenuItem all= new MenuItem(){Header = "All", IsSubmenuOpen = true};
                //    foreach (var item in context.VnInfo.Select(x => x.Title))
                //    {
                //        all.Items.Add(new MenuItem(){Header = item});
                //    }
                //    root.Items.Add(all);

                //    foreach (var category in context.Categories.Where(x => x.CategoryName != "All").Select(x => x.CategoryName))
                //    {
                //        var menuItem = new MenuItem(){Header = category};

                //        string[] names = context.VnInfo.Where(v => context.VnUserCategoryTitles.Where(c => c.Title == category).Select(x => x.VnId)
                //                .Contains(v.VnId)).Select(t => t.Title).ToArray();

                //        foreach (var vn in names)
                //        {
                //            menuItem.Items.Add(new MenuItem() {Header = vn});
                //        }
                //        root.Items.Add(menuItem);
                //    }
                //    TreeVnCategories.Add(root);

                //}
            }
            catch (Exception ex)
            {
                Globals.Logger.Error(ex);
                throw;
            }
            finally
            {
                SetMaxWidth();
            }
        }
Esempio n. 2
0
 private void ClearVnData()
 {
     TreeVnCategories.Clear();
     LanguageCollection.Clear();
     OriginalLanguagesCollection.Clear();
     VnInfoRelation.Clear();
     VnInfoTagCollection.Clear();
     VnInfoAnimeCollection.Clear();
     PlatformCollection.Clear();
     VnMainModel.Name        = String.Empty;
     VnMainModel.Original    = String.Empty;
     VnMainModel.PlayTime    = String.Empty;
     VnMainModel.LastPlayed  = String.Empty;
     VnMainModel.Image       = null;
     VnMainModel.Aliases     = String.Empty;
     VnMainModel.Description = String.Empty;
     VnMainModel.Released    = String.Empty;
     VnMainModel.Length      = String.Empty;
     VnMainModel.VnIcon      = null;
     VnMainModel.Popularity  = 0;
     VnMainModel.Rating      = 0;
     VnMainModel.Links       = string.Empty;
 }