Пример #1
0
        private void DoSearch(IAppHelper helper)
        {
            statusLabel.Text = "Performing Search. Please Wait...";
            this.Cursor      = Cursors.WaitCursor;
            // use an app helper to locate information
            //helper = appHelperFactory.GetAppHelper(appHelper);
            AppHelperContext context = new SimpleAppHelperContext();

            context["title"] = txtMovieName.Text;
            AppHelperItem[] items = helper.LocateItems(context);

            statusLabel.Text = null;
            this.Cursor      = Cursors.Default;

            switch (items.Length)
            {
            case 0:
                MessageBox.Show("No Match Found for: " + txtMovieName.Text);
                break;

            case 1:
                AppHelperItemSelected(helper, items[0]);
                break;

            default:
                AppHelperResultSelector resultSelector = new AppHelperResultSelector(helper);
                resultSelector.ItemSelectedEvent += new AppHelperItemSelected(AppHelperItemSelected);
                resultSelector.Items              = items;
                resultSelector.Show();
                break;
            }
        }
Пример #2
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     string appHelperName = (string)drpHelperNames.SelectedItem;
     string contextFieldName = null;
     foreach (Control c in tblInputContext.Controls)
     {
         if (c is Label)
         {
             contextFieldName = c.Text;
         }
         else if (c is TextBox)
         {
             if (contextFieldName != null && c.Text.Length > 0)
                 context[contextFieldName] = c.Text;
             else if (contextFieldName != null)
                 context[contextFieldName] = null;
         }
     }
     helper = factory.GetAppHelper(appHelperName);
     drpResults.Controls.Clear();
     AppHelperItem []items = helper.LocateItems(context);
     foreach (AppHelperItem item in items)
     {
         drpResults.Items.Add(new ItemHolder(item));
     }
 }
Пример #3
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            string appHelperName    = (string)drpHelperNames.SelectedItem;
            string contextFieldName = null;

            foreach (Control c in tblInputContext.Controls)
            {
                if (c is Label)
                {
                    contextFieldName = c.Text;
                }
                else if (c is TextBox)
                {
                    if (contextFieldName != null && c.Text.Length > 0)
                    {
                        context[contextFieldName] = c.Text;
                    }
                    else if (contextFieldName != null)
                    {
                        context[contextFieldName] = null;
                    }
                }
            }
            helper = factory.GetAppHelper(appHelperName);
            drpResults.Controls.Clear();
            AppHelperItem [] items = helper.LocateItems(context);
            foreach (AppHelperItem item in items)
            {
                drpResults.Items.Add(new ItemHolder(item));
            }
        }
Пример #4
0
        private void DoSearch(IAppHelper helper)
        {
            statusLabel.Text = "Performing Search. Please Wait...";
            this.Cursor = Cursors.WaitCursor;
            // use an app helper to locate information
            //helper = appHelperFactory.GetAppHelper(appHelper);
            AppHelperContext context = new SimpleAppHelperContext();
            context["title"] = txtMovieName.Text;
            AppHelperItem[] items = helper.LocateItems(context);

            statusLabel.Text = null;
            this.Cursor = Cursors.Default;

            switch (items.Length)
            {
                case 0:
                    MessageBox.Show("No Match Found for: " + txtMovieName.Text);
                    break;
                case 1:
                    AppHelperItemSelected(helper, items[0]);
                    break;
                default:
                    AppHelperResultSelector resultSelector = new AppHelperResultSelector(helper);
                    resultSelector.ItemSelectedEvent += new AppHelperItemSelected(AppHelperItemSelected);
                    resultSelector.Items = items;
                    resultSelector.Show();
                    break;
            }
        }