public CamControl(ICam cam, RefreshRate refreshRate) { _cam = cam; _cam.ImageChangedEvent += UnderlyingImageChanged; RefreshRate = refreshRate; RefreshTimer = new Timer(Convert.ToDouble(refreshRate)); RefreshTimer.Elapsed += RefreshTimerOnElapsed; RefreshTimer.Start(); }
public CamUi(ICam cam, int refreshRateInMs) { _camera = cam; _refreshInMiliseconds = refreshRateInMs; SizeMode = PictureBoxSizeMode.Zoom; Click += OnClick; BackColor = Color.Black; _timer = new System.Timers.Timer(1); _timer.Elapsed += TimerOnElapsed; _timer.Start(); ImageLoaded += OnLoadCompleted; Paint += OnPaint; _camera.ImageChangedEvent += ImageChangedEvent; }
public ICam Connect() { if(Address == null) throw new CamException("No Address given"); if(UserName == null) throw new CamException("No UserName given"); if(Password == null) throw new CamException("No Password given"); if(_cam == null) { _cam = CamFactory.Connect(Address, Port, UserName, Password, (ex) => { MessageBoxHelper.ShowError(ex); }); } return _cam; }
public void Disconnect() { _cam = null; }