Exemplo n.º 1
0
 private static void LoadHelper(SkinLibrary newLibrary)
 {
     if (newLibrary != globalSkinLibrary)
     {
         SkinLibrary oldLibrary = globalSkinLibrary;
         globalSkinLibrary = newLibrary;
         OnSkinChanged();
     }
 }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        public static void Load(Stream stream)
        {
            SkinLibrary newLibrary = SkinLibrary.Load(stream);

            LoadHelper(newLibrary);
        }