示例#1
0
        /// <summary>
        /// Generate and perform a search for the currently selected table's column list.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ViewColumnsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var selected = tableSearchResults.SelectedItems.OfType <ListViewItem>().SingleOrDefault();

            if (selected != null)
            {
                var searchResult = selected.Tag as TableSearchResult;
                searchBox.Text = SearchParser.GenerateSearch(searchResult.Database, searchResult.Schema, searchResult.Table, null, null);
                await PerformSearch();
            }
        }
示例#2
0
        private async Task PerformSearch()
        {
            if (_searchDisabled)
            {
                return;
            }

            if (_repo.ConnectionString != GetConnectionString(serverName.Text))
            {
                bool serverNameCorrect = await NewRepo();

                if (!serverNameCorrect)
                {
                    return;
                }
            }
            Search search = SearchParser.Parse(searchBox.Text);

            if (search == null)
            {
                MessageBox.Show("Invalid Search Terms");
                return;
            }

            Lock("Searching...");
            try
            {
                SearchResultViewModel result = await Task.Run(() => search.Execute(_repo));

                RenderResults(result);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error performing query: " + ex.Message, "Query Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Unlock();
            }
        }