/// <summary> /// Clear the autocompletion history /// </summary> public void ClearAutoCompletionHistory() { if (AutoCompleteCustomSource != null) { AutoCompleteCustomSource.Clear(); } }
//---------------------------------------------------------------------------------------- private void CControleForVariableTextBox_Enter(object sender, EventArgs e) { if (m_valeursInspiration == null && m_parametresInspiration != null && m_parametresInspiration.Count > 0) { m_valeursInspiration = CFournisseurInspiration.GetInspiration(m_parametresInspiration); AutoCompleteMode = AutoCompleteMode.Suggest; AutoCompleteSource = AutoCompleteSource.CustomSource; AutoCompleteCustomSource.Clear(); AutoCompleteCustomSource.AddRange(m_valeursInspiration.ToArray()); } }
/// <summary> /// Handle a keypress /// </summary> /// <param name="sender">event sender</param> /// <param name="e">event parameters</param> private void HandleKeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { CommandSentEventHandler handler = CommandSent; if (handler != null) { handler(Text); if (AutoCompletion) { if (AutoCompleteCustomSource != null) { AutoCompleteCustomSource.Add(Text); } } } Text = ""; e.Handled = true; } }
private void TextChangedInternal(object sender, EventArgs e) { if (lockTextChangedEvent) { return; } ; System.Diagnostics.Debug.WriteLine($"Text changed ('{Text}'). Selection : {SelectionStart}, {SelectionLength}"); if (lastKeyPressedBeforeTextChange == Keys.None || lastKeyPressedBeforeTextChange == Keys.Down || lastKeyPressedBeforeTextChange == Keys.Up) { if (AutoCompleteCustomSource.Contains(Text)) { var passwordAutoComplete = AutoCompleteCustomSource as IAutoCompleteStringWithPasswordsCollection; ApplyTextChangeToUnmaskedString(new TextChange() { Beginning = 0, End = -1, Modification = passwordAutoComplete.GetUnmasked(Text) }); } } MaskPassword(); foreach (var handler in Handlers) { handler.Handle(Event.ConnectionStringBoxTextChanged, this); } stack.Stack(UnmaskedConnectionString, SelectionStart, SelectionLength); lastKeyPressedBeforeTextChange = Keys.None; }