Пример #1
0
        /// <summary>
        /// action that occurs when the user chooses a part type. will set the collection/datasource of the part dropdown menu to those that match
        /// the users selection. will also populate the description box.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void partTypeBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            String test = partTypeBox.SelectedItem.ToString();

            Queries.Log(Queries.LogLevel.DEBUG, "Selected : " + test);
            string attribs = "";

            if (test == "CPU")
            {
                partBox.DataSource = CPU.GetAll();
                attribs            = ((CPU)partBox.SelectedItem).GetAttributes();
            }
            else if (test == "Cooling")
            {
                partBox.DataSource = Fan.GetAll();
                attribs            = ((Fan)partBox.SelectedItem).GetAttributes();
            }
            else if (test == "Case")
            {
                partBox.DataSource = Case.GetAll();
                attribs            = ((Case)partBox.SelectedItem).GetAttributes();
            }
            else if (test == "Memory")
            {
                partBox.DataSource = Memory.GetAll();
                attribs            = ((Memory)partBox.SelectedItem).GetAttributes();
            }
            else if (test == "Power Supply")
            {
                partBox.DataSource = PowerSupply.GetAll();
                attribs            = ((PowerSupply)partBox.SelectedItem).GetAttributes();
            }
            else if (test == "Storage")
            {
                partBox.DataSource = Storage.GetAll();
                attribs            = ((Storage)partBox.SelectedItem).GetAttributes();
            }
            else if (test == "Graphics Card")
            {
                partBox.DataSource = GraphicsCard.GetAll();
                attribs            = ((GraphicsCard)partBox.SelectedItem).GetAttributes();
            }
            else if (test == "Motherboard")
            {
                partBox.DataSource = MOBO.GetAll();
                attribs            = ((MOBO)partBox.SelectedItem).GetAttributes();
            }
            partDescriptionBox.Text = attribs;
            priceTxtBox.Text        = "$" + ((Part)partBox.SelectedItem).price;
        }