private void OpenSVGFile() { ResetValue(); using (OpenFileDialog openFileDialog = new OpenFileDialog()) { openFileDialog.InitialDirectory = "c:\\"; openFileDialog.Filter = "*svg files (.svg)|*.svg"; openFileDialog.RestoreDirectory = false; if (openFileDialog.ShowDialog() == DialogResult.OK) { Console.WriteLine(openFileDialog.FileName); var filestream = openFileDialog.OpenFile(); using (StreamReader reader = new StreamReader(filestream)) { string file; file = reader.ReadToEnd(); if (file != null) { XmlDocument doc = new XmlDocument(); doc.LoadXml(file); _fileContent = new ItemSvdData(doc.DocumentElement); } } } } }
private void ResetValue() { _fileContent = null; textBox1.Text = ""; }