private void Load_Click(object sender, RoutedEventArgs e) { var dlg = new OpenFileDialog { Filter = "All files|*.*", Title = "Select layout file", FileName = "laytest.xml" }; if (dlg.ShowDialog() != true) { return; } try { myArea.LogicCore.Graph = GraphSerializer.DeSerialize(dlg.OpenFile()); myArea.GenerateGraph(); } catch (Exception ex) { MessageBox.Show(string.Format("Failed to load layout file:\n {0}", ex)); } }