private void SaveProgram() { Positions trajectory = this.visuliser.Trajectory; if (trajectory == null) { return; } SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "XML (*.xml)|*.xml"; sfd.FilterIndex = 1; sfd.RestoreDirectory = true; sfd.FileName = AppUtils.GetDateTime() + ".XML"; //sfd.Multiselect = false; // Show the dialog and get result. DialogResult result = sfd.ShowDialog(); if (result == DialogResult.OK) // Test result. { PositionsStore.Save(trajectory, sfd.FileName); } }
private void LoadProgram() { // Create an instance of the open file dialog box. OpenFileDialog ofd = new OpenFileDialog(); // Set filter options and filter index. ofd.Filter = "XML Files (.xml)|*.xml|All Files (*.*)|*.*"; ofd.FilterIndex = 1; ofd.Multiselect = false; // Show the dialog and get result. DialogResult result = ofd.ShowDialog(); if (result == DialogResult.OK) // Test result. { string path = ofd.FileName; Positions trajectory = PositionsStore.Load(path); if (trajectory != null && trajectory.Count > 0) { this.visuliser.Trajectory = trajectory; } } }