public Form1() { InitializeComponent(); string path = "sample.xml"; projectModel = controller.Load(path); propertyGrid1.SelectedObject = controller.ProjectModel; }
public static ProjectModel Load(string path, out ProjectModel project) { project = null; try { Stream stream = File.Open(path, FileMode.Open); XmlSerializer serializer = new XmlSerializer(typeof(ProjectModel)); project = (ProjectModel)serializer.Deserialize(stream); stream.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); //error loging return project; } project.InitializeNotification(); return project; }