- Added feature to save search criteria into settings
- Bug Fix - when results list is changed due to a delete or edit, the results selection is cleared - If a search criteria is selected from the list, the selected criteria is placed at the top of the list - Limit the number of search criteria to 10. We may want this to be a user configurable number.
This commit is contained in:
parent
147dd8919c
commit
4a977ce48d
@ -29,15 +29,22 @@ namespace Volian.Controls.Library
|
|||||||
private Color saveGpFindROsColor;
|
private Color saveGpFindROsColor;
|
||||||
private Color saveGrpPanSearchResults;
|
private Color saveGrpPanSearchResults;
|
||||||
private ItemInfoList _SearchResults;
|
private ItemInfoList _SearchResults;
|
||||||
public ItemInfoList SearchResults
|
public ItemInfoList SearchResults
|
||||||
{
|
{
|
||||||
get { return _SearchResults; }
|
get { return _SearchResults; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_SearchResults = value;
|
_SearchResults = value;
|
||||||
DisplayResults();
|
if (value != null) // Don't select an item from the list when it is updated
|
||||||
}
|
_SearchResults.ListChanged += new ListChangedEventHandler(_SearchResults_ListChanged);
|
||||||
}
|
DisplayResults();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void _SearchResults_ListChanged(object sender, ListChangedEventArgs e)
|
||||||
|
{
|
||||||
|
lbSrchResults.SelectedIndex = -1; // Don't select an item from the new list
|
||||||
|
}
|
||||||
|
|
||||||
private string _DisplayMember = "SearchPath";
|
private string _DisplayMember = "SearchPath";
|
||||||
|
|
||||||
//public string Status
|
//public string Status
|
||||||
@ -118,12 +125,23 @@ namespace Volian.Controls.Library
|
|||||||
gpSrchAnnoText.Enabled = true;
|
gpSrchAnnoText.Enabled = true;
|
||||||
cmbResultsStyle.Enabled = false;
|
cmbResultsStyle.Enabled = false;
|
||||||
}
|
}
|
||||||
|
private void LoadSearchTextListBox()
|
||||||
private void LoadSearchTextListBox()
|
{
|
||||||
{
|
// Setup SearchText Combo
|
||||||
cbxTextSearchText.Items.Clear();
|
cbxTextSearchText.Items.Clear();
|
||||||
cbxTextSearchAnnotation.Items.Clear();
|
if (Properties.Settings.Default["SearchList"] != null && Properties.Settings.Default.SearchList.Count > 0)
|
||||||
}
|
{
|
||||||
|
foreach (string str in Properties.Settings.Default.SearchList)
|
||||||
|
cbxTextSearchText.Items.Add(str);
|
||||||
|
}
|
||||||
|
// Setup SearchAnnotation Combo
|
||||||
|
cbxTextSearchAnnotation.Items.Clear();
|
||||||
|
if (Properties.Settings.Default["SearchAList"] != null && Properties.Settings.Default.SearchAList.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (string str in Properties.Settings.Default.SearchAList)
|
||||||
|
cbxTextSearchAnnotation.Items.Add(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void advTreeStepTypesFillIn()
|
public void advTreeStepTypesFillIn()
|
||||||
{
|
{
|
||||||
@ -600,37 +618,37 @@ namespace Volian.Controls.Library
|
|||||||
LastResultsMouseOverIndex = ResultsMouseOverIndex;
|
LastResultsMouseOverIndex = ResultsMouseOverIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void lbSrchResults_SelectedValueChanged(object sender, EventArgs e)
|
||||||
private void lbSrchResults_SelectedValueChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_LoadingList) return;
|
|
||||||
ItemInfoList iil = lbSrchResults.DataSource as ItemInfoList;
|
|
||||||
// iil will be null for a sorted list, so only check RefreshingList for ItemInfoList
|
|
||||||
if(iil == null || !iil.RefreshingList)
|
|
||||||
{
|
|
||||||
_ItemInfo = lbSrchResults.SelectedValue as ItemInfo;
|
|
||||||
if ((tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[1]) && (_ItemInfo != null))
|
|
||||||
{
|
{
|
||||||
_AnnotationDetails.CurrentAnnotation = AnnotationInfo.Get(_ItemInfo.SearchAnnotationID);
|
if (_LoadingList) return;
|
||||||
if (_AnnotationDetails.CurrentAnnotation != null)
|
// If the list is being refreshed, then set the selection index to -1 (no selection)
|
||||||
_TabControl.OpenItem(_AnnotationDetails.CurrentAnnotation.MyItem); // open the corresponding procedure text
|
if (_SearchResults.RefreshingList && lbSrchResults.SelectedIndex != -1)
|
||||||
_AnnotationDetails.FindCurrentAnnotation(); // position to corresponding row in annotation grid
|
lbSrchResults.SelectedIndex = -1;
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
if (_ItemInfo != null)
|
|
||||||
{
|
{
|
||||||
_OpenDocFromSearch = true;
|
_ItemInfo = lbSrchResults.SelectedValue as ItemInfo;
|
||||||
DisplayTabItem dti = _TabControl.OpenItem(_ItemInfo); // open the corresponding procedure text
|
if ((tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[1]) && (_ItemInfo != null))
|
||||||
if (dti.MyDSOTabPanel != null)
|
{
|
||||||
dti.MyDSOTabPanel.SearchString = _strSrchText; // this.cbxTextSearchText.Text;
|
_AnnotationDetails.CurrentAnnotation = AnnotationInfo.Get(_ItemInfo.SearchAnnotationID);
|
||||||
if (dti.MyStepTabPanel != null)
|
if (_AnnotationDetails.CurrentAnnotation != null)
|
||||||
dti.MyStepTabPanel.SearchString = _strSrchText; // this.cbxTextSearchText.Text;
|
_TabControl.OpenItem(_AnnotationDetails.CurrentAnnotation.MyItem); // open the corresponding procedure text
|
||||||
_OpenDocFromSearch = false;
|
_AnnotationDetails.FindCurrentAnnotation(); // position to corresponding row in annotation grid
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_ItemInfo != null)
|
||||||
|
{
|
||||||
|
_OpenDocFromSearch = true;
|
||||||
|
DisplayTabItem dti = _TabControl.OpenItem(_ItemInfo); // open the corresponding procedure text
|
||||||
|
if (dti.MyDSOTabPanel != null)
|
||||||
|
dti.MyDSOTabPanel.SearchString = _strSrchText; // this.cbxTextSearchText.Text;
|
||||||
|
if (dti.MyStepTabPanel != null)
|
||||||
|
dti.MyStepTabPanel.SearchString = _strSrchText; // this.cbxTextSearchText.Text;
|
||||||
|
_OpenDocFromSearch = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cmbResultsStyle_SelectedValueChanged(object sender, EventArgs e)
|
private void cmbResultsStyle_SelectedValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -887,15 +905,23 @@ namespace Volian.Controls.Library
|
|||||||
InsertSearchCriteria();
|
InsertSearchCriteria();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InsertSearchCriteria()
|
private void InsertSearchCriteria()
|
||||||
{
|
|
||||||
if (!cbxTextSearchText.Text.Equals(string.Empty))
|
|
||||||
{
|
{
|
||||||
string tstr = cbxTextSearchText.Text;
|
if (!cbxTextSearchText.Text.Equals(string.Empty))
|
||||||
if (!cbxTextSearchText.Items.Contains(tstr))
|
{
|
||||||
|
string tstr = cbxTextSearchText.Text;
|
||||||
|
// if its already exists in the list - remove it
|
||||||
|
if (cbxTextSearchText.Items.Contains(tstr))
|
||||||
|
cbxTextSearchText.Items.Remove(tstr);
|
||||||
|
// Add the new criteria to the top of the list
|
||||||
cbxTextSearchText.Items.Insert(0, tstr);
|
cbxTextSearchText.Items.Insert(0, tstr);
|
||||||
|
// set the text to the new criteria
|
||||||
|
cbxTextSearchText.Text = tstr;
|
||||||
|
// If there are more than 10 remove the last one
|
||||||
|
if (cbxTextSearchText.Items.Count > 10)
|
||||||
|
cbxTextSearchText.Items.RemoveAt(10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void cbxSrchTypeUsage_CheckedChanged(object sender, EventArgs e)
|
private void cbxSrchTypeUsage_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -1313,7 +1339,6 @@ namespace Volian.Controls.Library
|
|||||||
cbxAnnoTypes.Focus();
|
cbxAnnoTypes.Focus();
|
||||||
cbxBooleanAnoTxtSrch_CheckedChanged(sender, e);
|
cbxBooleanAnoTxtSrch_CheckedChanged(sender, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Annoation Search Type Class
|
#region Annoation Search Type Class
|
||||||
|
Loading…
x
Reference in New Issue
Block a user