Ejemplo n.º 1
0
        private void GetVnData()
        {
            try
            {
                Globals.StatusBar.ProgressText = "Processing";
                LanguageCollection.Clear();
                PlatformCollection.Clear();
                OriginalLanguagesCollection.Clear();
                VnInfoRelation.Clear();
                VnInfoTagCollection.Clear();
                VnInfoAnimeCollection.Clear();
                TagDescription = String.Empty;

                using (var context = new DatabaseContext())
                {
                    Globals.VnId = context.VnInfo.Where(t => t.Title == (_selectedVn)).Select(v => v.VnId).FirstOrDefault();
                }

                if (Globals.VnId > 0)
                {
                    UpdateViews();
                }
            }
            catch (Exception ex)
            {
                Globals.Logger.Error(ex);
                Globals.StatusBar.ProgressText = String.Empty;
                throw;
            }
        }
Ejemplo n.º 2
0
        private void SetMaxWidth()
        {
            if (VnNameCollection.Count > 0)
            {
                string longestString = VnNameCollection.OrderByDescending(s => s.Length).First();
                MaxListWidth = MeasureStringSize.GetMaxStringWidth(longestString);
            }

            if (VnInfoTagCollection.Count > 0)
            {
                string longestString = VnInfoTagCollection.OrderByDescending(s => s.Length).First();
                MinWidthTags = MeasureStringSize.GetMaxStringWidth(longestString);
            }
        }
Ejemplo n.º 3
0
        private void SetTags()
        {
            using (var context = new DatabaseContext())
            {
                VnInfoTagCollection.Clear();
                TagDescription = String.Empty;
                if (IsAllTagsEnabled)
                {
                    string[] tagNames = (from info in context.VnInfoTags
                                         where info.VnId.Equals(Globals.VnId)
                                         where info.Spoiler <= Globals.MaxSpoiler
                                         join tag in context.VnTagData on info.TagId equals tag.TagId
                                         select tag.Name).Distinct().ToArray();
                    VnInfoTagCollection.InsertRange(tagNames);
                }
                else
                {
                    List <string> tagCategories = new List <string>();
                    if (IsContentTagsEnabled)
                    {
                        tagCategories.Add("Content");
                    }
                    if (IsSexualTagsEnabled)
                    {
                        tagCategories.Add("Sexual");
                    }
                    if (IsTechnicalTagsEnabled)
                    {
                        tagCategories.Add("Technical");
                    }

                    string[] tagNames = (from info in context.VnInfoTags
                                         where info.VnId.Equals(Globals.VnId)
                                         where info.Spoiler <= Globals.MaxSpoiler
                                         join tag in context.VnTagData on info.TagId equals tag.TagId
                                         where tagCategories.Any(tc => tc.Contains(tag.Cat))
                                         select tag.Name).Distinct().ToArray();
                    VnInfoTagCollection.InsertRange(tagNames);
                }
            }
        }
Ejemplo n.º 4
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;
 }