private void enumLUGCallback(LUGAPI.LUGEnumStatus enumStatus) { Hostinfo hn = ctx as Hostinfo; if (enumStatus.entries != null && enumStatus.entries.Count > 0) { lvArr = new ListViewItem[Convert.ToInt32(enumStatus.entries.Count)]; for (int i = 0; i < enumStatus.entries.Count; i++) { lvArr[i] = new ListViewItem(enumStatus.entries[i]); if (enumStatus.entries[i][1] == LUGAPI.Disabled) { lvArr[i].ImageIndex = (int)imageLUGDisabled; } else { lvArr[i].ImageIndex = (int)imageLUG; } } this.lvLUGBETA.Items.AddRange(lvArr); this.AutoResizePage(); if (enumStatus.moreEntries) { try { if (enumStatus.type == LUGAPI.LUGType.User) { LUGAPI.NetEnumUsers( hn.hostName, enumStatus.resumeHandle, out enumStatus); enumLUGCallback(enumStatus); } else if (enumStatus.type == LUGAPI.LUGType.Group) { LUGAPI.NetEnumGroups( hn.hostName, enumStatus.resumeHandle, out enumStatus); enumLUGCallback(enumStatus); } } catch (Exception ex) { Logger.Log(ex.StackTrace); } //container.SetCursor(Cursors.Default); } else { //container.SetCursor(Cursors.Default); } } }
private void PopulateListView(LUGAPI.LUGEnumStatus enumStatus) { if (enumStatus.entries != null && enumStatus.entries.Count > 0) { ListViewItem [] lvArr = new ListViewItem[Convert.ToInt32(enumStatus.entries.Count)]; for (int i = 0; i < enumStatus.entries.Count; i++) { if (enumStatus.type == LUGAPI.LUGType.User) { lvArr[i] = new ListViewItem(enumStatus.entries[i][2]); } else { lvArr[i] = new ListViewItem(enumStatus.entries[i][1]); } } this.lvMembers.Items.AddRange(lvArr); if (enumStatus.moreEntries) { try { if (enumStatus.type == LUGAPI.LUGType.User) { LUGAPI.NetEnumUsers( _hostName, enumStatus.resumeHandle, out enumStatus); PopulateListView(enumStatus); } else if (enumStatus.type == LUGAPI.LUGType.Group) { LUGAPI.NetEnumGroups( _hostName, enumStatus.resumeHandle, out enumStatus); PopulateListView(enumStatus); } } catch (Exception) { } } } }
public void PopulatePage(string hostName, bool bListUsers) { LUGAPI.LUGEnumStatus enumStatus; _hostName = hostName; if (bListUsers) { LUGAPI.NetEnumUsers(_hostName, 0, out enumStatus); } else { LUGAPI.NetEnumGroups(_hostName, 0, out enumStatus); } lvMembers.Clear(); lvMembers.Columns.Add("", 20, HorizontalAlignment.Left); PopulateListView(enumStatus); lvMembers.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); }