コード例 #1
0
        private void entryTypeDropdown_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox dropDown = sender as ComboBox;

            if (dropDown != null)
            {
                ExtraDropEntry entry = entriesListBox.SelectedItem as ExtraDropEntry;
                if (entry != null)
                {
                    try
                    {
                        ExtraDropType type = (ExtraDropType)dropDown.SelectedItem;
                        entry.SetType(type);
                    }
                    catch (InvalidCastException)
                    {
                        MessageBox.Show(
                            "Error attempting to change type",
                            "Error",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error
                            );
                    }
                }
            }
        }
コード例 #2
0
 public void SetType(ExtraDropType type)
 {
     Type = type;
 }