public SkinController(Canvas canvas, TextEditor xmlEditor, AppProgressBarController appProgressBarController, Grid renderImage, ScrollViewer scrollViewer) { Canvas = canvas; RenderImage = renderImage; ScrollViewer = scrollViewer; AppProgressBarController = appProgressBarController; XmlEditor = xmlEditor; SkinApp = new SkinApp(); }
private void LoadSkinModel() { AppProgressBarController.SetValue(0, 0, "Opening file..."); AppProgressBarController.ShowIndeterminate(); var xmlDoc = new XmlDocument(); var xml = File.ReadAllText(FileName); xml = xml.Replace("&", "&"); xmlDoc.LoadXml(xml); SkinApp = new SkinApp(); var skinAppXmlNode = xmlDoc.ChildNodes.Cast<XmlElement>().First(t => t.Name.ToLower() == "skinapp"); Core.ClearMemory(); AppProgressBarController.Hide(); // Чтение SkinAppStyles AppProgressBarController.SetValue(0, 0, "Analyzing file..."); AppProgressBarController.ShowIndeterminate(); foreach (var item in skinAppXmlNode.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "style")) { var skinAppStyle = new SkinAppStyle { Name = item.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Name") ? item.Attributes["Name"].Value : "", CharSet = item.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "CharSet") ? item.Attributes["CharSet"].Value : "", Face = item.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Face") ? item.Attributes["Face"].Value : "", Height = item.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Height") ? Convert.ToInt32(item.Attributes["Height"].Value) : 0, Weight = item.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Weight") ? Convert.ToInt32(item.Attributes["Weight"].Value) : 0, Default = item.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Default") ? item.Attributes["Default"].Value : "", Disabled = item.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Disabled") ? item.Attributes["Disabled"].Value : "", Selected = item.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Selected") ? item.Attributes["Selected"].Value : "", Hover = item.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Hover") ? item.Attributes["Hover"].Value : "" }; SkinApp.Styles.Add(skinAppStyle); } // Чтение SkinAppOptions foreach (var item in skinAppXmlNode.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "option")) { var skinAppOption = new SkinAppOption { Name = item.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Name") ? item.Attributes["Name"].Value : "", FileName = item.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "FileName") ? item.Attributes["FileName"].Value : "" }; SkinApp.Options.Add(skinAppOption); } // Чтение SkinWindows foreach (var xmlWindow in skinAppXmlNode.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skinwindow")) { var skinWindow = new SkinWindow { Name = xmlWindow.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Name") ? xmlWindow.Attributes["Name"].Value : "", Text = xmlWindow.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Text") ? xmlWindow.Attributes["Text"].Value : "", MainWindow = xmlWindow.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "MainWindow") && Convert.ToBoolean(xmlWindow.Attributes["MainWindow"].Value.ToLower()) }; var winArt = xmlWindow.ChildNodes.Cast<XmlElement>().First(t => t.Name.ToLower() == "skinart"); skinWindow.Art = new SkinArt { BackgroundColor = winArt.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "BackgroundColor") ? winArt.Attributes["BackgroundColor"].Value : "" }; foreach (var xmlArtImage in winArt.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "image")) { skinWindow.Art.Images.Add( new SkinArtImage { Type = xmlArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Type") ? xmlArtImage.Attributes["Type"].Value : "", Path = xmlArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Path") ? xmlArtImage.Attributes["Path"].Value : "" } ); } foreach (var xmlCommand in xmlWindow.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "command")) { skinWindow.Commands.Add( new SkinCommand { Name = xmlCommand.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Name") ? xmlCommand.Attributes["Name"].Value : "", Event = xmlCommand.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Event") ? xmlCommand.Attributes["Event"].Value : "", FileName = xmlCommand.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "FileName") ? xmlCommand.Attributes["FileName"].Value : "", Url = xmlCommand.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "URL") ? xmlCommand.Attributes["URL"].Value : "" } ); } foreach (var xmlBrowser in xmlWindow.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skinbrowser")) { skinWindow.Browsers.Add( new SkinBrowser { Name = xmlBrowser.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Name") ? xmlBrowser.Attributes["Name"].Value : "", MapColor = xmlBrowser.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "MapColor") ? xmlBrowser.Attributes["MapColor"].Value : "", NoBorder = xmlBrowser.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "NoBorder") && xmlBrowser.Attributes["NoBorder"].Value.ToLower() == "true", InitUrl = xmlBrowser.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "InitURL") ? xmlBrowser.Attributes["InitURL"].Value : "" } ); } foreach (var xmlEvent in xmlWindow.ChildNodes.Cast<XmlElement>().Where(t => t.Name.Length >= 8 && t.Name.ToLower().Substring(0, 8) == "onwindow")) { var _event = new SkinEvent { Name = xmlEvent.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Name") ? xmlEvent.Attributes["Name"].Value : "" }; SkinEventType typeValue; if (xmlEvent.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Type") && Enum.TryParse(xmlEvent.Attributes["Type"].Value, true, out typeValue)) { _event.Type = typeValue; } skinWindow.Events.Add(_event); } foreach (var xmlButton in xmlWindow.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skinbutton")) { var button = new SkinButton { Name = xmlButton.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Name") ? xmlButton.Attributes["Name"].Value : "", Text = xmlButton.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Text") ? xmlButton.Attributes["Text"].Value : "", PlainText = xmlButton.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "PlainText") && xmlButton.Attributes["PlainText"].Value.ToLower() == "true", TabID = xmlButton.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "TabID") ? Convert.ToInt32(xmlButton.Attributes["TabID"].Value) : 0, Style = xmlButton.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Style") ? xmlButton.Attributes["Style"].Value : "", Option = xmlButton.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Option") ? xmlButton.Attributes["Option"].Value : "", MapColor = xmlButton.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "MapColor") ? xmlButton.Attributes["MapColor"].Value : "" }; SkinTextAligh alignValue; if (xmlButton.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Align") && Enum.TryParse(xmlButton.Attributes["Align"].Value, true, out alignValue)) { button.Align = alignValue; } foreach (var xmlCommand in xmlButton.ChildNodes.Cast<XmlElement>().Where(t=>t.Name.ToLower() == "command")) { button.Commands.Add( new SkinCommand { Name = xmlCommand.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Name") ? xmlCommand.Attributes["Name"].Value : "", Event = xmlCommand.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Event") ? xmlCommand.Attributes["Event"].Value : "", FileName = xmlCommand.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "FileName") ? xmlCommand.Attributes["FileName"].Value : "", Window = xmlCommand.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Window") ? xmlCommand.Attributes["Window"].Value : "", Url = xmlCommand.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "URL") ? xmlCommand.Attributes["URL"].Value : "" } ); } foreach (var xmlButtonArt in xmlButton.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skinart")) { button.Art = new SkinArt { BackgroundColor = xmlButtonArt.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "BackgroundColor") ? xmlButtonArt.Attributes["BackgroundColor"].Value : "" }; foreach (var xmlButtonArtImage in xmlButtonArt.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "image")) { button.Art.Images.Add( new SkinArtImage { Type = xmlButtonArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Type") ? xmlButtonArtImage.Attributes["Type"].Value : "", Path = xmlButtonArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Path") ? xmlButtonArtImage.Attributes["Path"].Value : "" } ); } } skinWindow.Buttons.Add(button); } foreach (var xmlProgressBar in xmlWindow.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skinprogressbar")) { var progressBar = new SkinProgressBar { Name = xmlProgressBar.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Name") ? xmlProgressBar.Attributes["Name"].Value : "", MapColor = xmlProgressBar.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "MapColor") ? xmlProgressBar.Attributes["MapColor"].Value : "", Vertical = xmlProgressBar.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Vertical") && xmlProgressBar.Attributes["Vertical"].Value.ToLower() == "true" }; foreach (var xmlProgressBarArt in xmlProgressBar.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skinart")) { progressBar.Art = new SkinArt { BackgroundColor = xmlProgressBarArt.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "BackgroundColor") ? xmlProgressBarArt.Attributes["BackgroundColor"].Value : "" }; foreach (var xmlProgressBarArtImage in xmlProgressBarArt.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "image")) { progressBar.Art.Images.Add( new SkinArtImage { Type = xmlProgressBarArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Type") ? xmlProgressBarArtImage.Attributes["Type"].Value : "", Path = xmlProgressBarArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Path") ? xmlProgressBarArtImage.Attributes["Path"].Value : "" } ); } skinWindow.ProgressBars.Add(progressBar); } } foreach (var xmlComboBox in xmlWindow.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skincombobox")) { var comboBox = new SkinComboBox { Name = xmlComboBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Name") ? xmlComboBox.Attributes["Name"].Value : "", Text = xmlComboBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Text") ? xmlComboBox.Attributes["Text"].Value : "", TabID = xmlComboBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "TabID") ? Convert.ToInt32(xmlComboBox.Attributes["TabID"].Value) : 0, Style = xmlComboBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Style") ? xmlComboBox.Attributes["Style"].Value : "", MapColor = xmlComboBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "MapColor") ? xmlComboBox.Attributes["MapColor"].Value : "" }; SkinTextAligh alignValue; if (xmlComboBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Align") && Enum.TryParse(xmlComboBox.Attributes["Align"].Value, true, out alignValue)) { comboBox.Align = alignValue; } foreach (var xmlComboBoxArt in xmlComboBox.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skinart")) { comboBox.Art = new SkinArt { BackgroundColor = xmlComboBoxArt.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "BackgroundColor") ? xmlComboBoxArt.Attributes["BackgroundColor"].Value : "" }; foreach (var xmlComboBoxArtImage in xmlComboBoxArt.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "image")) { comboBox.Art.Images.Add( new SkinArtImage { Type = xmlComboBoxArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Type") ? xmlComboBoxArtImage.Attributes["Type"].Value : "", Path = xmlComboBoxArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Path") ? xmlComboBoxArtImage.Attributes["Path"].Value : "" } ); } skinWindow.ComboBoxes.Add(comboBox); } } foreach (var xmlListBox in xmlWindow.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skinlistbox")) { var listBox = new SkinListBox { Name = xmlListBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Name") ? xmlListBox.Attributes["Name"].Value : "", ListFile = xmlListBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "ListFile") ? xmlListBox.Attributes["ListFile"].Value : "", ComboBox = xmlListBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "ComboBox") ? xmlListBox.Attributes["ComboBox"].Value : "", DefaultSel = xmlListBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "DefaultSel") ? xmlListBox.Attributes["DefaultSel"].Value : "", Option = xmlListBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Option") ? xmlListBox.Attributes["Option"].Value : "", TabID = xmlListBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "TabID") ? Convert.ToInt32(xmlListBox.Attributes["TabID"].Value) : 0, DrawLevel = xmlListBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "DrawLevel") ? Convert.ToInt32(xmlListBox.Attributes["DrawLevel"].Value) : 0, Style = xmlListBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Style") ? xmlListBox.Attributes["Style"].Value : "", BgSelected = xmlListBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "bgSelected") ? xmlListBox.Attributes["bgSelected"].Value : "", BgHover = xmlListBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "bgHover") ? xmlListBox.Attributes["bgHover"].Value : "", MapColor = xmlListBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "MapColor") ? xmlListBox.Attributes["MapColor"].Value : "" }; SkinTextAligh alignValue; if (xmlListBox.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Align") && Enum.TryParse(xmlListBox.Attributes["Align"].Value, true, out alignValue)) { listBox.Align = alignValue; } foreach (var xmlListBoxArt in xmlListBox.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skinart")) { listBox.Art = new SkinArt { BackgroundColor = xmlListBoxArt.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "BackgroundColor") ? xmlListBoxArt.Attributes["BackgroundColor"].Value : "" }; foreach (var xmlListBoxArtImage in xmlListBoxArt.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "image")) { listBox.Art.Images.Add( new SkinArtImage { Type = xmlListBoxArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Type") ? xmlListBoxArtImage.Attributes["Type"].Value : "", Path = xmlListBoxArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Path") ? xmlListBoxArtImage.Attributes["Path"].Value : "" } ); } skinWindow.ListBoxes.Add(listBox); } } foreach (var xmlScrollBar in xmlWindow.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skinscrollbar")) { var scrollBar = new SkinScrollBar { Name = xmlScrollBar.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Name") ? xmlScrollBar.Attributes["Name"].Value : "", ListBox = xmlScrollBar.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "ListBox") ? xmlScrollBar.Attributes["ListBox"].Value : "", TabID = xmlScrollBar.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "TabID") ? Convert.ToInt32(xmlScrollBar.Attributes["TabID"].Value) : 0, DrawLevel = xmlScrollBar.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "DrawLevel") ? Convert.ToInt32(xmlScrollBar.Attributes["DrawLevel"].Value) : 0, MapColor = xmlScrollBar.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "MapColor") ? xmlScrollBar.Attributes["MapColor"].Value : "" }; foreach (var xmlScrollBarArt in xmlScrollBar.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skinart")) { scrollBar.Art = new SkinArt { BackgroundColor = xmlScrollBarArt.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "BackgroundColor") ? xmlScrollBarArt.Attributes["BackgroundColor"].Value : "" }; foreach (var xmlScrollBarArtImage in xmlScrollBarArt.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "image")) { scrollBar.Art.Images.Add( new SkinArtImage { Type = xmlScrollBarArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Type") ? xmlScrollBarArtImage.Attributes["Type"].Value : "", Path = xmlScrollBarArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Path") ? xmlScrollBarArtImage.Attributes["Path"].Value : "" } ); } skinWindow.ScrollBars.Add(scrollBar); } } foreach (var xmlScrollArrow in xmlWindow.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skinscrollarrow")) { var scrollArrow = new SkinScrollArrow { Name = xmlScrollArrow.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Name") ? xmlScrollArrow.Attributes["Name"].Value : "", ListBox = xmlScrollArrow.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "ListBox") ? xmlScrollArrow.Attributes["ListBox"].Value : "", Type = xmlScrollArrow.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Type") ? xmlScrollArrow.Attributes["Type"].Value : "", DrawLevel = xmlScrollArrow.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "DrawLevel") ? Convert.ToInt32(xmlScrollArrow.Attributes["DrawLevel"].Value) : 0, TabID = xmlScrollArrow.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "TabID") ? Convert.ToInt32(xmlScrollArrow.Attributes["TabID"].Value) : 0, MapColor = xmlScrollArrow.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "MapColor") ? xmlScrollArrow.Attributes["MapColor"].Value : "" }; foreach (var xmlScrollArrowArt in xmlScrollArrow.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skinart")) { scrollArrow.Art = new SkinArt { BackgroundColor = xmlScrollArrowArt.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "BackgroundColor") ? xmlScrollArrowArt.Attributes["BackgroundColor"].Value : "" }; foreach (var xmlScrollBarArtImage in xmlScrollArrowArt.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "image")) { scrollArrow.Art.Images.Add( new SkinArtImage { Type = xmlScrollBarArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Type") ? xmlScrollBarArtImage.Attributes["Type"].Value : "", Path = xmlScrollBarArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Path") ? xmlScrollBarArtImage.Attributes["Path"].Value : "" } ); } skinWindow.ScrollArrows.Add(scrollArrow); } } foreach (var xmlSlider in xmlWindow.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skinslider")) { var slider = new SkinSlider { Name = xmlSlider.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Name") ? xmlSlider.Attributes["Name"].Value : "", Min = xmlSlider.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Min") ? Convert.ToInt32(xmlSlider.Attributes["Min"].Value) : 0, Max = xmlSlider.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Max") ? Convert.ToInt32(xmlSlider.Attributes["Max"].Value) : 0, ExpandWidth = xmlSlider.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "ExpandWidth") ? Convert.ToInt32(xmlSlider.Attributes["ExpandWidth"].Value) : 0, DrawAllEx = xmlSlider.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "DrawAllEx") && Convert.ToBoolean(xmlSlider.Attributes["DrawAllEx"].Value), Option = xmlSlider.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Option") ? xmlSlider.Attributes["Option"].Value : "", MapColor = xmlSlider.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "MapColor") ? xmlSlider.Attributes["MapColor"].Value : "" }; foreach (var xmlSliderArt in xmlSlider.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "skinart")) { slider.Art = new SkinArt { BackgroundColor = xmlSliderArt.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "BackgroundColor") ? xmlSliderArt.Attributes["BackgroundColor"].Value : "" }; foreach (var xmlScrollBarArtImage in xmlSliderArt.ChildNodes.Cast<XmlElement>().Where(t => t.Name.ToLower() == "image")) { slider.Art.Images.Add( new SkinArtImage { Type = xmlScrollBarArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Type") ? xmlScrollBarArtImage.Attributes["Type"].Value : "", Path = xmlScrollBarArtImage.Attributes.Cast<XmlAttribute>().Any(t => t.Name == "Path") ? xmlScrollBarArtImage.Attributes["Path"].Value : "" } ); } skinWindow.Sliders.Add(slider); } } SkinApp.Windows.Add(skinWindow); AppProgressBarController.Hide(); } }