async private void btnCompleteList_Click(object sender, EventArgs e) { if (_tc == null || lstFields.SelectedItems == null) { return; } string fieldName = lstFields.SelectedItem.ToString().Replace("[", String.Empty).Replace("]", String.Empty); // Joined Fields [...] IField field = _tc.FindField(fieldName); DistinctFilter filter = new DistinctFilter(field.name); lstUniqueValues.Items.Clear(); this.Cursor = Cursors.WaitCursor; ICursor cursor = await _tc.Search(filter); if (cursor == null) { return; } _cancelTracker.Reset(); BackgroundWorker bw = new BackgroundWorker(); bw.DoWork += new DoWorkEventHandler(CompleteList_DoWork); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(CompleteList_RunWorkerCompleted); bw.RunWorkerAsync(cursor); }
private void btnQuery_Click(object sender, EventArgs e) { if (_parent == null || _combo == null) { return; } if (_combo.ThemeMode == QueryThemeMode.Default) { _queryVal = cmbQueryText.Text; _queryField = cmbField.SelectedItem != null?cmbField.SelectedItem.ToString() : ""; _useWildcards = chkWildcards.Checked; _focusMap = _parent._doc != null ? _parent._doc.FocusMap : null; _mode = _parent.Mode; if (btnAllFields.Checked) { _searchType = SearchType.allfields; } else if (btnField.Checked) { _searchType = SearchType.field; } else if (btnDisplayField.Checked) { _searchType = SearchType.displayfield; } else { return; } if (!cmbQueryText.Items.Contains(_queryVal)) { cmbQueryText.Items.Add(_queryVal); } _cancelTracker.Reset(); btnQuery.Enabled = false; btnStop.Enabled = true; _worker.RunWorkerAsync(_parent.AllQueryableLayers); } else { if (_combo.UserDefinedQueries == null) { return; } foreach (QueryTheme theme in _combo.UserDefinedQueries.Queries) { if (theme.Text == lblQueryName.Text) { if (theme.PromptDef == null) { return; } _userdefValues = new Dictionary <int, string>(); foreach (DataRow row in theme.PromptDef.Rows) { foreach (Control ctrl in panelCustomFields.Controls) { if (ctrl.Name == "txt" + row["ID"].ToString()) { _userdefValues.Add((int)row["ID"], ctrl.Text); } } } _theme = theme; _focusMap = _parent._doc != null ? _parent._doc.FocusMap : null; _cancelTracker.Reset(); btnQuery.Enabled = false; btnStop.Enabled = true; _worker2.RunWorkerAsync(); } } } }