diff --git a/PlanningCenter to OPS/Actions/ToXml.cs b/PlanningCenter to OPS/Actions/ToXml.cs index 54b7508..e7c2352 100644 --- a/PlanningCenter to OPS/Actions/ToXml.cs +++ b/PlanningCenter to OPS/Actions/ToXml.cs @@ -20,7 +20,7 @@ internal static XElement SongNode(Config config, string song_name, string song_t new XElement("Number", song_number), new XElement("SongBookName", book.SongBookName), new XElement("Keys"), - new XElement("StyleName", book.StyleName), + new XElement("StyleName", config.last_used_ops_theme), new XElement("Title", song_name), new XElement("SelectedVersion", book.SelectedVersion), new XElement("Language", "All"), @@ -33,13 +33,13 @@ internal static XElement SongNode(Config config, string song_name, string song_t } - internal static XElement SongFileNode(string song_name, string save_location) + internal static XElement SongFileNode(Config config, string song_name) { XElement doc = new XElement("SongFromFile", new XElement("Comment"), new XElement("DisplayTitle", song_name), - new XElement("FileName", String.Format("{0}\\{1}.txt", save_location, song_name)), - new XElement("StyleName", "OPS") + new XElement("FileName", String.Format("{0}\\{1}.txt", config.song_folder, song_name)), + new XElement("StyleName", config.last_used_ops_theme) ); doc.SetAttributeValue("ID", Guid.NewGuid().ToString()); doc.SetAttributeValue("Type", "Song"); @@ -72,7 +72,7 @@ internal static XElement GetSongs(Config config, List song_list) } else if (current.Type == "file") { LyricsToFile.ToFile(config, current.Detailed); - xml_list.Add(SongFileNode(title, config.song_folder)); + xml_list.Add(SongFileNode(config, title)); } else { xml_list.Add(SongNode(config, title, config.et_abbreviation, current.Id.ToString())); diff --git a/PlanningCenter to OPS/BookTypes/EigenTeksten.cs b/PlanningCenter to OPS/BookTypes/EigenTeksten.cs index 3d1d772..23d7880 100644 --- a/PlanningCenter to OPS/BookTypes/EigenTeksten.cs +++ b/PlanningCenter to OPS/BookTypes/EigenTeksten.cs @@ -10,8 +10,6 @@ public EigenTeksten(Config config) } public override string SongBookName => this.override_name; - public override string StyleName => "OPS"; - public override string SelectedVersion => "MyVersion"; } } diff --git a/PlanningCenter to OPS/BookTypes/Init.cs b/PlanningCenter to OPS/BookTypes/Init.cs index d1092de..d65aa82 100644 --- a/PlanningCenter to OPS/BookTypes/Init.cs +++ b/PlanningCenter to OPS/BookTypes/Init.cs @@ -3,7 +3,6 @@ internal abstract class BookType { public abstract string SongBookName { get; } - public abstract string StyleName { get; } public abstract string SelectedVersion { get; } } diff --git a/PlanningCenter to OPS/BookTypes/KinderOpwekking.cs b/PlanningCenter to OPS/BookTypes/KinderOpwekking.cs index 9e3d5ea..8c5c507 100644 --- a/PlanningCenter to OPS/BookTypes/KinderOpwekking.cs +++ b/PlanningCenter to OPS/BookTypes/KinderOpwekking.cs @@ -7,8 +7,6 @@ internal class KinderOpwekking : BookType { public override string SongBookName => "Kinderen"; - public override string StyleName => "OPS"; - public override string SelectedVersion => "ProjectionVersion"; } } diff --git a/PlanningCenter to OPS/BookTypes/Opwekking.cs b/PlanningCenter to OPS/BookTypes/Opwekking.cs index d9ef813..1b33168 100644 --- a/PlanningCenter to OPS/BookTypes/Opwekking.cs +++ b/PlanningCenter to OPS/BookTypes/Opwekking.cs @@ -7,8 +7,6 @@ internal class Opwekking : BookType { public override string SongBookName => "Opwekking"; - public override string StyleName => "OPS"; - public override string SelectedVersion => "ProjectionVersion"; } } diff --git a/PlanningCenter to OPS/Config.cs b/PlanningCenter to OPS/Config.cs index 1872f3b..15f9b7b 100644 --- a/PlanningCenter to OPS/Config.cs +++ b/PlanningCenter to OPS/Config.cs @@ -14,6 +14,7 @@ internal class Config public string et_abbreviation; public string et_bundle_name; public bool et_enabled; + public string last_used_ops_theme; public Config() { @@ -29,6 +30,7 @@ public Config() et_abbreviation = Properties.Settings.Default.et_abbreviation; et_bundle_name = Properties.Settings.Default.et_bundle_name; et_enabled = Properties.Settings.Default.et_enabled; + last_used_ops_theme = Properties.Settings.Default.last_used_ops_theme; } public void Update() @@ -45,6 +47,7 @@ public void Update() Properties.Settings.Default.et_abbreviation = et_abbreviation; Properties.Settings.Default.et_bundle_name = et_bundle_name; Properties.Settings.Default.et_enabled = et_enabled; + Properties.Settings.Default.last_used_ops_theme = last_used_ops_theme; Properties.Settings.Default.Save(); } } diff --git a/PlanningCenter to OPS/MainForm.cs b/PlanningCenter to OPS/MainForm.cs index 4fe7361..0370bbe 100644 --- a/PlanningCenter to OPS/MainForm.cs +++ b/PlanningCenter to OPS/MainForm.cs @@ -50,6 +50,14 @@ public void RefreshItems() { OpsThemeSelector.Items.Add(node.InnerText); } + Debug.WriteLine(config.last_used_ops_theme); + if (config.last_used_ops_theme != "") + { + OpsThemeSelector.SelectedItem = config.last_used_ops_theme; + } else + { + OpsThemeSelector.SelectedIndex = 0; + } } private void CheckPlan() @@ -101,12 +109,13 @@ private void PlanSelector_SelectedIndexChanged(object sender, EventArgs e) private void SaveButton_Click(object sender, EventArgs e) { + config.Update(); if (current_plan != null) { try { Structs.SongList song_return = Api.GetSongList(config, PlansInfo[current_plan]); - using (SelectSongs select_songs = new SelectSongs(this.config, song_return)) + using (SelectSongs select_songs = new SelectSongs(config, song_return)) { DialogResult result = select_songs.ShowDialog(); } @@ -147,7 +156,10 @@ private void ReadSongs_Click(object sender, EventArgs e) private void OpsThemeSelector_SelectedIndexChanged(object sender, EventArgs e) { - + ComboBox cmb = (ComboBox)sender; + string current = (string)cmb.SelectedItem; + if (current == null) return; + config.last_used_ops_theme = current; } }