示例#1
0
 private void GenericDetailedListSearchButton_Click(object sender, EventArgs e)
 {
     IGenericDetailedListSearch<Vampire> search = new GenericDetailedListSearchDialog<Vampire>();
     var vampires = new[]
         {
             new Vampire {Name = "Bill", Age = 172},
             new Vampire {Name = "Jessica", Age = 17},
             new Vampire {Name = "Erik", Age = 1204}
         };
     search.SetValues(
         "Select your favourite vampire",
         vampires,
         new[] {"Name", "Age"},
         vampire => new[] {vampire.Name, vampire.Age.ToString(CultureInfo.InvariantCulture)});
     search.FixWidth();
     MessageBox.Show(search.ShowDialog() != DialogResult.OK ? "Cancelled" : string.Format("Selected {0}", search.SelectedItem.Name));
 }
示例#2
0
 private void GenericDetailedListSearchFixWidthButton_Click(object sender, EventArgs e)
 {
     IGenericDetailedListSearch<ItemRate> search = new GenericDetailedListSearchDialog<ItemRate>();
     var items = new[]
         {
             new ItemRate {Category = "Whitegoods", Code = "WG_KITCHEN_REFRIDGERATOR", Description = "Refridgerator"},
             new ItemRate {Category = "Smallgoods", Code = "DELI_SALAMI", Description = "Salami"},
             new ItemRate {Category = "Smallgoods", Code = "DELI_PASTRAMI", Description = "Pastrami"},
             new ItemRate {Category = "Smallclothes", Code = "CLOTHING_UNDERWEAR_BOXERS", Description = "Nooo, briefs."}
         };
     search.SetValues(
         "Select an item",
         items,
         new[] {"Category", "Code", "Description"},
         i => new[] {i.Category, i.Code, i.Description});
     search.FixWidth();
     MessageBox.Show(search.ShowDialog() != DialogResult.OK ? "Cancelled" : string.Format("Selected {0}", search.SelectedItem.Code));
 }
示例#3
0
 private void GenericDetailedListSearchWithColumnFormats_Click(object sender, EventArgs e)
 {
     var dates = GetWorldWarOneDates();
     var search = new GenericDetailedListSearchDialog<KeyDateInWwi>();
     search.SetValues(
         "Select an item",
         dates,
         new[] { "Date", "Theatre", "Description" },
         i => new[] { i.Date.ToString("dd/MM/yyyy"), i.Theatre, i.Description },
         new[] { ListViewItemTextComparer.ColumnFormat.Date, ListViewItemTextComparer.ColumnFormat.Text, ListViewItemTextComparer.ColumnFormat.Text });
     search.Sort();
     search.FixWidth();
     MessageBox.Show(search.ShowDialog() != DialogResult.OK ? "Cancelled" : string.Format("Selected {0}", search.SelectedItem.Date));
 }