Ejemplo n.º 1
0
 private void Create_Champion_ComboBox_Items()
 {
     try
     {
         CBB_Champion.Items.Clear();
         CBB_Champion.DisplayMemberPath = "Key";
         CBB_Champion.SelectedValuePath = "Value";
         Dictionary <string, int> champions = null;
         int c = 0;
         while ((champions == null || champions.Count == 0) && c < 15)
         {
             c++;
             champions = leagueClient.Get_Owned_Champions_Dict();
             Thread.Sleep(1000);
         }
         CBB_Champion.ItemsSource = champions.
                                    Select(s => s = new KeyValuePair <string, int>(zh_ch.en_to_ch(s.Key), s.Value));
         if (CBB_Champion.Items.Count != 0)
         {
             CBB_Champion.SelectedItem = CBB_Champion.Items[0];
         }
     }
     catch { }
 }