- Added Print Function (Event)
- Added code to Resize Tree as Tree Nodes are expanded and collapsed - Sorts ROs by value - Added button to Clear Search Results - Added button to Copy Search Results to Clipboard - Split BuildSearchString into separate Parameters - Added Print Function - Added button to Clear Search Results - Added button to Copy Search Results to Clipboard
This commit is contained in:
parent
d0ec2bab6f
commit
cfedc831ba
699
PROMS/Volian.Controls.Library/DisplaySearch.Designer.cs
generated
699
PROMS/Volian.Controls.Library/DisplaySearch.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -9,11 +9,20 @@ using VEPROMS.CSLA.Library;
|
|||||||
using DevComponents.DotNetBar;
|
using DevComponents.DotNetBar;
|
||||||
using DevComponents.AdvTree;
|
using DevComponents.AdvTree;
|
||||||
using Volian.Base.Library;
|
using Volian.Base.Library;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Volian.Controls.Library
|
namespace Volian.Controls.Library
|
||||||
{
|
{
|
||||||
public partial class DisplaySearch : UserControl
|
public partial class DisplaySearch : UserControl
|
||||||
{
|
{
|
||||||
|
#region Events
|
||||||
|
public event DisplaySearchEvent PrintRequest;
|
||||||
|
private void OnPrintRequest(DisplaySearchEventArgs args)
|
||||||
|
{
|
||||||
|
if (PrintRequest != null)
|
||||||
|
PrintRequest(this, args);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
#region Properties
|
#region Properties
|
||||||
private string _strSrchText = "";
|
private string _strSrchText = "";
|
||||||
private List<DocVersionInfo> lstCheckedDocVersions = new List<DocVersionInfo>();
|
private List<DocVersionInfo> lstCheckedDocVersions = new List<DocVersionInfo>();
|
||||||
@ -423,7 +432,9 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
if (_MyROFSTLookup == null) return;
|
if (_MyROFSTLookup == null) return;
|
||||||
cmboTreeROs.Nodes.Clear();
|
cmboTreeROs.Nodes.Clear();
|
||||||
this.cmboTreeROs.AdvTree.BeforeExpand += new DevComponents.AdvTree.AdvTreeNodeCancelEventHandler(this.cmboTreeROs_BeforeSelectNode);
|
this.cmboTreeROs.AdvTree.BeforeExpand += new DevComponents.AdvTree.AdvTreeNodeCancelEventHandler(this.cmboTreeROs_BeforeExpand);
|
||||||
|
cmboTreeROs.AdvTree.AfterExpand += new AdvTreeNodeEventHandler(AdvTree_AfterExpandorCollapse);
|
||||||
|
cmboTreeROs.AdvTree.AfterCollapse += new AdvTreeNodeEventHandler(AdvTree_AfterExpandorCollapse);
|
||||||
for (int i = 0; i < _MyROFSTLookup.myHdr.myDbs.Length; i++)
|
for (int i = 0; i < _MyROFSTLookup.myHdr.myDbs.Length; i++)
|
||||||
{
|
{
|
||||||
DevComponents.AdvTree.Node tn = new DevComponents.AdvTree.Node();
|
DevComponents.AdvTree.Node tn = new DevComponents.AdvTree.Node();
|
||||||
@ -433,7 +444,45 @@ namespace Volian.Controls.Library
|
|||||||
AddDummyGroup(_MyROFSTLookup.myHdr.myDbs[i], tn);
|
AddDummyGroup(_MyROFSTLookup.myHdr.myDbs[i], tn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void AdvTree_AfterExpandorCollapse(object sender, AdvTreeNodeEventArgs e)
|
||||||
|
{
|
||||||
|
Node bottomNode = BottomTreeNode(cmboTreeROs.AdvTree.Nodes);
|
||||||
|
Node lastNode = cmboTreeROs.AdvTree.Nodes[cmboTreeROs.AdvTree.Nodes.Count - 1];
|
||||||
|
int top = cmboTreeROs.AdvTree.Nodes[0].Bounds.Top;
|
||||||
|
int bottom = bottomNode.Bounds.Bottom + 5;
|
||||||
|
int hScrollBarHeight = cmboTreeROs.AdvTree.HScrollBar != null ? cmboTreeROs.AdvTree.HScrollBar.Height : 0;
|
||||||
|
bottom = bottomNode.Bounds.Bottom + 5;
|
||||||
|
cmboTreeROs.AdvTree.Size = new Size(cmboTreeROs.AdvTree.Size.Width, Math.Min(525, bottom - top + hScrollBarHeight));
|
||||||
|
if (cmboTreeROs.AdvTree.VScrollBar != null && bottom < cmboTreeROs.AdvTree.Size.Height)
|
||||||
|
{
|
||||||
|
int yLookFor = (bottom - cmboTreeROs.AdvTree.Size.Height) + 2 * hScrollBarHeight;
|
||||||
|
Node topNode = FindTreeNodeAt(cmboTreeROs.AdvTree.Nodes, yLookFor);
|
||||||
|
if (topNode != null)
|
||||||
|
topNode.EnsureVisible();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private Node FindTreeNodeAt(NodeCollection nodes, int y)
|
||||||
|
{
|
||||||
|
foreach (Node node in nodes)
|
||||||
|
{
|
||||||
|
if (node.Bounds.Top <= y && node.Bounds.Bottom >= y)
|
||||||
|
return node;
|
||||||
|
if (node.Bounds.Top > y)
|
||||||
|
{
|
||||||
|
if (node.PrevNode != null && node.PrevNode.Expanded)
|
||||||
|
return FindTreeNodeAt(node.PrevNode.Nodes, y);
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
private Node BottomTreeNode(NodeCollection nodes)
|
||||||
|
{
|
||||||
|
Node bottomNode = nodes[nodes.Count - 1]; // Return bottom node in collection
|
||||||
|
if (bottomNode.Expanded) // If expanded return bottom child
|
||||||
|
return BottomTreeNode(bottomNode.Nodes);
|
||||||
|
return bottomNode;
|
||||||
|
}
|
||||||
private void AddDummyGroup(ROFSTLookup.rodbi rodbi, DevComponents.AdvTree.Node tn)
|
private void AddDummyGroup(ROFSTLookup.rodbi rodbi, DevComponents.AdvTree.Node tn)
|
||||||
{
|
{
|
||||||
if (rodbi.children != null && rodbi.children.Length > 0)
|
if (rodbi.children != null && rodbi.children.Length > 0)
|
||||||
@ -443,9 +492,7 @@ namespace Volian.Controls.Library
|
|||||||
tn.Nodes.Add(tmp);
|
tn.Nodes.Add(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void cmboTreeROs_BeforeExpand(object sender, DevComponents.AdvTree.AdvTreeNodeCancelEventArgs e)
|
||||||
|
|
||||||
private void cmboTreeROs_BeforeSelectNode(object sender, DevComponents.AdvTree.AdvTreeNodeCancelEventArgs e)
|
|
||||||
{
|
{
|
||||||
LoadChildren(e.Node);
|
LoadChildren(e.Node);
|
||||||
}
|
}
|
||||||
@ -501,13 +548,39 @@ namespace Volian.Controls.Library
|
|||||||
tmp = new DevComponents.AdvTree.Node();
|
tmp = new DevComponents.AdvTree.Node();
|
||||||
tmp.Text = chld[i].title;
|
tmp.Text = chld[i].title;
|
||||||
tmp.Tag = chld[i];
|
tmp.Tag = chld[i];
|
||||||
tn.Nodes.Add(tmp);
|
int index = FindIndex(tn.Nodes, tmp.Text);
|
||||||
|
tn.Nodes.Insert(index,tmp);
|
||||||
|
//tn.Nodes.Add(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ProgressBar_Clear();
|
ProgressBar_Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int FindIndex(NodeCollection nodes, string value)
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
foreach (Node node in nodes)
|
||||||
|
{
|
||||||
|
if (GreaterValue(node.Text, value)) return index;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
private static Regex _RegExGetNumber = new Regex(@"^ *[+-]?[.,0-9]+(E[+-]?[0-9]+)?");
|
||||||
|
private bool GreaterValue(string value1, string value2)
|
||||||
|
{
|
||||||
|
Match match1 = _RegExGetNumber.Match(value1);
|
||||||
|
Match match2 = _RegExGetNumber.Match(value2);
|
||||||
|
if (match1.Success && match2.Success) // Compare the numeric value
|
||||||
|
{
|
||||||
|
double dbl1 = double.Parse(match1.ToString());
|
||||||
|
double dbl2 = double.Parse(match2.ToString());
|
||||||
|
return dbl1 > dbl2;
|
||||||
|
}
|
||||||
|
return String.Compare( value1,value2,true) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
private void cmboTreeROs_SelectedIndexChanged(object sender, EventArgs e)
|
private void cmboTreeROs_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (cmboTreeROs.SelectedIndex == -1 || cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rodbi)
|
if (cmboTreeROs.SelectedIndex == -1 || cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rodbi)
|
||||||
@ -633,11 +706,15 @@ namespace Volian.Controls.Library
|
|||||||
if (lbSrchResults.Items.Count > 0)
|
if (lbSrchResults.Items.Count > 0)
|
||||||
{
|
{
|
||||||
btnPrnSrchRslts.Enabled = true;
|
btnPrnSrchRslts.Enabled = true;
|
||||||
|
btnClearSearchResults.Enabled = true;
|
||||||
|
btnCopySearchResults.Enabled = true;
|
||||||
cmbResultsStyle.Enabled = true;
|
cmbResultsStyle.Enabled = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
btnPrnSrchRslts.Enabled = false;
|
btnPrnSrchRslts.Enabled = false;
|
||||||
|
btnClearSearchResults.Enabled = false;
|
||||||
|
btnCopySearchResults.Enabled = false;
|
||||||
cmbResultsStyle.Enabled = false;
|
cmbResultsStyle.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -731,39 +808,35 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
DisplayResults();
|
DisplayResults();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void panSearchButtons_MouseDoubleClick(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult dr = MessageBox.Show("Michelle,\n\n Do you want to clear this Search List?", "For Michelle...", MessageBoxButtons.YesNo);
|
|
||||||
if (dr == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
lbSrchResults.DataSource = null;
|
|
||||||
_SearchResults = null;
|
|
||||||
DisplayResults();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Search
|
#region Search
|
||||||
private string[] BuildSearchString()
|
private string DVISearchList
|
||||||
|
{
|
||||||
|
get
|
||||||
{
|
{
|
||||||
_strSrchText = ""; // used when jumping to a section from the results window
|
|
||||||
// the search query needs '<DocVerID>,...<DocVerID>','<StepTypeID>,...,<StepTypeID>','<TextToSearch>'
|
|
||||||
string[] strRtnStr = { "", "", "" };
|
|
||||||
// append list of document versions to search
|
// append list of document versions to search
|
||||||
if (lstCheckedDocVersions.Count > 0)
|
if (lstCheckedDocVersions.Count > 0)
|
||||||
{
|
{
|
||||||
|
string strRtnStr = "";
|
||||||
// get list of doc versions to search
|
// get list of doc versions to search
|
||||||
foreach (DocVersionInfo dvi in lstCheckedDocVersions)
|
foreach (DocVersionInfo dvi in lstCheckedDocVersions)
|
||||||
{
|
{
|
||||||
strRtnStr[0] += string.Format("{0},", dvi.VersionID.ToString());
|
strRtnStr += string.Format(",{0}", dvi.VersionID.ToString());
|
||||||
}
|
}
|
||||||
strRtnStr[0] = strRtnStr[0].Remove(strRtnStr[0].LastIndexOf(','), 1);
|
return strRtnStr.Substring(1);
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string TypeSearchList
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
// append list of step types to search
|
// append list of step types to search
|
||||||
if (lstCheckedStepTypes.Count > 0)
|
if (lstCheckedStepTypes.Count > 0)
|
||||||
{
|
{
|
||||||
|
string strRtnStr = "";
|
||||||
// get list of selected types
|
// get list of selected types
|
||||||
foreach (int typ in lstCheckedStepTypes)
|
foreach (int typ in lstCheckedStepTypes)
|
||||||
{
|
{
|
||||||
@ -772,22 +845,36 @@ namespace Volian.Controls.Library
|
|||||||
tmp = 10000; // this is the accessory page type
|
tmp = 10000; // this is the accessory page type
|
||||||
else
|
else
|
||||||
tmp += 20000; // step/substep types
|
tmp += 20000; // step/substep types
|
||||||
strRtnStr[1] += string.Format("{0},", tmp);
|
strRtnStr += string.Format(",{0}", tmp);
|
||||||
}
|
}
|
||||||
strRtnStr[1] = strRtnStr[1].Remove(strRtnStr[1].LastIndexOf(','), 1);
|
return strRtnStr.Substring(1);
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string TextSearchString
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[0])
|
if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[0])
|
||||||
{ // Text Search
|
return ConvertSpecialChars(cbxTextSearchText.Text);//string.Format("{0}", cbxTextSearchText.Text);
|
||||||
_strSrchText = ConvertSpecialChars(cbxTextSearchText.Text);//string.Format("{0}", cbxTextSearchText.Text);
|
return "";
|
||||||
strRtnStr[2] += _strSrchText; // append text to search
|
|
||||||
//strRtnStr[2] += ConvertSpecialChars(cbxTextSearchText.Text);//string.Format("{0}", cbxTextSearchText.Text); // append text to search
|
|
||||||
}
|
}
|
||||||
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[1])
|
|
||||||
{ // Annotation Search
|
|
||||||
strRtnStr[2] += ((AnnotationTypeSearch)cbxAnnoTypes.SelectedValue).ID;
|
|
||||||
}
|
}
|
||||||
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[2])
|
private string AnnotationSearchType
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[1])
|
||||||
|
return ((AnnotationTypeSearch)cbxAnnoTypes.SelectedValue).ID;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string ROSearchList
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[2])
|
||||||
{ // RO Search
|
{ // RO Search
|
||||||
ROFSTLookup.rochild[] chld = null;
|
ROFSTLookup.rochild[] chld = null;
|
||||||
ROFSTLookup.rochild ch;
|
ROFSTLookup.rochild ch;
|
||||||
@ -797,29 +884,29 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
ch = (ROFSTLookup.rochild)cmboTreeROs.SelectedNode.Tag;
|
ch = (ROFSTLookup.rochild)cmboTreeROs.SelectedNode.Tag;
|
||||||
_strSrchText = string.Format("{0}", ch.value);
|
_strSrchText = string.Format("{0}", ch.value);
|
||||||
strRtnStr[2] += _strSrchText; // append RO Value text to search
|
return _strSrchText; // append RO Value text to search
|
||||||
//strRtnStr[2] += string.Format("{0}", ch.value); // append RO Value text to search
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rodbi)
|
if (cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rodbi)
|
||||||
{
|
{
|
||||||
ROFSTLookup.rodbi db = (ROFSTLookup.rodbi)cmboTreeROs.SelectedNode.Tag;
|
ROFSTLookup.rodbi db = (ROFSTLookup.rodbi)cmboTreeROs.SelectedNode.Tag;
|
||||||
strRtnStr[2] += _MyRODbID.ToString() + ":" + string.Format("{0}", db.dbiID.ToString("D4"));
|
return _MyRODbID.ToString() + ":" + string.Format("{0}", db.dbiID.ToString("D4"));
|
||||||
}
|
}
|
||||||
else if (cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rochild)
|
else if (cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rochild)
|
||||||
{
|
{
|
||||||
ch = (ROFSTLookup.rochild)cmboTreeROs.SelectedNode.Tag;
|
ch = (ROFSTLookup.rochild)cmboTreeROs.SelectedNode.Tag;
|
||||||
chld = ch.children;
|
chld = ch.children;
|
||||||
// build a list of ROs to search
|
// build a list of ROs to search
|
||||||
strRtnStr[2] += _MyRODbID.ToString() + ":" + GetROsToSearch(chld);
|
return _MyRODbID.ToString() + ":" + GetROsToSearch(chld);
|
||||||
if (strRtnStr[2].EndsWith(","))
|
//if (strRtnStr.EndsWith(","))
|
||||||
strRtnStr[2] = strRtnStr[2].Substring(0, strRtnStr[2].Length - 1);
|
// strRtnStr = strRtnStr.Substring(0, strRtnStr.Length - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return strRtnStr;
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ConvertSpecialChars(string str)
|
private string ConvertSpecialChars(string str)
|
||||||
@ -868,12 +955,9 @@ namespace Volian.Controls.Library
|
|||||||
Cursor savcursor = Cursor;
|
Cursor savcursor = Cursor;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] strSearchText = null;
|
|
||||||
lbSrchResults.DataSource = null;
|
lbSrchResults.DataSource = null;
|
||||||
lbSrchResults.Items.Clear();
|
lbSrchResults.Items.Clear();
|
||||||
toolTip1.SetToolTip(lbSrchResults, null);
|
toolTip1.SetToolTip(lbSrchResults, null);
|
||||||
|
|
||||||
strSearchText = BuildSearchString();
|
|
||||||
Cursor = Cursors.WaitCursor;
|
Cursor = Cursors.WaitCursor;
|
||||||
SearchResults = null;
|
SearchResults = null;
|
||||||
bool includeRTFformat = false;
|
bool includeRTFformat = false;
|
||||||
@ -891,43 +975,51 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SearchResults = ItemInfoList.GetListFromTextSearch(strSearchText[0], strSearchText[1], "", cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, ItemSearchIncludeLinks.Value, includeRTFformat, includeSpecialChars);
|
ReportTitle = "PROMS2010 - Search by Type";
|
||||||
|
SearchString = null;
|
||||||
|
SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, "", cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, ItemSearchIncludeLinks.Value, includeRTFformat, includeSpecialChars);
|
||||||
cmbResultsStyle.SelectedIndex = 1; //display step locations in results
|
cmbResultsStyle.SelectedIndex = 1; //display step locations in results
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (strSearchText[2].Equals(""))
|
//if (textSearchString.Equals(""))
|
||||||
{
|
//{
|
||||||
MessageBox.Show("Please enter some search text, then click the Search button", "No Search Text");
|
// MessageBox.Show("Please enter some search text, then click the Search button", "No Search Text");
|
||||||
cbxTextSearchText.Focus();
|
// cbxTextSearchText.Focus();
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
SearchResults = ItemInfoList.GetListFromTextSearch(strSearchText[0], strSearchText[1], strSearchText[2], cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxIncROTextSrch.Checked ? ItemSearchIncludeLinks.Value : ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars);
|
ReportTitle = string.Format("PROMS2010 - {0} Search for '{1}'",cbxBooleanTxtSrch.Checked ? "Boolean" : "Text", TextSearchString);
|
||||||
|
SearchString = TextSearchString;
|
||||||
|
SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, TextSearchString, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxIncROTextSrch.Checked ? ItemSearchIncludeLinks.Value : ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars);
|
||||||
cmbResultsStyle.SelectedIndex = 3; // display step text in results
|
cmbResultsStyle.SelectedIndex = 3; // display step text in results
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[1]) // Annotation Search
|
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[1]) // Annotation Search
|
||||||
{
|
{
|
||||||
|
SearchString = null;
|
||||||
|
ReportTitle = string.Format("PROMS2010 - Annotation Search for '{0}'", cbxTextSearchAnnotation.Text);
|
||||||
//string srchStr = ConvertSpecialChars(cbxTextSearchAnnotation.Text);//cbxTextSearchAnnotation.Text;
|
//string srchStr = ConvertSpecialChars(cbxTextSearchAnnotation.Text);//cbxTextSearchAnnotation.Text;
|
||||||
|
|
||||||
//SearchResults = ItemInfoList.GetListFromAnnotationSearch(strSearchText[0], strSearchText[1], strSearchText[2], srchStr, cbxCaseSensitiveAnnoText.Checked);
|
//SearchResults = ItemInfoList.GetListFromAnnotationSearch(dviSearchList, typeSearchList, textSearchString, srchStr, cbxCaseSensitiveAnnoText.Checked);
|
||||||
SearchResults = ItemInfoList.GetListFromAnnotationSearch(strSearchText[0], strSearchText[1], strSearchText[2], cbxTextSearchAnnotation.Text, cbxCaseSensitiveAnnoText.Checked);
|
SearchResults = ItemInfoList.GetListFromAnnotationSearch(DVISearchList, TypeSearchList, AnnotationSearchType, cbxTextSearchAnnotation.Text, cbxCaseSensitiveAnnoText.Checked);
|
||||||
//UpdateAnnotationSearchResults();
|
//UpdateAnnotationSearchResults();
|
||||||
cmbResultsStyle.SelectedIndex = 2; // display annotation text in results
|
cmbResultsStyle.SelectedIndex = 2; // display annotation text in results
|
||||||
}
|
}
|
||||||
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[2]) // RO Search
|
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[2]) // RO Search
|
||||||
{
|
{
|
||||||
|
SearchString = null;
|
||||||
|
ReportTitle = "PROMS2010 - Referenced Object Search";
|
||||||
if (cbxFndUnLnkROVals.Enabled && cbxFndUnLnkROVals.Checked)
|
if (cbxFndUnLnkROVals.Enabled && cbxFndUnLnkROVals.Checked)
|
||||||
{
|
{
|
||||||
SearchResults = ItemInfoList.GetListFromTextSearch(strSearchText[0], strSearchText[1], strSearchText[2], cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars);
|
SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, ROSearchList, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars);
|
||||||
cmbResultsStyle.SelectedIndex = 3; // display step text in results
|
cmbResultsStyle.SelectedIndex = 3; // display step text in results
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SearchResults = ItemInfoList.GetListFromROSearch(strSearchText[0], strSearchText[1], strSearchText[2]);
|
SearchResults = ItemInfoList.GetListFromROSearch(DVISearchList, TypeSearchList, ROSearchList);
|
||||||
cmbResultsStyle.SelectedIndex = 3; // display step text in results
|
cmbResultsStyle.SelectedIndex = 3; // display step text in results
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1286,7 +1378,6 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void buttonItem2_Click(object sender, EventArgs e)
|
private void buttonItem2_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (cbxTextSearchAnnotation.Focused)
|
if (cbxTextSearchAnnotation.Focused)
|
||||||
@ -1295,7 +1386,6 @@ namespace Volian.Controls.Library
|
|||||||
cbxTextSearchText.SelectedText = "*";
|
cbxTextSearchText.SelectedText = "*";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonItem3_Click(object sender, EventArgs e)
|
private void buttonItem3_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (cbxTextSearchAnnotation.Focused)
|
if (cbxTextSearchAnnotation.Focused)
|
||||||
@ -1304,16 +1394,13 @@ namespace Volian.Controls.Library
|
|||||||
cbxTextSearchText.SelectedText = "?";
|
cbxTextSearchText.SelectedText = "?";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonItem4_Click(object sender, EventArgs e)
|
private void buttonItem4_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (cbxTextSearchAnnotation.Focused)
|
if (cbxTextSearchAnnotation.Focused)
|
||||||
cbxTextSearchAnnotation.SelectedText = "?*";
|
cbxTextSearchAnnotation.SelectedText = "?*";
|
||||||
else if (cbxTextSearchText.Focused)
|
else if (cbxTextSearchText.Focused)
|
||||||
cbxTextSearchText.SelectedText = "?*";
|
cbxTextSearchText.SelectedText = "?*";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cbxBooleanTxtSrch_CheckedChanged(object sender, EventArgs e)
|
private void cbxBooleanTxtSrch_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (cbxBooleanTxtSrch.Checked)
|
if (cbxBooleanTxtSrch.Checked)
|
||||||
@ -1339,7 +1426,6 @@ namespace Volian.Controls.Library
|
|||||||
cbxIncROTextSrch.Enabled = true;
|
cbxIncROTextSrch.Enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cbxBooleanAnoTxtSrch_CheckedChanged(object sender, EventArgs e)
|
private void cbxBooleanAnoTxtSrch_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (cbxBooleanAnoTxtSrch.Checked)
|
if (cbxBooleanAnoTxtSrch.Checked)
|
||||||
@ -1355,8 +1441,6 @@ namespace Volian.Controls.Library
|
|||||||
btnCMIFindText.SubItems[1].SubItems[3].Visible = false;
|
btnCMIFindText.SubItems[1].SubItems[3].Visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void btnAND_Click(object sender, EventArgs e)
|
private void btnAND_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (cbxTextSearchAnnotation.Focused)
|
if (cbxTextSearchAnnotation.Focused)
|
||||||
@ -1365,7 +1449,6 @@ namespace Volian.Controls.Library
|
|||||||
cbxTextSearchText.SelectedText = " AND ";
|
cbxTextSearchText.SelectedText = " AND ";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnOR_Click(object sender, EventArgs e)
|
private void btnOR_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (cbxTextSearchAnnotation.Focused)
|
if (cbxTextSearchAnnotation.Focused)
|
||||||
@ -1374,38 +1457,70 @@ namespace Volian.Controls.Library
|
|||||||
cbxTextSearchText.SelectedText = " OR ";
|
cbxTextSearchText.SelectedText = " OR ";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnNOT_Click(object sender, EventArgs e)
|
private void btnNOT_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (cbxTextSearchAnnotation.Focused)
|
if (cbxTextSearchAnnotation.Focused)
|
||||||
cbxTextSearchAnnotation.SelectedText = " NOT ";
|
cbxTextSearchAnnotation.SelectedText = " NOT ";
|
||||||
else if (cbxTextSearchText.Focused)
|
else if (cbxTextSearchText.Focused)
|
||||||
cbxTextSearchText.SelectedText = " NOT ";
|
cbxTextSearchText.SelectedText = " NOT ";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void tabAnnotationSearch_Click(object sender, EventArgs e)
|
private void tabAnnotationSearch_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
cbxAnnoTypes.Focus();
|
cbxAnnoTypes.Focus();
|
||||||
cbxBooleanAnoTxtSrch_CheckedChanged(sender, e);
|
cbxBooleanAnoTxtSrch_CheckedChanged(sender, e);
|
||||||
}
|
}
|
||||||
|
private void btnClearSearchResults_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
lbSrchResults.DataSource = null;
|
||||||
|
_SearchResults = null;
|
||||||
|
DisplayResults();
|
||||||
|
}
|
||||||
|
private void btnCopySearchResults_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ICollection<ItemInfo> myList = lbSrchResults.DataSource as ICollection<ItemInfo>;
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.Append("\"Location\"\t\"Type\"\t\"Text\"\t\"High-Level\"\t\"Annotations\"");
|
||||||
|
foreach (ItemInfo myItem in myList)
|
||||||
|
{
|
||||||
|
sb.Append(string.Format("\r\n\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"", myItem.ShortPath, myItem.ToolTip,
|
||||||
|
myItem.DisplayText, !myItem.IsSection && !myItem.IsHigh ? myItem.MyHLS.DisplayText : ""));
|
||||||
|
if(myItem.ItemAnnotationCount > 0)
|
||||||
|
foreach(AnnotationInfo myAnnotation in myItem.ItemAnnotations)
|
||||||
|
sb.Append(string.Format("\t\"{0}\"",myAnnotation.SearchText));
|
||||||
|
}
|
||||||
|
Clipboard.Clear();
|
||||||
|
Clipboard.SetText(sb.ToString());
|
||||||
|
MessageBox.Show("Results Copied to Clipboard","Copy Results", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
private string _ReportTitle;
|
||||||
|
public string ReportTitle
|
||||||
|
{
|
||||||
|
get { return _ReportTitle; }
|
||||||
|
set { _ReportTitle = value; }
|
||||||
|
}
|
||||||
|
private string _SearchString=null;
|
||||||
|
public string SearchString
|
||||||
|
{
|
||||||
|
get { return _SearchString; }
|
||||||
|
set { _SearchString = value; }
|
||||||
|
}
|
||||||
|
private void btnPrnSrchRslts_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OnPrintRequest(new DisplaySearchEventArgs(ReportTitle,SearchString,lbSrchResults.DataSource as ICollection<ItemInfo>));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Annoation Search Type Class
|
#region Annoation Search Type Class
|
||||||
// this class is used to generate the list of annotations to search.
|
// this class is used to generate the list of annotations to search.
|
||||||
// this also allow us to add a dummy type which is used to search for all annotations
|
// this also allow us to add a dummy type which is used to search for all annotations
|
||||||
public class AnnotationTypeSearch
|
public class AnnotationTypeSearch
|
||||||
{
|
{
|
||||||
private string _Name;
|
private string _Name;
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return _Name; }
|
get { return _Name; }
|
||||||
set { _Name = value; }
|
set { _Name = value; }
|
||||||
}
|
}
|
||||||
private string _ID;
|
private string _ID;
|
||||||
|
|
||||||
public string ID
|
public string ID
|
||||||
{
|
{
|
||||||
get { return _ID; }
|
get { return _ID; }
|
||||||
@ -1416,6 +1531,35 @@ namespace Volian.Controls.Library
|
|||||||
_Name = name;
|
_Name = name;
|
||||||
_ID = id;
|
_ID = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
public class DisplaySearchEventArgs
|
||||||
|
{
|
||||||
|
private string _ReportTitle;
|
||||||
|
public string ReportTitle
|
||||||
|
{
|
||||||
|
get { return _ReportTitle; }
|
||||||
|
set { _ReportTitle = value; }
|
||||||
|
}
|
||||||
|
private string _SearchString = null;
|
||||||
|
public string SearchString
|
||||||
|
{
|
||||||
|
get { return _SearchString; }
|
||||||
|
set { _SearchString = value; }
|
||||||
|
}
|
||||||
|
private ICollection<ItemInfo> _MyItemInfoList;
|
||||||
|
public ICollection<ItemInfo> MyItemInfoList
|
||||||
|
{
|
||||||
|
get { return _MyItemInfoList; }
|
||||||
|
set { _MyItemInfoList = value; }
|
||||||
|
}
|
||||||
|
public DisplaySearchEventArgs(string reportTitle, string searchString, ICollection<ItemInfo> myItemInfoList)
|
||||||
|
{
|
||||||
|
_ReportTitle = reportTitle;
|
||||||
|
_MyItemInfoList = myItemInfoList;
|
||||||
|
_SearchString = searchString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public delegate void DisplaySearchEvent(object sender, DisplaySearchEventArgs args);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user