public static FontServiceReference.FavoriteFont ConvertTo(this FavoriteFont favoriteFont) { FontServiceReference.FavoriteFont fontServiceReference = new FontServiceReference.FavoriteFont(); fontServiceReference.Comment = favoriteFont.Comment; fontServiceReference.IsFavorite = favoriteFont.IsFavorite; fontServiceReference.FontName = favoriteFont.FontName; return(fontServiceReference); }
public void OverwriteFontData(List <FavoriteFont> overwriteFontData) { fonts.InitializeFonts(); foreach (FavoriteFont favoriteFont in overwriteFontData) { FavoriteFont fontToOverwrite = fonts.FavoriteFontList.FirstOrDefault(x => x.FontName == favoriteFont.FontName); fontToOverwrite.Comment = favoriteFont.Comment; fontToOverwrite.IsFavorite = favoriteFont.IsFavorite; } Fonts.FilterFonts(); }
public static FavoriteFont ConvertBack(this FontServiceReference.FavoriteFont favoriteFont) { FavoriteFont fontServiceReference = new FavoriteFont(); fontServiceReference.Comment = favoriteFont.Comment; fontServiceReference.IsFavorite = favoriteFont.IsFavorite; fontServiceReference.FontName = favoriteFont.FontName; fontServiceReference.FontInfo = Fonts.SystemFontFamilies.FirstOrDefault(x => x.Source == fontServiceReference.FontName); return(fontServiceReference); }
public void LoadSerializedFonts(string filePath) { string json = File.ReadAllText(filePath); List <FavoriteFont> deserializedFonts = JsonConvert.DeserializeObject <List <FavoriteFont> >(json); InitializeFonts(); foreach (FavoriteFont fontInformation in deserializedFonts) { FavoriteFont fontToUpdate = FavoriteFontList.First(x => x.FontName == fontInformation.FontName); fontToUpdate.Comment = fontInformation.Comment; fontToUpdate.IsFavorite = fontInformation.IsFavorite; } FilterFonts(); }