Try it for background.

This commit is contained in:
Florian Küpper committed 2014-08-26 09:29:39 +02:00
1 parent 6b958527ce
commit 4bbb0bfb14
2 files changed
+27 -7

No files matched your search

+17 -5
View File
@@ -18,6 +18,7 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Xml; using System.Xml;
using System.Xml.Serialization;
using System.Diagnostics; using System.Diagnostics;
using System.Collections.Generic; using System.Collections.Generic;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
@@ -33,18 +34,22 @@ namespace VocaluxeLib.Menu
Video Video
} }
struct SThemeBackground [XmlType("Background")]
public struct SThemeBackground
{ {
[XmlAttributeAttribute(AttributeName = "Name")]
public string Name; public string Name;
[XmlElement("Type")]
public EBackgroundTypes Type; public EBackgroundTypes Type;
[XmlArray]
public List<string> SlideShowTextures; public List<string> SlideShowTextures;
[XmlElement("Video")]
public string VideoName; public string VideoName;
[XmlElement("Skin")]
public string TextureName; public string TextureName;
[XmlElement("ColorName")]
public string ColorName; public string ColorName;
public SColorF Color;
} }
public class CBackground : IMenuElement public class CBackground : IMenuElement
@@ -101,6 +106,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= success; _ThemeLoaded &= success;
} }
_Theme.Color = new SColorF(Color);
int i = 1; int i = 1;
while (xmlReader.ItemExists(item + "/SlideShow" + i)) while (xmlReader.ItemExists(item + "/SlideShow" + i))
@@ -244,6 +251,11 @@ namespace VocaluxeLib.Menu
UnloadTextures(); UnloadTextures();
LoadTextures(); LoadTextures();
} }
public SThemeBackground GetTheme()
{
return _Theme;
}
#endregion public #endregion public
#region internal #region internal
+10 -2
View File
@@ -270,14 +270,22 @@ namespace VocaluxeLib.Menu
} }
//This is only test-stuff and will be removed later //This is only test-stuff and will be removed later
XmlSerializer serializer = new XmlSerializer(typeof(List<SThemeStatic>));
TextWriter textWriter = new StreamWriter(@Path.Combine(_ThemePath, ThemeName + "_test.xml")); TextWriter textWriter = new StreamWriter(@Path.Combine(_ThemePath, ThemeName + "_test.xml"));
//Backgrounds
XmlSerializer serializer = new XmlSerializer(typeof(List<SThemeBackground>));
List<SThemeBackground> backgroundThemes = new List<SThemeBackground>();
foreach (CBackground bg in _Backgrounds)
backgroundThemes.Add(bg.GetTheme());
serializer.Serialize(textWriter, backgroundThemes);
//Statics
serializer = new XmlSerializer(typeof(List<SThemeStatic>));
List<SThemeStatic> staticsThemes = new List<SThemeStatic>(); List<SThemeStatic> staticsThemes = new List<SThemeStatic>();
foreach (CStatic st in _Statics) foreach (CStatic st in _Statics)
staticsThemes.Add(st.GetTheme()); staticsThemes.Add(st.GetTheme());
serializer.Serialize(textWriter, staticsThemes); serializer.Serialize(textWriter, staticsThemes);
textWriter.Close(); textWriter.Close();
} }