コード例 #1
0
 private void AddressSuggestions_Updated(object sender, AddressSuggestionsUpdatedEventArgs eventArgs)
 {
     try
     {
         ThreadingHelpers.BeginUpdate(MyComboBox);
         var text = ThreadingHelpers.GetText(MyComboBox);
         ThreadingHelpers.ClearItems(MyComboBox);
         foreach (var addressSuggestions in eventArgs.AddressSuggestions)
         {
             ThreadingHelpers.AddItem(MyComboBox, addressSuggestions);
         }
         ThreadingHelpers.SetDroppedDown(MyComboBox, true);
         ThreadingHelpers.ClearSelection(MyComboBox);
         ThreadingHelpers.SetText(MyComboBox, text);
         ThreadingHelpers.SetSelectionStart(MyComboBox, text.Length);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
     finally
     {
         ThreadingHelpers.EndUpdate(MyComboBox);
     }
 }
コード例 #2
0
 private void AddressSuggestions_Updated(object sender, AddressSuggestionsUpdatedEventArgs eventArgs)
 {
     try
     {
         ThreadingHelper.BeginUpdate(comboBox1);
         ThreadingHelper.ClearItems(comboBox1);
         if (eventArgs.AddressSuggestions.Count > 0)
         {
             foreach (var addressSuggestion in eventArgs.AddressSuggestions)
             {
                 var item = new KeyValuePair <string, string>(addressSuggestion.Key, addressSuggestion.Value.ToUpper());
                 ThreadingHelper.AddItem(comboBox1, item);
             }
             ThreadingHelper.SetDroppedDown(comboBox1, true);
             ThreadingHelper.SetVisible(comboBox1, true);
         }
         else
         {
             ThreadingHelper.SetDroppedDown(comboBox1, false);
         }
     }
     finally
     {
         ThreadingHelper.EndUpdate(comboBox1);
     }
 }