Ejemplo n.º 1
0
 public Treasure(string name, string id, TreasureArea area)
 {
     this.Name = name;
     this.ID   = id;
     this.Area = area;
     Treasures.treasures.Add(this);
 }
Ejemplo n.º 2
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (dataGridView1.DataSource != null && comboBox1.SelectedIndex > -1)
     {
         dataGridView1.Visible             = true;
         dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;
         CurrencyManager currencyManager1 = (CurrencyManager)BindingContext[dataGridView1.DataSource];
         currencyManager1.SuspendBinding();
         TreasureArea area = Enum.GetValues(typeof(TreasureArea)).Cast <TreasureArea>().ToArray()[comboBox1.SelectedIndex];
         for (int row = 0; row < dataGridView1.Rows.Count; row++)
         {
             Treasure first = Treasures.treasures.Find(t => t.ID == dataTable.Rows[row].Field <string>(0));
             dataGridView1.Rows[row].Visible = first == null && area == TreasureArea.UnknownOrUnused || first != null && first.Area == area;
         }
         currencyManager1.ResumeBinding();
         dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
         dataGridView1.Refresh();
     }
 }