search logic

This commit is contained in:
2009-02-04 19:51:36 +00:00
parent 408ba2ff26
commit ddc6a34966
11 changed files with 1964 additions and 1919 deletions

View File

@@ -35,32 +35,32 @@ namespace Volian.Controls.Library
#region Events
private void cbAnnoType_SelectedValueChanged(object sender, EventArgs e)
{
UpdateAnnotationSearchResults();
UpdateAnnotationSearchResults();
}
private void lbResults_SelectedValueChanged(object sender, EventArgs e)
{
if (!_LoadingList)
{
_AnnotationDetails.CurrentAnnotation = lbResults.SelectedValue as AnnotationInfo;
if (_AnnotationDetails.CurrentAnnotation != null)
_TabControl.OpenItem(_AnnotationDetails.CurrentAnnotation.MyItem); // open the corresponding procedure text
_AnnotationDetails.FindCurrentAnnotation(); // position to corresponding row in annotation grid
}
}
private void lbResults_SelectedValueChanged(object sender, EventArgs e)
{
if (!_LoadingList)
{
_AnnotationDetails.CurrentAnnotation = lbResults.SelectedValue as AnnotationInfo;
if (_AnnotationDetails.CurrentAnnotation != null)
_TabControl.OpenItem(_AnnotationDetails.CurrentAnnotation.MyItem); // open the corresponding procedure text
_AnnotationDetails.FindCurrentAnnotation(); // position to corresponding row in annotation grid
}
}
private int LastResultsMouseOverIndex = -1;
private void lbResults_MouseMove(object sender, MouseEventArgs e)
{
int ResultsMouseOverIndex = lbResults.IndexFromPoint(e.Location);
if (ResultsMouseOverIndex != -1 && ResultsMouseOverIndex != LastResultsMouseOverIndex)
{
AnnotationInfo ai = lbResults.Items[ResultsMouseOverIndex] as AnnotationInfo;
toolTip1.SetToolTip(lbResults, ai.MyItem.Path); // display location of corresponding procedure text in a tooltip
LastResultsMouseOverIndex = ResultsMouseOverIndex;
}
private int LastResultsMouseOverIndex = -1;
private void lbResults_MouseMove(object sender, MouseEventArgs e)
{
int ResultsMouseOverIndex = lbResults.IndexFromPoint(e.Location);
if (ResultsMouseOverIndex != -1 && ResultsMouseOverIndex != LastResultsMouseOverIndex)
{
AnnotationInfo ai = lbResults.Items[ResultsMouseOverIndex] as AnnotationInfo;
toolTip1.SetToolTip(lbResults, ai.MyItem.Path); // display location of corresponding procedure text in a tooltip
LastResultsMouseOverIndex = ResultsMouseOverIndex;
}
}
}
#endregion
#region LoadControlData
@@ -69,22 +69,22 @@ namespace Volian.Controls.Library
_AnnotationDetails = annotationDetails;
cbAnnoType.DisplayMember = "Name";
cbAnnoType.DataSource = AnnotationTypeInfoList.Get();
lbResults.MouseMove += new MouseEventHandler(lbResults_MouseMove);
lbResults.MouseMove += new MouseEventHandler(lbResults_MouseMove);
_TabControl = tc;
}
#endregion
#region VariousSupportMethods
public void UpdateAnnotationSearchResults()
{
AnnotationTypeInfo ati = cbAnnoType.SelectedValue as AnnotationTypeInfo;
_LoadingList = true;
lbResults.DisplayMember = "SearchText";
lbResults.DataSource = ati.AnnotationTypeAnnotations;
lbResults.SelectedIndex = -1;
LastResultsMouseOverIndex = -1;
_LoadingList = false;
}
public void UpdateAnnotationSearchResults()
{
AnnotationTypeInfo ati = cbAnnoType.SelectedValue as AnnotationTypeInfo;
_LoadingList = true;
lbResults.DisplayMember = "SearchText";
lbResults.DataSource = ati.AnnotationTypeAnnotations;
lbResults.SelectedIndex = -1;
LastResultsMouseOverIndex = -1;
_LoadingList = false;
}
#endregion
}