コード例 #1
0
 private void SetMaxWidth()
 {
     if (CharacterNameCollection.Count > 0)
     {
         string longestString = CharacterNameCollection.OrderByDescending(s => s.Length).First();
         MaxWidth = MeasureStringSize.GetMaxStringWidth(longestString);
     }
 }
コード例 #2
0
 private void LoadCharacterNameList()
 {
     CharacterNameCollection.Clear();
     try
     {
         using (var context = new DatabaseContext())
         {
             var nonSpoiledCharacters = context.VnCharacterVns
                                        .Where(x => x.SpoilerLevel <= Globals.MaxSpoiler && x.VnId == Globals.VnId)
                                        .Select(x => x.CharacterId).ToArray();
             foreach (EF.Entity.VnCharacter.VnCharacter character in context.VnCharacter.Where(x => nonSpoiledCharacters.Contains(x.CharacterId)))
             {
                 _characterNameCollection.Add(character.Name);
             }
         }
     }
     catch (Exception ex)
     {
         Globals.Logger.Error(ex);
         throw;
     }
     SetMaxWidth();
 }