public FilesInfo OpenListFiles(string filename) { FilesInfo files = _frmMainWindow.xml.OpenListFiles(Application.StartupPath + "//" + filename); return(files); //return new FilesInfo(); }
private void ShowFilesInfo(FilesInfo files) { panelListFiles.Controls.Clear(); panelListFiles.SuspendLayout(); for (int i = 0; i < files.listFileInfo.Count; i++) { Button btn = new Button(); string name = files.listFileInfo[i].Name; if (name.Length > 20) { name = name.Substring(0, 20) + ".."; } btn.Text = name; btn.Name = "btn" + i.ToString(); btn.Click += btn_Click; btn.MouseHover += btn_MouseHover; btn.MouseEnter += btn_MouseEnter; btn.MouseLeave += btn_MouseLeave; btn.Font = new Font("Verdana", 16); btn.Left = 10; btn.Top = i * 50; btn.Height = 42; btn.Width = 300; panelListFiles.Controls.Add(btn); } panelListFiles.ResumeLayout(); }
private void Init() { bNeedReload = false; if (Utils.isFileExist(listFileName)) { filesInfo = OpenListFiles(listFileName); ShowFilesInfo(filesInfo); pict.SizeMode = PictureBoxSizeMode.StretchImage; pict.Image = (Image)Properties.Resources.chooseDevInitImage; t = new TypingText(Properties.Resources.comment_chooseDevice_Initial, txtComment); t.StartTyping(); } else { } }
public FilesInfo OpenListFiles(string listFileName) { FilesInfo files = new FilesInfo(); XmlTextReader reader = new XmlTextReader(listFileName); string file_Name = null; string commentString = string.Empty; string imageLinkString = string.Empty; string paramName = string.Empty; string fileName = string.Empty; while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: // Узел является элементом. paramName = reader.Name; if (reader.Name == "FILE") { fileName = string.Empty; commentString = string.Empty; imageLinkString = string.Empty; reader.MoveToNextAttribute(); if (reader.Name == "NAME") { file_Name = reader.Value; //listImageLink_Help=new List<string>(); } } break; case XmlNodeType.Text: // Вывести текст в каждом элементе. if (paramName == "FILENAME") { fileName = reader.Value; } if (paramName == "COMMENT") { commentString = reader.Value; } if (paramName == "IMAGELINK") { imageLinkString = reader.Value; } break; case XmlNodeType.EndElement: // Вывести конец элемента. if (reader.Name == "FILE") { FileInfo fileInf = new FileInfo(file_Name, fileName, imageLinkString, commentString); commentString = string.Empty; imageLinkString = string.Empty; fileName = string.Empty; files.listFileInfo.Add(fileInf); } break; } } return(files); }