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 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; }
public void GetListItemTypeTest () { List<int> list = new List<int> (); DateTime [] date_list = new DateTime [0]; StringCollection string_coll = new StringCollection (); Assert.AreEqual (typeof (int), ListBindingHelper.GetListItemType (list), "#A1"); Assert.AreEqual (typeof (DateTime), ListBindingHelper.GetListItemType (date_list), "#A2"); Assert.AreEqual (typeof (string), ListBindingHelper.GetListItemType (string_coll), "#A4"); // Returns the type of the first item if could enumerate ArrayList arraylist = new ArrayList (); arraylist.Add ("hellou"); arraylist.Add (3.1416); Assert.AreEqual (typeof (string), ListBindingHelper.GetListItemType (arraylist), "#B1"); // Returns the type of the public Item property, not the explicit one ListView.ColumnHeaderCollection col_collection = new ListView.ColumnHeaderCollection (null); Assert.AreEqual (typeof (ColumnHeader), ListBindingHelper.GetListItemType (col_collection), "#C1"); ListContainer list_container = new ListContainer (); String str = "A"; Assert.AreEqual (typeof (IList), ListBindingHelper.GetListItemType (list_container, "List"), "#D1"); Assert.AreEqual (typeof (int), ListBindingHelper.GetListItemType (str, "Length"), "#D2"); // Property doesn't exist - fallback to object type Assert.AreEqual (typeof (object), ListBindingHelper.GetListItemType (str, "DoesntExist"), "#D3"); // finally, objects that are not array nor list Assert.AreEqual (typeof (double), ListBindingHelper.GetListItemType (3.1416), "#E1"); Assert.AreEqual (null, ListBindingHelper.GetListItemType (null), "#E2"); // bug #507120 - an IEnumerator instance with a Current value returning null, // falling back to IList.this detection, if possible Assert.AreEqual (typeof (string), ListBindingHelper.GetListItemType (new NullEnumerable (), null), "#F1"); }