Beispiel #1
0
 private void ItemSelected(object sender, EventArgs e)
 {
     try
     {
         selectedItem = itemSearchBox.SelectedItem as TarkovItemClass;
     }
     catch (Exception ea)
     {
         System.Diagnostics.Debug.WriteLine("Error displaying item details: " + ea.Message);
     }
 }
Beispiel #2
0
        private void SearchItemList(object sender, EventArgs e)
        {
            if (!textChangeEventOn)
            {
                return;
            }
            if (itemSearchBox.Text.Length < 2)
            {
                return;
            }

            textChangeEventOn = false;
            itemSearchBox.SelectedIndexChanged -= new EventHandler(ItemSelected);

            var txt       = itemSearchBox.Text;
            var list      = TarkovItemController.GetMatchingItems(itemSearchBox.Text);
            var listCount = list.Count();

            if (listCount < 30)
            {
                itemSearchBox.DroppedDown = false;
            }
            if (listCount == 1)
            {
                itemSearchBox.DataSource    = list.ToList();
                itemSearchBox.DroppedDown   = true;
                Cursor.Current              = Cursors.Default;
                itemSearchBox.SelectedIndex = 0;
                selectedItem = itemSearchBox.SelectedItem as TarkovItemClass;
            }
            else if (listCount > 1)
            {
                itemSearchBox.DataSource     = list.ToList();
                itemSearchBox.DroppedDown    = true;
                Cursor.Current               = Cursors.Default;
                itemSearchBox.Text           = txt;
                itemSearchBox.SelectionStart = txt.Length;
            }

            else
            {
                itemSearchBox.DroppedDown    = false;
                itemSearchBox.SelectionStart = txt.Length;
            }
            textChangeEventOn = true;
            itemSearchBox.SelectedIndexChanged += new EventHandler(ItemSelected);
        }