private void UpdateSearchMethods(ISearchType type) { CBItem oldItem = CbScanMethod.SelectedIndex < 0 ? null : (CBItem)CbScanMethod.SelectedItem; CBItem item; CbScanMethod.BeginUpdate(); CbScanMethod.SuspendLayout(); CbScanMethod.Items.Clear(); for (int x = 0; x < _host.SearchMethods.Count; x++) { if (_host.SearchMethods[x].SupportSearchType(type) && (_host.SearchMethods[x].Mode == Types.SearchMode.Both || (_host.SearchMethods[x].Mode == Types.SearchMode.First && _isFirstScan) || (_host.SearchMethods[x].Mode == Types.SearchMode.Next && !_isFirstScan))) { item = new CBItem(_host.SearchMethods[x]); CbScanMethod.Items.Add(item); if (!_cbScanMethodToolTips.Keys.Contains(_host.SearchMethods[x])) { _cbScanMethodToolTips.Add(_host.SearchMethods[x], item.ToTooltip()); } if (oldItem != null && oldItem.Plugin == item.Plugin) { CbScanMethod.SelectedIndex = CbScanMethod.Items.Count - 1; } } } CbScanMethod.ResumeLayout(true); CbScanMethod.EndUpdate(); }
// Add all compatible ISearchTypes to combobox list private void UpdateSearchTypes(ISearchMethod method) { CBItem oldItem = CbScanDataType.SelectedIndex < 0 ? null : (CBItem)CbScanDataType.SelectedItem; CBItem item; CbScanDataType.BeginUpdate(); CbScanDataType.SuspendLayout(); CbScanDataType.Items.Clear(); for (int x = 0; x < _host.SearchTypes.Count; x++) { if (method.SupportSearchType(_host.SearchTypes[x])) { item = new CBItem(_host.SearchTypes[x]); CbScanDataType.Items.Add(item); if (!_cbScanDataTypeToolTips.Keys.Contains(_host.SearchTypes[x])) { _cbScanDataTypeToolTips.Add(_host.SearchTypes[x], item.ToTooltip()); } if (oldItem != null && oldItem.Plugin == item.Plugin) { CbScanDataType.SelectedIndex = CbScanDataType.Items.Count - 1; } } } CbScanDataType.ResumeLayout(true); CbScanDataType.EndUpdate(); }
private void UpdateSearchMethods(Types.SearchMode mode) { CBItem oldItem = CbScanMethod.SelectedIndex < 0 ? null : (CBItem)CbScanMethod.SelectedItem; CBItem item; CbScanMethod.BeginUpdate(); CbScanMethod.SuspendLayout(); CbScanMethod.Items.Clear(); _isUserInput = false; // Setup method combo boxes foreach (ISearchMethod sm in _host.SearchMethods) { if (sm.Mode == mode || sm.Mode == Types.SearchMode.Both) { item = new UI.CBItem(sm); this.CbScanMethod.Items.Add(item); if (!_cbScanMethodToolTips.Keys.Contains(sm)) { _cbScanMethodToolTips.Add(sm, item.ToTooltip()); } if (oldItem != null && oldItem.Plugin == item.Plugin) { CbScanMethod.SelectedIndex = CbScanMethod.Items.Count - 1; // Update Search Data Types UpdateSearchTypes(sm); } } } _isUserInput = true; CbScanMethod.ResumeLayout(true); CbScanMethod.EndUpdate(); }