private void mnOpen_Click(object sender, EventArgs e) { if (dlgOpenFile.ShowDialog() == DialogResult.OK) { using (FileStream fs = new FileStream(dlgOpenFile.FileName, FileMode.Open)) { XmlDocument xml = new XmlDocument(); try { xml.Load(fs); FlowNetwork g = new FlowNetwork(); g.ParseXml(xml); Runtime.currentGraph = g; Visualizer.ZoomFit(pbDraw.ClientRectangle); Invalidate(); pbDraw.Invalidate(); } catch (Exception ex) { Log.Write("Can't load FlowNetwork from file.", Log.ERROR); Log.Write(ex.Message, Log.ERROR); } } } }