#56 Add Font setting

This commit is contained in:
qianlifeng
2014-03-19 22:17:01 +08:00
parent f4e74065ec
commit 4e537ac4d8
6 changed files with 178 additions and 11 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Newtonsoft.Json;
@@ -45,6 +46,7 @@ namespace Wox.Infrastructure
try
{
storage = JsonConvert.DeserializeObject<CommonStorage>(json);
ValidateConfigs();
}
catch (Exception)
{
@@ -57,6 +59,28 @@ namespace Wox.Infrastructure
}
}
private static void ValidateConfigs()
{
try
{
new FontFamily(storage.UserSetting.QueryBoxFont);
}
catch (Exception e)
{
storage.UserSetting.QueryBoxFont = FontFamily.GenericSansSerif.Name;
}
try
{
new FontFamily(storage.UserSetting.ResultItemFont);
}
catch (Exception)
{
storage.UserSetting.ResultItemFont = FontFamily.GenericSansSerif.Name;
}
}
private static void LoadDefaultUserSetting()
{
//default setting