private bool SelectComputer() { Logger.Log(String.Format( "LUGPlugin.SelectComputer: hn: {0}", _hn)); SelectComputerDialog selectDlg = new SelectComputerDialog( _hn.hostName, _hn.creds.UserName); if (selectDlg.ShowDialog() == DialogResult.OK) { int result = (int)ErrorCodes.WIN32Enum.ERROR_SUCCESS; _hn.hostName = selectDlg.GetHostname(); if (!selectDlg.UseDefaultUserCreds()) { _hn.creds.UserName = selectDlg.GetUsername(); _hn.creds.Password = selectDlg.GetPassword(); // Only add a connection if we are not using default creds. result = (int)LUGAPI.NetAddConnection( _hn.hostName, _hn.creds.UserName, _hn.creds.Password); if (result != (int)ErrorCodes.WIN32Enum.ERROR_SUCCESS) { MessageBox.Show( "Unable to connect to system:\n" + ErrorCodes.WIN32String(result), "Likewise Administrative Console", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return false; } } // This function is going to set _hn.IsConnectionSuccess... return // that value for this selection. ConnectToDomain(); return _hn.IsConnectionSuccess; } return false; }
private bool SelectComputer(bool bConnect) { Logger.Log(String.Format( "LUGPlugin.SelectComputer: hn: {0}", _hn)); SelectComputerDialog selectDlg = new SelectComputerDialog( _hn.hostName, _hn.creds.UserName); if (selectDlg.ShowDialog() == DialogResult.OK) { int result = (int)LUGAPI.WinError.ERROR_SUCCESS; _hn.hostName = selectDlg.GetHostname(); _hn.creds.UserName = selectDlg.GetUsername(); _hn.creds.Password = selectDlg.GetPassword(); if (!selectDlg.UseDefaultUserCreds() || bConnect) { // Only add a connection if we are not using default creds. result = (int)LUGAPI.NetAddConnection( _hn.hostName, _hn.creds.UserName, _hn.creds.Password); if (Configurations.currentPlatform != LikewiseTargetPlatform.Windows && result == (int)LUGAPI.WinError.ERROR_FILE_NOT_FOUND) { result = (int)LUGAPI.WinError.ERROR_SUCCESS; } if (result != (int)LUGAPI.WinError.ERROR_SUCCESS) { MessageBox.Show( "Unable to connect to system:\n" + ErrorCodes.WIN32String(result), "Likewise Administrative Console", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return false; } } return true; } return false; }