Exemplo n.º 1
0
        private void searchInteractionClick(object sender, EventArgs e)
        {
            try
            {
                // let's see what we want to push through here.
                var m = new ENTRY_SEARCH();
                m.setSourceKeyVals(this.working_file.entryAddenda); // this should now contain the entry/addenda necessary.
                m.setSourceSearch(this.display_keys);
                m.ShowDialog();
                if (m.selectedKey != null)
                {
                    this.listBox1.ClearSelected();
                    var k1 = m.selectedKey; //
                    // I need to add a copy of my keyselection unit to this module - which will be fine.
                    // add a simplification step to this, where we can call it from the parent program.
                    //this.listBox1.SelectedItem = m.selectedKey; // okay - so m.selectedkey is my current tuple - but my listbox uses a string representation
                    try
                    {
                        var k2 = this.getDisplayKeyFromValue(k1); // I think this should work.
                        this.listBox1.SelectedItem = k2;          // we'll try this.
                    }
                    catch
                    {
                    }
//                    this.listBox1.SelectedItems.Add(m.selectedKey); // this should work.
                    // okay - this is where I'm hitting the error - let's look further into ListBoxItemClick;
                    ListBoxItemClick(sender, e); // should update the display.

                    // limit the immediate execution to only if selected by a user to do so.
                    if (Program.AUTOMATICALLY_OPEN_SEARCHED_ENTRY)
                    {
                        ButtonObjectClick(this.button1, e); // send this event.
                    }
                }
                else
                {
                    Console.WriteLine("Looks like something happened here...");
                }
            }
            catch (Exception ex)
            {
                // Don't do anything but clear out I guess.
#if DEBUG
                Console.WriteLine(ex);
#endif
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Accessor method for the search_view object;
 /// </summary>
 /// <param name="search"></param>
 public void set_view(ENTRY_SEARCH search)
 {
     search_view = search;
 }