private void btnReset_Click(object sender, EventArgs e) { //Confirm if (MessageBox.Show(Strings.Confirm_Reset, Strings.Confirm_Reset_Title, MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Cancel) { return; } //Reset to default CurrentColumnsCollection = ColumnListColumn.DefaultHeaders(); loadLists(); PropertyChanged = true; }
internal override void getSettings() { if (SettingsManager.Settings.Columns.Count == 0) { //Get Default column list CurrentColumnsCollection = ColumnListColumn.DefaultHeaders(); return; } var listView = new ListView(); foreach (ColumnListColumn column in SettingsManager.Settings.Columns) { var columnHeader = new ColumnHeader(); switch (column.Index) { case 1: columnHeader.Text = Strings.ColumnNumber; break; case 2: columnHeader.Text = Strings.ColumnType; break; case 3: columnHeader.Text = Strings.ColumnSummary; break; case 4: columnHeader.Text = Strings.ColumnStatus; break; case 5: columnHeader.Text = Strings.ColumnAuthor; break; case 6: columnHeader.Text = Strings.ColumnLastUpdated; break; } columnHeader.DisplayIndex = column.DisplayIndex; columnHeader.Tag = column.Hidden ? -1 * column.Index : column.Index; listView.Columns.Add(columnHeader); } CurrentColumnsCollection = listView.Columns; }
private void initializeItemList() { //Define columns ColumnListColumn.DefaultHeaders(lvwIssueList); //Get Feed Items feedItems = _servicePlugin.FeedItems; //Add Items to ListView foreach (var item in feedItems) { var lvi = new ListViewItem { Text = string.Empty }; lvi.SubItems.Add(item.Number.ToString()); lvi.SubItems.Add(item.Type); lvi.SubItems.Add(item.Description); lvi.SubItems.Add(item.Status); lvi.SubItems.Add(item.Author); lvi.SubItems.Add(item.LastUpdated.ToString()); lvi.Tag = item; lvwIssueList.Items.Add(lvi); } //Set column width for all colums to stretch foreach (ColumnHeader column in lvwIssueList.Columns) { column.Width = string.IsNullOrEmpty(column.Text.Trim()) ? 30 : -1; if (column.Index == 6) { column.ImageKey = ArrowDownImage; } } //Re-higlight the last selected items restoreRecentItems(); //Restore Sorting and Column order / display loadListViewSettings(); //Fill the combo box with appropriate fields fillFieldList(); }