void LoadSkin() { if (ConfigHelper.Main.Values.Debug.UseInternalSkin) { return; } var skinFileName = ConfigHelper.Main.Values.SkinFileName; if (!File.Exists(FileContainer.GetFullPathFileName(skinFileName))) { Log.WriteLine($"Failed to load skin file '{skinFileName}'"); return; } m_SkinFile.TryChangeFileName(skinFileName); try { ResourceDictionary resourceDictionary = null; using (var streamReader = new StreamReader(m_SkinFile.FullPathFileName, Encoding.UTF8)) { LoadExternalAssemblies(); var xmlReaderSettings = new XamlXmlReaderSettings { LocalAssembly = Assembly.GetExecutingAssembly() }; using (var xamlReader = new XamlXmlReader(streamReader.BaseStream, XamlReader.GetWpfSchemaContext(), xmlReaderSettings)) { resourceDictionary = XamlReader.Load(xamlReader) as ResourceDictionary; } } if (resourceDictionary != null) { Resources.MergedDictionaries.Clear(); Resources.MergedDictionaries.Add(resourceDictionary); if (m_Overlay != null) { m_Overlay.RefreshWidgetsLayout(); } Log.WriteLine($"{m_SkinFile.FileName} loaded"); } } catch (Exception ex) { Log.WriteException(ex); } m_LastSkinFileName = skinFileName; }