/// <summary> /// Get users from the specified OU ready to add to the list box. /// </summary> /// <param name="sender"></param> /// <param name="doWorkEventArgs"></param> private void FetchUsersWorkerOnDoWork(object sender, DoWorkEventArgs doWorkEventArgs) { try { users = GuestUser.LoadGuestUsers(Properties.Settings.Default["LDAPSearchBase"].ToString()); } catch (Exception e) { Logger.Warn($"Failed to load guest users from {Properties.Settings.Default["LDAPSearchBase"]} -- {e}"); } }
/// <summary> /// Load the users from the OU /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LoadUsersDoWork(object sender, DoWorkEventArgs e) { IEnumerable <GuestUser> users = GuestUser.LoadGuestUsers(adPicker.ADsPath); foundUsersLabel.Invoke((MethodInvoker)(() => foundUsersLabel.Text = $"Found {users.Count()} users in {adPicker.ADsPath}")); }