Beispiel #1
0
        private void OnGearClassChanged(object sender, EventArgs e)
        {
            int    n = 0;
            string selectVariation = "";

            cboGearVariation.Items.Clear();
            foreach (var item in Gears.GearVariationsUsage(((KeyValuePair <string, string>)cboGearClasses.SelectedItem).Key))
            {
                cboGearVariation.Items.Add(item);
                if (_parsedVariationName != item.Value.ToLower() && _parsedVariationName.Contains(item.Value.ToLower()))
                {
                    if (n == 0)
                    {
                        selectVariation = item.Value;
                    }
                    else if (item.Value.Length > selectVariation.Length)
                    {
                        selectVariation = item.Value;
                    }
                    n++;
                }
            }

            cboGearVariation.DisplayMember = "value";
            cboGearVariation.ValueMember   = "key";
            cboGearVariation.Text          = selectVariation;

            if (cboGearVariation.Text == "")
            {
                cboGearVariation.Text = _variationName.Substring(_variationName.IndexOf('-') + 1).Trim();
            }
        }