public static void LoadConfiguration(List <string> configuration = null) { if (configuration == null) { return; } foreach (string change in configuration) { string[] changeLine = change.Split(new char[] { '=' }, 2, StringSplitOptions.RemoveEmptyEntries).Select(str => str.Trim()).ToArray(); if (changeLine.Length < 2) { continue; } string changeKey = changeLine[0]; string changeSetting = changeLine[1]; bool selected = Regex.Replace(@"\s+", "", changeSetting.Split('=')[1]).Contains("True"); if (selected == true) { selectedChange = changeKey; activeChange = changes.Where(x => x.TitleIdent.Equals(changeKey)).First(); } } }
private void Refresh(object s, RoutedEventArgs e, TreeView view) { String activeChange = AIVChange.activeChange == null ? String.Empty : AIVChange.activeChange.TitleIdent; foreach (AIVChange change in AIVChange.changes) { if (!change.isInternal) { Localization.Remove(change.TitleIdent + "_descr"); } view.Items.Remove(change.UIElement); } AIVChange.Refresh(); foreach (AIVChange change in AIVChange.changes) { change.InitUI(); change.IsChecked = false; view.Items.Add(change.UIElement); } if (AIVChange.changes.Select(x => x.TitleIdent).Contains(activeChange)) { foreach (AIVChange change in AIVChange.changes) { if (change.TitleIdent == activeChange) { change.IsChecked = true; } } } }
protected override void TitleBox_Unchecked(object sender, RoutedEventArgs e) { base.TitleBox_Unchecked(sender, e); if (activeChange == this) { activeChange = null; selectedChange = String.Empty; } }
protected override void TitleBox_Checked(object sender, RoutedEventArgs e) { base.TitleBox_Checked(sender, e); if (activeChange != null) { activeChange.IsChecked = false; } activeChange = this; selectedChange = this.TitleIdent; }
public override void InitUI() { string descr = GetLocalizedDescription(this.TitleIdent); descr = descr == String.Empty ? this.TitleIdent.Substring(4) : descr; Localization.Add(this.TitleIdent + "_descr", descr); base.InitUI(); this.titleBox.Background = new SolidColorBrush(Colors.White); if (!this.resFolder.StartsWith("UCP.AIV")) { ((TextBlock)this.titleBox.Content).Text = this.TitleIdent.Substring(4); } this.IsChecked = selectedChange.Equals(this.TitleIdent); this.titleBox.IsChecked = selectedChange.Equals(this.TitleIdent); if (this.IsChecked) { activeChange = this; } }
public static void Refresh() { changes.Clear(); changes.Add(AIVChange.CreateDefault("Tatha")); changes.Add(AIVChange.CreateDefault("EvreyFixed", true)); changes.Add(AIVChange.CreateDefault("EvreyImproved")); changes.Add(AIVChange.CreateDefault("EvreyHistory")); changes.Add(AIVChange.CreateDefault("PitchWells")); changes.Add(AIVChange.CreateDefault("PitchSiege")); if (Directory.Exists(Path.Combine(Environment.CurrentDirectory, "resources", "aiv"))) { foreach (string aivDir in Directory.EnumerateDirectories(Path.Combine(Environment.CurrentDirectory, "resources", "aiv"), "*", SearchOption.TopDirectoryOnly)) { changes.Add(CreateExternal(Path.GetFileName(aivDir.TrimEnd(Path.DirectorySeparatorChar)))); } } Version.RemoveChanges(ChangeType.AIV); Version.Changes.AddRange(changes); }