private void button1_Click(object sender, EventArgs e) { using (var ofd = new OpenFileDialog()) { ofd.InitialDirectory = _lastPath; ofd.Filter = "iSpy Files (*.ispy)|*.ispy|XML Files (*.xml)|*.xml"; if (ofd.ShowDialog(this) == DialogResult.OK) { string fileName = ofd.FileName; try { var fi = new FileInfo(fileName); _lastPath = fi.DirectoryName; } catch { } if (fileName.Trim() != "") { try { _c = MainForm.GetObjects(fileName.Trim()); ListObjects(_c); } catch (Exception ex) { MessageBox.Show(ex.Message, LocRm.GetString("Error")); } } } } }