public void LoadData() { if (_isConfigured) { return; } if (!File.Exists(_sourceFilePath)) { return; } var document = new XmlDocument(); document.Load(_sourceFilePath); var configNode = document.SelectSingleNode("//Settings"); if (configNode == null) { return; } foreach (var node in configNode.SelectNodes("./MediaPlan/Description/Item")?.OfType <XmlNode>().ToArray() ?? new XmlNode[] { }) { MemoPopup1Items.Add(ListDataItem.FromXml(node)); } foreach (var node in configNode.SelectNodes("./MediaPlan/SizeSpecs/Item")?.OfType <XmlNode>().ToArray() ?? new XmlNode[] { }) { Combo1Items.Add(ListDataItem.FromXml(node)); } foreach (var node in configNode.SelectNodes("./MediaPlan/Quantity/Item")?.OfType <XmlNode>().ToArray() ?? new XmlNode[] { }) { Combo2Items.Add(ListDataItem.FromXml(node)); } foreach (var node in configNode.SelectNodes("./MediaPlan/Investment/Item")?.OfType <XmlNode>().ToArray() ?? new XmlNode[] { }) { Combo3Items.Add(ListDataItem.FromXml(node)); } _isConfigured = true; }
public override void LoadData(XmlNode configNode, ResourceManager resourceManager) { base.LoadData(configNode, resourceManager); if (resourceManager.DataCBCPartAFile.ExistsLocal()) { var document = new XmlDocument(); document.Load(resourceManager.DataCBCPartAFile.LocalPath); var node = document.SelectSingleNode(@"/SHIFT08A"); if (node == null) { return; } foreach (XmlNode childNode in node.ChildNodes) { var item = ListDataItem.FromXml(childNode); switch (childNode.Name) { case "SHIFT08AHeader": if (!String.IsNullOrEmpty(item.Value)) { HeadersItems.Add(item); } break; case "SHIFT08AMULTIBOX1": if (!String.IsNullOrEmpty(item.Value)) { MemoPopup1Items.Add(item); } break; } } Clipart1Configuration = ClipartConfiguration.FromXml(node, "SHIFT08AClipart1"); Clipart2Configuration = ClipartConfiguration.FromXml(node, "SHIFT08AClipart2"); Clipart3Configuration = ClipartConfiguration.FromXml(node, "SHIFT08AClipart3"); CommonEditorConfiguration = TextEditorConfiguration.FromXml(node); HeadersEditorConfiguration = TextEditorConfiguration.FromXml(node, "SHIFT08AHeader"); MemoPopup1Configuration = TextEditorConfiguration.FromXml(node, "SHIFT08AMultibox1"); } }
public override void LoadData(XmlNode configNode, ResourceManager resourceManager) { base.LoadData(configNode, resourceManager); if (resourceManager.DataAgendaPartEFile.ExistsLocal()) { var document = new XmlDocument(); document.Load(resourceManager.DataAgendaPartEFile.LocalPath); var node = document.SelectSingleNode(@"/SHIFT03E"); if (node == null) { return; } Tab1Title = node.SelectSingleNode("./SHIFT03ETab1Name")?.Attributes ?.OfType <XmlAttribute>() .FirstOrDefault(a => String.Equals(a.Name, "Value", StringComparison.OrdinalIgnoreCase))?.Value ?? "Goals"; Tab2Title = node.SelectSingleNode("./SHIFT03ETab2Name")?.Attributes ?.OfType <XmlAttribute>() .FirstOrDefault(a => String.Equals(a.Name, "Value", StringComparison.OrdinalIgnoreCase))?.Value ?? "Strategy"; Tab3Title = node.SelectSingleNode("./SHIFT03ETab3Name")?.Attributes ?.OfType <XmlAttribute>() .FirstOrDefault(a => String.Equals(a.Name, "Value", StringComparison.OrdinalIgnoreCase))?.Value ?? "Tactics"; foreach (XmlNode childNode in node.ChildNodes) { var item = ListDataItem.FromXml(childNode); switch (childNode.Name) { case "SHIFT03EHeader": if (!String.IsNullOrEmpty(item.Value)) { HeadersItems.Add(item); } break; case "SHIFT03EMULTIBOX1": if (!String.IsNullOrEmpty(item.Value)) { MemoPopup1Items.Add(item); } break; case "SHIFT03EMULTIBOX2": if (!String.IsNullOrEmpty(item.Value)) { MemoPopup2Items.Add(item); } break; case "SHIFT03EMULTIBOX3": if (!String.IsNullOrEmpty(item.Value)) { MemoPopup3Items.Add(item); } break; case "SHIFT03EMULTIBOX4": if (!String.IsNullOrEmpty(item.Value)) { MemoPopup4Items.Add(item); } break; case "SHIFT03EMULTIBOX5": if (!String.IsNullOrEmpty(item.Value)) { MemoPopup5Items.Add(item); } break; case "SHIFT03EMULTIBOX6": if (!String.IsNullOrEmpty(item.Value)) { MemoPopup6Items.Add(item); } break; case "SHIFT03ECOMBO1": if (!String.IsNullOrEmpty(item.Value)) { Combo1Items.Add(item); } break; case "SHIFT03ECOMBO2": if (!String.IsNullOrEmpty(item.Value)) { Combo2Items.Add(item); } break; case "SHIFT03ECOMBO3": if (!String.IsNullOrEmpty(item.Value)) { Combo3Items.Add(item); } break; case "SHIFT03ECOMBO4": if (!String.IsNullOrEmpty(item.Value)) { Combo4Items.Add(item); } break; case "SHIFT03ECOMBO5": if (!String.IsNullOrEmpty(item.Value)) { Combo5Items.Add(item); } break; case "SHIFT03ECOMBO6": if (!String.IsNullOrEmpty(item.Value)) { Combo6Items.Add(item); } break; case "SHIFT03ECOMBO7": if (!String.IsNullOrEmpty(item.Value)) { Combo7Items.Add(item); } break; } } Clipart1Configuration = ClipartConfiguration.FromXml(node, "SHIFT03EClipart1"); Clipart2Configuration = ClipartConfiguration.FromXml(node, "SHIFT03EClipart2"); Clipart3Configuration = ClipartConfiguration.FromXml(node, "SHIFT03EClipart3"); CommonEditorConfiguration = TextEditorConfiguration.FromXml(node); HeadersEditorConfiguration = TextEditorConfiguration.FromXml(node, "SHIFT03EHeader"); MemoPopup1Configuration = TextEditorConfiguration.FromXml(node, "SHIFT03EMULTIBOX1"); MemoPopup2Configuration = TextEditorConfiguration.FromXml(node, "SHIFT03EMULTIBOX2"); MemoPopup3Configuration = TextEditorConfiguration.FromXml(node, "SHIFT03EMULTIBOX3"); MemoPopup4Configuration = TextEditorConfiguration.FromXml(node, "SHIFT03EMULTIBOX4"); MemoPopup5Configuration = TextEditorConfiguration.FromXml(node, "SHIFT03EMULTIBOX5"); MemoPopup6Configuration = TextEditorConfiguration.FromXml(node, "SHIFT03EMULTIBOX6"); ComboConfiguration = TextEditorConfiguration.FromXml(node, "TAB3COMBOS"); } if (resourceManager.DataClientGoalsFile.ExistsLocal()) { var targetMemoPopupLists = new[] { MemoPopup1Items, MemoPopup2Items, MemoPopup3Items, }; var document = new XmlDocument(); document.Load(resourceManager.DataClientGoalsFile.LocalPath); var goalNodes = document.SelectNodes("//ClientGoals/Goal")?.OfType <XmlNode>().ToArray() ?? new XmlNode[] { }; foreach (var node in goalNodes) { var goalDataItem = ListDataItem.FromXml(node); foreach (var itemList in targetMemoPopupLists) { if (!itemList.Any(item => String.Equals(item.Value, goalDataItem.Value, StringComparison.OrdinalIgnoreCase))) { itemList.Add(ListDataItem.Clone(goalDataItem)); } } } } if (resourceManager.DataApproachesCommonFile.ExistsLocal()) { var targetMemoPopupLists = new[] { MemoPopup4Items, MemoPopup5Items, MemoPopup6Items, }; var document = new XmlDocument(); document.Load(resourceManager.DataApproachesCommonFile.LocalPath); var approachNodes = document.SelectNodes("//OurApproach/Approach/Name")?.OfType <XmlNode>().ToArray() ?? new XmlNode[] { }; foreach (var node in approachNodes) { foreach (var itemList in targetMemoPopupLists) { if (!itemList.Any(item => String.Equals(item.Value, node.InnerText, StringComparison.OrdinalIgnoreCase))) { itemList.Add(ListDataItem.FromString(node.InnerText)); } } } } if (resourceManager.DataSolutionsCommonFile.ExistsLocal()) { var targetComboItemLists = new[] { Combo1Items, Combo2Items, Combo3Items, Combo4Items, Combo5Items, Combo6Items, Combo7Items, }; var document = new XmlDocument(); document.Load(resourceManager.DataSolutionsCommonFile.LocalPath); var productNodes = document.SelectNodes("//Products/Product/Name")?.OfType <XmlNode>().ToArray() ?? new XmlNode[] { }; foreach (var node in productNodes) { foreach (var comboItemList in targetComboItemLists) { if (!comboItemList.Any(item => String.Equals(item.Value, node.InnerText, StringComparison.OrdinalIgnoreCase))) { comboItemList.Add(ListDataItem.FromString(node.InnerText)); } } } } }