private void GetAdapterAndLogin() { if (_adapter != null) { return; } LoginResult result; try { _adapter = new OCAdapter.OCAdapter(); result = _adapter.Login(_ip, _userName, _password, Authentication.BASIC, TimeSpan.FromSeconds(60)); } catch (Exception ex) { //System.Diagnostics.Trace.WriteLine("Exception in ExportVideo, ProbeFrameTime: " + ex.Message); throw ex; } if (result == LoginResult.Failure) { throw new Exception("Login failed, wrong credentials."); } }
private bool LoginAndSetDefaultCamera() { try { if (_adapter == null) { _adapter = new OCAdapter.OCAdapter(); if (_adapter.Login(txtIP.Text, txtUserName.Text, txtPassword.Text, Authentication.BASIC, TimeSpan.FromSeconds(60)) == LoginResult.Failure) { MessageBox.Show("Unable to Log in " + _adapter.GetErrorString(), "OnSSI SDK Sample Solution - Image Export", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } } _camera = _adapter.Cameras().FirstOrDefault(); } catch (Exception ex) { MessageBox.Show("Exception in Login: " + ex.Message); return(false); } return(true); }