private void BUT_save_Click(object sender, EventArgs e)
{
camerainfo camera = new camerainfo();
string camname = "Default";
if (MissionPlanner.Controls.InputBox.Show("Camera Name", "Please and a camera name", ref camname) != System.Windows.Forms.DialogResult.OK)
return;
CMB_camera.Text = camname;
// check if camera exists alreay
if (cameras.ContainsKey(CMB_camera.Text))
{
camera = cameras[CMB_camera.Text];
}
else
{
cameras.Add(CMB_camera.Text, camera);
}
try
{
camera.name = CMB_camera.Text;
camera.focallen = (float)NUM_focallength.Value;
camera.imageheight = float.Parse(TXT_imgheight.Text);
camera.imagewidth = float.Parse(TXT_imgwidth.Text);
camera.sensorheight = float.Parse(TXT_sensheight.Text);
camera.sensorwidth = float.Parse(TXT_senswidth.Text);
}
catch { CustomMessageBox.Show("One of your entries is not a valid number"); return; }
cameras[CMB_camera.Text] = camera;
xmlcamera(true, Settings.GetUserDataDirectory() + "cameras.xml");
}