private void RebuildMappingInfo(IBiMap<int, string> latestData) { AutoCompleteStringCollection autoComplete = new AutoCompleteStringCollection(); foreach (var entry in latestData.EnumerateRightToLeft()) { autoComplete.Add(entry.Key); if (this.SelectedId == entry.Value) { this.NameText.InvokeEx(() => this.NameText.Text = entry.Key); } } this.NameText.InvokeEx(() => this.NameText.AutoCompleteCustomSource = autoComplete); this.SetSelectionFromText(); }
private void ResetControlCache(IBiMap<int, string> cacheTable) { this.ResetControlCache(cacheTable, null); }
private void ResetControlCache(IBiMap<int, string> cacheTable, string trueValue = null) { TextBox control = this.DataGrid.EditingControl as TextBox; AutoCompleteStringCollection collection = new AutoCompleteStringCollection(); foreach (var entry in cacheTable.EnumerateLeftToRight().Select(p => p.Value)) { collection.Add(entry); } int? fk = null; if (!string.IsNullOrEmpty(trueValue)) fk = int.Parse(trueValue); control.InvokeEx(() => { if (fk != null) control.Text = cacheTable.GetLeftToRight(fk ?? 0); control.AutoCompleteCustomSource = collection; control.AutoCompleteMode = AutoCompleteMode.SuggestAppend; control.AutoCompleteSource = AutoCompleteSource.CustomSource; }); }
public InverseBiMap(IBiMap <TKey, TValue> direct) { this.inverseData = new Dictionary <TValue, TKey>(); this.direct = direct; }