From dcb7c04de1ac07f7004af7d5af8450308ba2e29d Mon Sep 17 00:00:00 2001 From: MichaelTheShifter Date: Sat, 23 Jul 2016 15:25:46 -0400 Subject: Fix panel buttons --- .../WindowsFormsApplication1/SkinEngine/skins.cs | 44 ++++++++++++++-------- 1 file changed, 28 insertions(+), 16 deletions(-) (limited to 'source/WindowsFormsApplication1/SkinEngine') diff --git a/source/WindowsFormsApplication1/SkinEngine/skins.cs b/source/WindowsFormsApplication1/SkinEngine/skins.cs index d18770d..b9688ba 100644 --- a/source/WindowsFormsApplication1/SkinEngine/skins.cs +++ b/source/WindowsFormsApplication1/SkinEngine/skins.cs @@ -574,33 +574,45 @@ namespace Skinning /// public static void loadskin() { - if (Directory.Exists(Paths.LoadedSkin)) + try { - string rawData = File.ReadAllText(Paths.LoadedSkin + "data.json"); - loadedSkin = JsonConvert.DeserializeObject(rawData); - if (File.Exists(Paths.LoadedSkin + "panels.json")) + if (Directory.Exists(Paths.LoadedSkin)) { - try - { - string panels = File.ReadAllText(Paths.LoadedSkin + "panels.json"); - loadedSkin.DesktopPanels = JsonConvert.DeserializeObject>(panels); - Application.LoadSkin(loadedSkin); //Send the skin to ShiftUI so buttons and stuff get rendered with custom colors. - LoadPanels(); - } - catch + string rawData = File.ReadAllText(Paths.LoadedSkin + "data.json"); + loadedSkin = JsonConvert.DeserializeObject(rawData); + if (File.Exists(Paths.LoadedSkin + "panels.json")) { + try + { + string panels = File.ReadAllText(Paths.LoadedSkin + "panels.json"); + loadedSkin.DesktopPanels = JsonConvert.DeserializeObject>(panels); + Application.LoadSkin(loadedSkin); //Send the skin to ShiftUI so buttons and stuff get rendered with custom colors. + LoadPanels(); + } + catch + { + } } - } - loadimages(); - LoadEmbeddedNamePack(); + loadimages(); + LoadEmbeddedNamePack(); + } + else + { + loadedSkin = new Skin(); + Application.LoadSkin(loadedSkin); + loadedskin_images = new Images(); + saveskin(); + } } - else + catch { loadedSkin = new Skin(); + Application.LoadSkin(loadedSkin); loadedskin_images = new Images(); saveskin(); + } } -- cgit v1.2.3