public void Run() { try { // Create manager object - make sure you have the correct MD3 file for your Nikon DSLR (see https://sdk.nikonimaging.com/apply/) NikonManager manager = new NikonManager("Type0003.md3"); // Listen for the 'DeviceAdded' event manager.DeviceAdded += manager_DeviceAdded; // Wait for a device to arrive _waitForDevice.WaitOne(); // Enable live view (required for manual focus) _device.LiveViewEnabled = true; // Get the current manual focus 'drive step' NikonRange driveStep = _device.GetRange(eNkMAIDCapability.kNkMAIDCapability_MFDriveStep); // Set the drive step to max driveStep.Value = driveStep.Max; _device.SetRange(eNkMAIDCapability.kNkMAIDCapability_MFDriveStep, driveStep); // Drive all the way to 'closest' DriveManualFocus(eNkMAIDMFDrive.kNkMAIDMFDrive_InfinityToClosest); // Set the drive step to something small driveStep.Value = 200.0; _device.SetRange(eNkMAIDCapability.kNkMAIDCapability_MFDriveStep, driveStep); // Drive manual focus towards infinity in small steps for (int i = 0; i < 10; i++) { DriveManualFocus(eNkMAIDMFDrive.kNkMAIDMFDrive_ClosestToInfinity); } // Disable live view _device.LiveViewEnabled = false; // Shutdown manager.Shutdown(); } catch (NikonException ex) { Console.WriteLine(ex.Message); } }