Exemplo n.º 1
0
        /// <summary>
        /// Searches loaded files based on the specified search string.  Internally normalized to UpperInvariant
        /// </summary>
        /// <param name="searchString">string that we are searching for</param>
        private void Search(string searchString)
        {
            if (searchString == null || searchString.Trim().Count() == 0)
            {
                return;
            }

            var filter  = GetFilterFrom(searchString);
            var results = new List <Result>();

            this.SearchFiles(filter, results);

            if (results.Count < 1)
            {
                MessageBox.Show(
                    string.Format(CultureInfo.CurrentCulture, Resources.MainFormNoItemsFound, searchString),
                    Resources.MainFormNoItemsFound2,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information,
                    MessageBoxDefaultButton.Button1,
                    RightToLeftOptions);

                return;
            }

            // Display a dialog with the results.
            ResultsDialog dlg = new ResultsDialog();

            dlg.ResultChanged += new ResultsDialog.EventHandler <ResultChangedEventArgs>(this.SelectResult);
            dlg.ResultsList.Clear();
            dlg.ResultsList.AddRange(results);
            dlg.SearchString = searchString;
            ////dlg.ShowDialog();
            dlg.Show();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Searches loaded files based on the specified search string.  Internally normalized to UpperInvariant
        /// </summary>
        /// <param name="searchString">string that we are searching for</param>
        private void Search(string searchString)
        {
            if (string.IsNullOrWhiteSpace(searchString))
            {
                return;
            }

            var results = this.searchService.Search(searchString);

            if (results is null || !results.Any())
            {
                MessageBox.Show(
                    string.Format(CultureInfo.CurrentCulture, Resources.MainFormNoItemsFound, searchString),
                    Resources.MainFormNoItemsFound2,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information,
                    MessageBoxDefaultButton.Button1,
                    RightToLeftOptions);

                return;
            }

            // Display a dialog with the results.
            ResultsDialog dlg = this.ServiceProvider.GetService <ResultsDialog>();

            dlg.ResultChanged += new ResultsDialog.EventHandler <ResultChangedEventArgs>(this.SelectResult);
            dlg.ResultsList.Clear();
            dlg.ResultsList.AddRange(results);
            dlg.SearchString = searchString;
            dlg.Show();
        }
Exemplo n.º 3
0
		private void DisplayResults(string searchString, IEnumerable<Result> results)
		{
			if (results is null || !results.Any())
			{
				MessageBox.Show(
					string.Format(Resources.MainFormNoItemsFound, searchString)
					, Resources.MainFormNoItemsFound2
					, MessageBoxButtons.OK
					, MessageBoxIcon.Information
					, MessageBoxDefaultButton.Button1
					, RightToLeftOptions
				);
				return;
			}

			// Display a dialog with the results.
			ResultsDialog dlg = this.ServiceProvider.GetService<ResultsDialog>();
			dlg.ResultChanged += new ResultsDialog.EventHandler<ResultChangedEventArgs>(this.SelectResult);
			dlg.ResultsList.Clear();
			dlg.ResultsList.AddRange(results);
			dlg.SearchString = searchString;
			dlg.Show();
		}