public AddRemoveColumnsForm(List <string> availableCol, List <string> displayedcol, EventViewerControl.EventViewerNodeType type) : this() { if (availableCol != null && availableCol.Count != 0) { lbAvailableColumns.Items.AddRange(availableCol.ToArray()); } if (displayedcol != null && displayedcol.Count != 0) { lbDisplayedColumns.Items.AddRange(displayedcol.ToArray()); } if (lbAvailableColumns.Items.Count != 0) { lbAvailableColumns.SelectedIndex = lbAvailableColumns.Items.Count - 1; } if (lbDisplayedColumns.Items.Count != 0) { lbDisplayedColumns.SelectedIndex = lbDisplayedColumns.Items.Count - 1; } nodeType = type; if (lbDisplayedColumns.Items.Count == 1) { btnRemove.Enabled = false; } btnAdd.Enabled = btnRestoredefaults.Enabled = lbAvailableColumns.Items.Count != 0; btnMovedown.Enabled = (lbDisplayedColumns.Items.Count - 1) != (lbDisplayedColumns.SelectedIndex); }
public AddRemoveColumnsForm(List<string> availableCol, List<string> displayedcol, EventViewerControl.EventViewerNodeType type) : this() { if (availableCol != null && availableCol.Count != 0) { lbAvailableColumns.Items.AddRange(availableCol.ToArray()); } if (displayedcol != null && displayedcol.Count != 0) { lbDisplayedColumns.Items.AddRange(displayedcol.ToArray()); } if (lbAvailableColumns.Items.Count != 0) { lbAvailableColumns.SelectedIndex = lbAvailableColumns.Items.Count - 1; } if (lbDisplayedColumns.Items.Count != 0) { lbDisplayedColumns.SelectedIndex = lbDisplayedColumns.Items.Count - 1; } nodeType = type; if (lbDisplayedColumns.Items.Count == 1) { btnRemove.Enabled = false; } btnAdd.Enabled = btnRestoredefaults.Enabled = lbAvailableColumns.Items.Count != 0; btnMovedown.Enabled = (lbDisplayedColumns.Items.Count - 1) != (lbDisplayedColumns.SelectedIndex); }