private static void LoadHelper(SkinLibrary newLibrary) { if (newLibrary != globalSkinLibrary) { SkinLibrary oldLibrary = globalSkinLibrary; globalSkinLibrary = newLibrary; OnSkinChanged(); } }
internal static SkinLibrary Load(Stream stream) { CheckSchemaVersion(stream); using (XmlReader reader = XmlReader.Create(stream)) { XmlSerializer serializer = new XmlSerializer(typeof(SkinLibrary)); SkinLibrary library = (SkinLibrary)serializer.Deserialize(reader); return(library); } }
public static FormSkin AddNewSkin() { FormSkin skin = new FormSkin(true); if (globalSkinLibrary == null) { globalSkinLibrary = new SkinLibrary(); } List <string> styleNames = new List <string>(SkinManager.GetSkinNames()); skin.Name = "FormSkin"; for (int i = 1; styleNames.Contains(skin.Name); i++) { skin.Name = String.Format("FormStyle{0}", i); } globalSkinLibrary.Skins.Add(skin); OnSkinChanged(); return(skin); }
public static void Update(string fileName) { string tempFile = ""; try { // update version tempFile = SkinLibrary.Update(fileName); // backup current version File.Replace(tempFile, fileName, Path.ChangeExtension(fileName, ".bak")); } finally { // remove the temp file if (File.Exists(tempFile)) { File.Delete(tempFile); } } // load the current version Load(fileName); }
public static void Load(Stream stream) { SkinLibrary newLibrary = SkinLibrary.Load(stream); LoadHelper(newLibrary); }