public void ImportCamera (string camera_device) { GPhotoCamera cam = new GPhotoCamera(); try { int num_cameras = cam.DetectCameras(); int selected_cam = 0; if (num_cameras < 1) { HigMessageDialog md = new HigMessageDialog (main_window, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.Ok, Catalog.GetString ("No cameras detected."), Catalog.GetString ("F-Spot was unable to find any cameras attached to this system." + " Double check that the camera is connected and has power")); md.Run (); md.Destroy (); return; } else if (num_cameras == 1) { selected_cam = 0; } else { bool found = false; if (camera_device != null) { string port = camera_device.Remove (0, "gphoto2:".Length); for (int i = 0; i < num_cameras; i++) if (cam.CameraList.GetValue (i) == port) { selected_cam = i; found = true; break; } } if (!found) { FSpot.CameraSelectionDialog camselect = new FSpot.CameraSelectionDialog (cam.CameraList); selected_cam = camselect.Run (); } } if (selected_cam >= 0) { cam.SelectCamera (selected_cam); cam.InitializeCamera (); FSpot.CameraFileSelectionDialog selector = new FSpot.CameraFileSelectionDialog (cam, db); if (selector.Run() > 0) query.RollSet = new RollSet (db.Rolls.GetRolls (1)[0]); UpdateQuery (); } } catch (GPhotoException ge) { System.Console.WriteLine (ge.ToString ()); HigMessageDialog md = new HigMessageDialog (main_window, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, Catalog.GetString ("Error connecting to camera"), String.Format (Catalog.GetString ("Received error \"{0}\" while connecting to camera"), ge.Message)); md.Run (); md.Destroy (); } finally { cam.ReleaseGPhotoResources (); } }