mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
#56 Add Font setting
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user