private void ShowDemoInformation(DemoItem info) { SelectedItem = info; pbPreview.ImageLocation = info.GetPreviewImagePath(Application.StartupPath); btnOpenFolder.Enabled = !String.IsNullOrEmpty(info.GetProjectPath(Application.StartupPath)); btnRun.Enabled = !String.IsNullOrEmpty(info.GetApplicationPath(Application.StartupPath)); btnYouTube.Enabled = !String.IsNullOrEmpty(info.YouTube); btnGitHub.Enabled = !String.IsNullOrEmpty(info.GitHub); string desc = info.Description; desc = desc.Replace("\n", "\r\n"); txtContents.Text = desc; List <string> api = info.GetApi(Application.StartupPath); lbAPI.Text = string.Format("Items = {0:N0} EA", api.Count); lvAPI.BeginUpdate(); lvAPI.Items.Clear(); foreach (string item in api) { ListViewItem lvi = new ListViewItem(new string[] { item }); lvAPI.Items.Add(lvi); } lvAPI.EndUpdate(); }
private void LoadData() { string input_xml = string.Format("{0}\\Data.xml", Application.StartupPath); Demos = new Dictionary <string, DemoItem>(); //********************************************************** // Read XML //********************************************************** System.Xml.XmlReaderSettings settings = new System.Xml.XmlReaderSettings(); settings.IgnoreComments = true; // Exclude comments settings.ValidationType = System.Xml.ValidationType.None; // Validation //settings.CheckCharacters = false; // Create reader based on settings System.Xml.XmlReader reader = System.Xml.XmlReader.Create(input_xml, settings); System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(reader);// XML 파일 읽기 System.Xml.XmlNode xmlRoot = doc.SelectSingleNode("/DemoCenter"); if (xmlRoot == null) { return; } if (xmlRoot.HasChildNodes == true) { System.Xml.XmlNodeList nodeChildren = xmlRoot.ChildNodes; foreach (System.Xml.XmlElement item in nodeChildren) { string name = String.Empty; string project = String.Empty; string youtube = String.Empty; string contents = String.Empty; if (item.HasAttribute("Name") == true) { name = item.Attributes["Name"].InnerText; } if (item.HasAttribute("Project") == true) { project = item.Attributes["Project"].InnerText; } if (item.HasChildNodes == true) { System.Xml.XmlNodeList nodeDetail = item.ChildNodes; foreach (System.Xml.XmlElement detail in nodeDetail) { if (detail.Name == "YouTube") { youtube = detail.InnerText; } else if (detail.Name == "Contents") { contents = detail.InnerText; } } } DemoItem info = new DemoItem(); info.TagName = name; info.ProjectCode = project; info.YouTube = youtube; info.Description = contents; if (Demos.ContainsKey(info.TagName) == false) { Demos.Add(info.TagName, info); } } } }