private void okBtn_Click(object sender, EventArgs e) { DialogResult result = saveFileDialog1.ShowDialog(); if (result == DialogResult.OK) { RobotMovement movement = new RobotMovement { Id = Guid.NewGuid(), Name = nameTextBox.Text, RobotConfigurationId = ((RobotConfiguration)listBox1.SelectedItem).Id, Steps = new List <MovementStep>() }; Debug.WriteLine(saveFileDialog1.FileName); movement.Save(saveFileDialog1.FileName); } }