private void AddCamera(int videoSourceIndex, bool startWizard = false)
{
CameraWindow cw = NewCameraWindow(videoSourceIndex);
TopMost = false;
var ac = new AddCamera { CameraControl = cw, StartWizard = startWizard, IsNew = true, MainClass = this };
ac.ShowDialog(this);
if (ac.DialogResult == DialogResult.OK)
{
UnlockLayout();
SetNewStartPosition();
if (cw.VolumeControl != null && !cw.VolumeControl.IsEnabled)
cw.VolumeControl.Enable();
NeedsSync = true;
}
else
{
int cid = cw.Camobject.id;
cw.Disable();
_pnlCameras.Controls.Remove(cw);
cw.Dispose();
Cameras.RemoveAll(p => p.id == cid);
}
ac.Dispose();
TopMost = Conf.AlwaysOnTop;
}