#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

View File

@@ -7,6 +7,8 @@ namespace Wox.Infrastructure.UserSettings
{
public string Hotkey { get; set; }
public string Theme { get; set; }
public string QueryBoxFont { get; set; }
public string ResultItemFont { get; set; }
public bool ReplaceWinR { get; set; }
public List<WebSearch> WebSearches { get; set; }
public List<ProgramSource> ProgramSources { get; set; }