C2021-006: Search results save/load only show xml file type as option
This commit is contained in:
parent
4168218dc9
commit
25b9af0d7c
@ -1414,8 +1414,8 @@ namespace Volian.Controls.Library
|
||||
this.btnSaveSearchResults.Name = "btnSaveSearchResults";
|
||||
this.btnSaveSearchResults.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.btnSaveSearchResults.Size = new System.Drawing.Size(57, 28);
|
||||
this.superTooltip1.SetSuperTooltip(this.btnSaveSearchResults, new DevComponents.DotNetBar.SuperTooltipInfo("Save Search Results", "", "This button saves the Search Results listed below into a named file in xml, csv, " +
|
||||
"tab or basic format.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
|
||||
this.superTooltip1.SetSuperTooltip(this.btnSaveSearchResults, new DevComponents.DotNetBar.SuperTooltipInfo("Save Search Results", "", "This button saves the Search Results listed below into a named file in xml.",
|
||||
null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
|
||||
this.btnSaveSearchResults.TabIndex = 10;
|
||||
this.btnSaveSearchResults.Text = "Save";
|
||||
this.btnSaveSearchResults.ThemeAware = true;
|
||||
@ -1431,8 +1431,8 @@ namespace Volian.Controls.Library
|
||||
this.btnLoadSearchResults.Name = "btnLoadSearchResults";
|
||||
this.btnLoadSearchResults.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.btnLoadSearchResults.Size = new System.Drawing.Size(57, 28);
|
||||
this.superTooltip1.SetSuperTooltip(this.btnLoadSearchResults, new DevComponents.DotNetBar.SuperTooltipInfo("Save Search Results", "", "This button loads saved Search Results from a named file in xml, csv, tab or basi" +
|
||||
"c format.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
|
||||
this.superTooltip1.SetSuperTooltip(this.btnLoadSearchResults, new DevComponents.DotNetBar.SuperTooltipInfo("Save Search Results", "", "This button loads saved Search Results from a named file in xml.",
|
||||
null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
|
||||
this.btnLoadSearchResults.TabIndex = 10;
|
||||
this.btnLoadSearchResults.Text = "Load";
|
||||
this.btnLoadSearchResults.ThemeAware = true;
|
||||
@ -1550,14 +1550,12 @@ namespace Volian.Controls.Library
|
||||
//
|
||||
// sfdSearchResults
|
||||
//
|
||||
this.sfdSearchResults.Filter = "XML File (*.xml)|*.xml|Comma Separated Values (*.csv)|*.csv|Tab Separated Values " +
|
||||
"(*.tsv)|*.tsv|Basic Style Format (*.bsf)|*.bsf";
|
||||
this.sfdSearchResults.Filter = "XML File (*.xml)|*.xml";
|
||||
this.sfdSearchResults.InitialDirectory = "Personal";
|
||||
//
|
||||
// ofdSearchResults
|
||||
//
|
||||
this.ofdSearchResults.Filter = "XML File (*.xml)|*.xml|Comma Separated Values (*.csv)|*.csv|Tab Separated Values " +
|
||||
"(*.tsv)|*.tsv|Basic Style Format (*.bsf)|*.bsf";
|
||||
this.ofdSearchResults.Filter = "XML File (*.xml)|*.xml";
|
||||
this.ofdSearchResults.InitialDirectory = "Personal";
|
||||
//
|
||||
// xpSetToSearch
|
||||
|
@ -2309,7 +2309,7 @@ namespace Volian.Controls.Library
|
||||
|
||||
// A timer updated the step type tree but if it was loaded from xml the timer update overwrite what
|
||||
// was loaded in from the xml file. Added a flag that gets set on load and set to false on new Search
|
||||
private bool _fromLoad = false;
|
||||
private bool _fromLoad = false;
|
||||
private void btnLoadSearchResults_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
IncTransSelectedCount = 0;
|
||||
@ -2328,154 +2328,135 @@ namespace Volian.Controls.Library
|
||||
if (unitPrefix.EndsWith("#"))
|
||||
unitPrefix = unitPrefix.Replace("#", "");
|
||||
SearchResults = ItemInfoList.GetByContentID(0);
|
||||
int k = ofdSearchResults.FilterIndex;
|
||||
switch (k)
|
||||
// C2021-006: removed all file type options except xml
|
||||
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
|
||||
xd.Load(ofdSearchResults.FileName);
|
||||
// B2020-107: Add missing attributes/nodes for loading of search results, include procsets & steptypes:
|
||||
System.Xml.XmlNodeList nlp = xd.SelectNodes("search/procsets/set");
|
||||
if (nlp != null)
|
||||
{
|
||||
case 1: //xml
|
||||
DocVersionInfo tmpdvi = Mydocversion;
|
||||
DocVersionInfo fromLoadFiledvi = null;
|
||||
foreach (System.Xml.XmlNode nd in nlp)
|
||||
{
|
||||
int folderID = int.Parse(nd.Attributes.GetNamedItem("fid").InnerText);
|
||||
FolderInfo fi = FolderInfo.Get(folderID);
|
||||
_MyDocVersion = fi.FolderDocVersions[0];
|
||||
if (fromLoadFiledvi == null) fromLoadFiledvi = _MyDocVersion;
|
||||
advTreeProcSetsPreSelect();
|
||||
}
|
||||
foreach (System.Xml.XmlNode nd in nlp)
|
||||
{
|
||||
int folderID = int.Parse(nd.Attributes.GetNamedItem("fid").InnerText);
|
||||
FolderInfo fi = FolderInfo.Get(folderID);
|
||||
Node tnode = advTreeProcSets.FindNodeByDataKey(folderID);
|
||||
if (tnode != null) tnode.Checked = true;
|
||||
}
|
||||
Mydocversion = tmpdvi == null ? fromLoadFiledvi : tmpdvi;
|
||||
}
|
||||
AdvTreeStepTypesFillIn();
|
||||
System.Xml.XmlNodeList nl1 = xd.SelectNodes("search/StepType/type");
|
||||
if (nl1 != null)
|
||||
{
|
||||
foreach (System.Xml.XmlNode nd in nl1)
|
||||
{
|
||||
string stptype = nd.Attributes.GetNamedItem("str").InnerText;
|
||||
Node tnode = advTreeStepTypes.FindNodeByText(stptype);
|
||||
if (tnode != null)
|
||||
{
|
||||
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
|
||||
xd.Load(ofdSearchResults.FileName);
|
||||
// B2020-107: Add missing attributes/nodes for loading of search results, include procsets & steptypes:
|
||||
System.Xml.XmlNodeList nlp = xd.SelectNodes("search/procsets/set");
|
||||
if (nlp != null)
|
||||
tnode.Checked = true;
|
||||
xpStepTypes.TitleStyle.BackColor1.Color = saveXpStepTypeTitleColor;
|
||||
lstCheckedStepTypesStr.Add(stptype);
|
||||
StepData sd = (StepData)tnode.Tag;
|
||||
lstCheckedStepTypes.Add((int)sd.Index);
|
||||
}
|
||||
}
|
||||
string typstr = null;
|
||||
foreach (string s in lstCheckedStepTypesStr) typstr = typstr == null ? s : typstr + ", " + s;
|
||||
TypesSelected = "Filtered By: " + ((typstr != null) ? typstr : "All Step Types");
|
||||
ReportTitle = "Step Element Report"; //"Proms - Search by Type: " + typstr;
|
||||
TypesSelected = "Filtered By: " + typstr;
|
||||
advTreeStepTypes.RefreshItems();
|
||||
buildStepTypePannelTitle();
|
||||
}
|
||||
cmbResultsStyle.Text = xd.SelectSingleNode("search/results/@style").InnerText;
|
||||
int sti = int.Parse(xd.SelectSingleNode("search/criteria/@index").InnerText);
|
||||
switch (sti)
|
||||
{
|
||||
case 0: //text or steptypes
|
||||
{
|
||||
System.Xml.XmlNode xn = xd.SelectSingleNode("search/criteria/@text");
|
||||
tabSearchTypes.SelectedTab = tabStepTypeSearch;
|
||||
if (xn != null) // text search
|
||||
{
|
||||
DocVersionInfo tmpdvi = Mydocversion;
|
||||
DocVersionInfo fromLoadFiledvi = null;
|
||||
foreach (System.Xml.XmlNode nd in nlp)
|
||||
{
|
||||
int folderID = int.Parse(nd.Attributes.GetNamedItem("fid").InnerText);
|
||||
FolderInfo fi = FolderInfo.Get(folderID);
|
||||
_MyDocVersion = fi.FolderDocVersions[0];
|
||||
if (fromLoadFiledvi == null) fromLoadFiledvi = _MyDocVersion;
|
||||
advTreeProcSetsPreSelect();
|
||||
}
|
||||
foreach (System.Xml.XmlNode nd in nlp)
|
||||
{
|
||||
int folderID = int.Parse(nd.Attributes.GetNamedItem("fid").InnerText);
|
||||
FolderInfo fi = FolderInfo.Get(folderID);
|
||||
Node tnode = advTreeProcSets.FindNodeByDataKey(folderID);
|
||||
if (tnode != null) tnode.Checked = true;
|
||||
}
|
||||
Mydocversion = tmpdvi == null ? fromLoadFiledvi : tmpdvi;
|
||||
cbxTextSearchText.Text = xn.InnerText;
|
||||
cbxCaseSensitive.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@case").InnerText);
|
||||
cbxIncROTextSrch.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@ro").InnerText);
|
||||
cbxByWord.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@byword").InnerText);
|
||||
}
|
||||
AdvTreeStepTypesFillIn();
|
||||
System.Xml.XmlNodeList nl1 = xd.SelectNodes("search/StepType/type");
|
||||
if (nl1 != null)
|
||||
else // B2020-107: Add in step type search
|
||||
{
|
||||
foreach (System.Xml.XmlNode nd in nl1)
|
||||
{
|
||||
string stptype = nd.Attributes.GetNamedItem("str").InnerText;
|
||||
Node tnode = advTreeStepTypes.FindNodeByText(stptype);
|
||||
if (tnode != null)
|
||||
{
|
||||
tnode.Checked = true;
|
||||
xpStepTypes.TitleStyle.BackColor1.Color = saveXpStepTypeTitleColor;
|
||||
lstCheckedStepTypesStr.Add(stptype);
|
||||
StepData sd = (StepData)tnode.Tag;
|
||||
lstCheckedStepTypes.Add((int)sd.Index);
|
||||
}
|
||||
}
|
||||
string typstr = null;
|
||||
foreach (string s in lstCheckedStepTypesStr) typstr = typstr == null ? s : typstr + ", " + s;
|
||||
TypesSelected = "Filtered By: " + ((typstr != null) ? typstr : "All Step Types");
|
||||
ReportTitle = "Step Element Report"; //"Proms - Search by Type: " + typstr;
|
||||
TypesSelected = "Filtered By: " + typstr;
|
||||
advTreeStepTypes.RefreshItems();
|
||||
buildStepTypePannelTitle();
|
||||
cbxSrchTypeUsage.Checked = true;
|
||||
}
|
||||
|
||||
System.Xml.XmlNodeList nl = xd.SelectNodes("search/results/item");
|
||||
foreach (System.Xml.XmlNode nd in nl)
|
||||
{
|
||||
int itemID = int.Parse(nd.Attributes.GetNamedItem("id").InnerText);
|
||||
ItemInfo ii = ItemInfo.Get(itemID);
|
||||
if (ii.SearchAnnotationText == null && ii.ItemAnnotations != null) ii.SearchAnnotationText = AnnotationInfo.Get(ii.ItemAnnotations[0].AnnotationID).SearchText;
|
||||
SearchResults.AddItemInfo(ii);
|
||||
}
|
||||
lbSrchResults.DataSource = SearchResults;
|
||||
DisplayResults();
|
||||
break;
|
||||
}
|
||||
case 1: //annotation
|
||||
{
|
||||
cbxAnnoTypes.Text = xd.SelectSingleNode("search/criteria/@type").InnerText;
|
||||
cbxTextSearchAnnotation.Text = xd.SelectSingleNode("search/criteria/@text").InnerText;
|
||||
cbxCaseSensitiveAnnoText.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@case").InnerText);
|
||||
tabSearchTypes.SelectedTab = tabAnnotationSearch;
|
||||
cmbResultsStyle.Text = xd.SelectSingleNode("search/results/@style").InnerText;
|
||||
int sti = int.Parse(xd.SelectSingleNode("search/criteria/@index").InnerText);
|
||||
switch (sti)
|
||||
System.Xml.XmlNodeList nl = xd.SelectNodes("search/results/item");
|
||||
foreach (System.Xml.XmlNode nd in nl)
|
||||
{
|
||||
case 0: //text or steptypes
|
||||
{
|
||||
System.Xml.XmlNode xn = xd.SelectSingleNode("search/criteria/@text");
|
||||
tabSearchTypes.SelectedTab = tabStepTypeSearch;
|
||||
if (xn != null) // text search
|
||||
{
|
||||
cbxTextSearchText.Text = xn.InnerText;
|
||||
cbxCaseSensitive.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@case").InnerText);
|
||||
cbxIncROTextSrch.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@ro").InnerText);
|
||||
cbxByWord.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@byword").InnerText);
|
||||
}
|
||||
else // B2020-107: Add in step type search
|
||||
{
|
||||
cbxSrchTypeUsage.Checked = true;
|
||||
}
|
||||
|
||||
System.Xml.XmlNodeList nl = xd.SelectNodes("search/results/item");
|
||||
foreach (System.Xml.XmlNode nd in nl)
|
||||
{
|
||||
int itemID = int.Parse(nd.Attributes.GetNamedItem("id").InnerText);
|
||||
ItemInfo ii = ItemInfo.Get(itemID);
|
||||
if (ii.SearchAnnotationText == null && ii.ItemAnnotations!=null) ii.SearchAnnotationText = AnnotationInfo.Get(ii.ItemAnnotations[0].AnnotationID).SearchText;
|
||||
SearchResults.AddItemInfo(ii);
|
||||
}
|
||||
lbSrchResults.DataSource = SearchResults;
|
||||
DisplayResults();
|
||||
break;
|
||||
}
|
||||
case 1: //annotation
|
||||
{
|
||||
cbxAnnoTypes.Text = xd.SelectSingleNode("search/criteria/@type").InnerText;
|
||||
cbxTextSearchAnnotation.Text = xd.SelectSingleNode("search/criteria/@text").InnerText;
|
||||
cbxCaseSensitiveAnnoText.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@case").InnerText);
|
||||
tabSearchTypes.SelectedTab = tabAnnotationSearch;
|
||||
cmbResultsStyle.Text = xd.SelectSingleNode("search/results/@style").InnerText;
|
||||
System.Xml.XmlNodeList nl = xd.SelectNodes("search/results/item");
|
||||
foreach (System.Xml.XmlNode nd in nl)
|
||||
{
|
||||
int itemID = int.Parse(nd.Attributes.GetNamedItem("id").InnerText);
|
||||
ItemInfo ii = ItemInfo.Get(itemID);
|
||||
// B2020-107: The following was needed to set the Step Path result type for annotations
|
||||
if (ii.SearchAnnotationText == null && ii.ItemAnnotations != null)
|
||||
{
|
||||
ii.SearchAnnotationText = AnnotationInfo.Get(ii.ItemAnnotations[0].AnnotationID).SearchText;
|
||||
ii.SearchAnnotationID = ii.ItemAnnotations[0].AnnotationID;
|
||||
}
|
||||
SearchResults.AddItemInfo(ii);
|
||||
}
|
||||
lbSrchResults.DataSource = SearchResults;
|
||||
DisplayResults();
|
||||
break;
|
||||
}
|
||||
case 2: //referenced object
|
||||
case 3: // transitions
|
||||
{
|
||||
FlexibleMessageBox.Show(this, "Loading Referenced Objects and Transitions searches is under construction.", "Under Construction", MessageBoxButtons.OK);
|
||||
break;
|
||||
}
|
||||
case 4: // Incoming transitions
|
||||
{
|
||||
tabSearchTypes.SelectedTab = tabIncTrans;
|
||||
cmbResultsStyle.Text = xd.SelectSingleNode("search/results/@style").InnerText;
|
||||
string tmpi = xd.SelectSingleNode("search/results/@toid").InnerText;
|
||||
SearchIncTransII = ItemInfo.Get(Convert.ToInt32(tmpi));
|
||||
System.Xml.XmlNodeList nl = xd.SelectNodes("search/results/item");
|
||||
foreach (System.Xml.XmlNode nd in nl)
|
||||
{
|
||||
int itemID = int.Parse(nd.Attributes.GetNamedItem("id").InnerText);
|
||||
ItemInfo ii = ItemInfo.Get(itemID);
|
||||
if (ii.SearchAnnotationText == null && ii.ItemAnnotations != null) ii.SearchAnnotationText = AnnotationInfo.Get(ii.ItemAnnotations[0].AnnotationID).SearchText;
|
||||
SearchResults.AddItemInfo(ii);
|
||||
}
|
||||
lbSrchResultsIncTrans.DataSource = SearchResults;
|
||||
DisplayResults();
|
||||
break;
|
||||
}
|
||||
int itemID = int.Parse(nd.Attributes.GetNamedItem("id").InnerText);
|
||||
ItemInfo ii = ItemInfo.Get(itemID);
|
||||
// B2020-107: The following was needed to set the Step Path result type for annotations
|
||||
if (ii.SearchAnnotationText == null && ii.ItemAnnotations != null)
|
||||
{
|
||||
ii.SearchAnnotationText = AnnotationInfo.Get(ii.ItemAnnotations[0].AnnotationID).SearchText;
|
||||
ii.SearchAnnotationID = ii.ItemAnnotations[0].AnnotationID;
|
||||
}
|
||||
SearchResults.AddItemInfo(ii);
|
||||
}
|
||||
lbSrchResults.DataSource = SearchResults;
|
||||
DisplayResults();
|
||||
break;
|
||||
}
|
||||
case 2: //csv
|
||||
case 2: //referenced object
|
||||
case 3: // transitions
|
||||
{
|
||||
FlexibleMessageBox.Show(this, "Loading Referenced Objects and Transitions searches is under construction.", "Under Construction", MessageBoxButtons.OK);
|
||||
break;
|
||||
}
|
||||
case 3: //tsv
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 4: //bsf
|
||||
case 4: // Incoming transitions
|
||||
{
|
||||
tabSearchTypes.SelectedTab = tabIncTrans;
|
||||
cmbResultsStyle.Text = xd.SelectSingleNode("search/results/@style").InnerText;
|
||||
string tmpi = xd.SelectSingleNode("search/results/@toid").InnerText;
|
||||
SearchIncTransII = ItemInfo.Get(Convert.ToInt32(tmpi));
|
||||
System.Xml.XmlNodeList nl = xd.SelectNodes("search/results/item");
|
||||
foreach (System.Xml.XmlNode nd in nl)
|
||||
{
|
||||
int itemID = int.Parse(nd.Attributes.GetNamedItem("id").InnerText);
|
||||
ItemInfo ii = ItemInfo.Get(itemID);
|
||||
if (ii.SearchAnnotationText == null && ii.ItemAnnotations != null) ii.SearchAnnotationText = AnnotationInfo.Get(ii.ItemAnnotations[0].AnnotationID).SearchText;
|
||||
SearchResults.AddItemInfo(ii);
|
||||
}
|
||||
lbSrchResultsIncTrans.DataSource = SearchResults;
|
||||
DisplayResults();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2489,7 +2470,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
ICollection<ItemInfo> myList = lbSrchResults.DataSource as ICollection<ItemInfo>;
|
||||
if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[4]) myList = lbSrchResultsIncTrans.DataSource as ICollection<ItemInfo>; // C2020-033: use Incoming transition list
|
||||
if (tabSearchTypes.SelectedTabIndex == 2 || tabSearchTypes.SelectedTabIndex == 3) // ROs & Transitions are not coded yet
|
||||
if (tabSearchTypes.SelectedTabIndex == 2 || tabSearchTypes.SelectedTabIndex == 3) // ROs & Transitions are not coded yet
|
||||
{
|
||||
FlexibleMessageBox.Show(this, "Saving Referenced Objects and Transitions searches is under construction.", "Under Construction", MessageBoxButtons.OK);
|
||||
return;
|
||||
@ -2497,175 +2478,147 @@ namespace Volian.Controls.Library
|
||||
sfdSearchResults.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS";
|
||||
if (sfdSearchResults.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
int k = sfdSearchResults.FilterIndex;
|
||||
switch (k)
|
||||
// C2021-006: removed all file type options except xml
|
||||
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
|
||||
System.Xml.XmlElement xe = xd.CreateElement("search");
|
||||
xd.AppendChild(xe);
|
||||
xe = xd.CreateElement("criteria");
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
System.Xml.XmlAttribute xa = xd.CreateAttribute("index");
|
||||
int sti = tabSearchTypes.SelectedTabIndex;
|
||||
xa.InnerText = sti.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
// B2020-107: save procedures sets & step types
|
||||
// do procsets selected
|
||||
System.Xml.XmlElement xp = null;
|
||||
System.Xml.XmlElement xst = null;
|
||||
if (sti != 4) // C2020-033: no procsets or step types for Incoming transitions
|
||||
{
|
||||
case 1: //xml
|
||||
if (lstCheckedDocVersions != null && lstCheckedDocVersions.Count > 0)
|
||||
{
|
||||
xp = xd.CreateElement("procsets");
|
||||
foreach (DocVersionInfo dvi in lstCheckedDocVersions)
|
||||
{
|
||||
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
|
||||
System.Xml.XmlElement xe = xd.CreateElement("search");
|
||||
xd.AppendChild(xe);
|
||||
xe = xd.CreateElement("criteria");
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
System.Xml.XmlAttribute xa = xd.CreateAttribute("index");
|
||||
int sti = tabSearchTypes.SelectedTabIndex;
|
||||
xa.InnerText = sti.ToString();
|
||||
System.Xml.XmlElement xee = xd.CreateElement("set");
|
||||
xa = xd.CreateAttribute("fid");
|
||||
xa.InnerText = dvi.MyFolder.FolderID.ToString();
|
||||
xee.Attributes.SetNamedItem(xa);
|
||||
xp.AppendChild(xee);
|
||||
}
|
||||
}
|
||||
if (lstCheckedStepTypesStr != null && lstCheckedStepTypesStr.Count > 0)
|
||||
{
|
||||
xst = xd.CreateElement("StepType");
|
||||
foreach (string str in lstCheckedStepTypesStr) // Limited by step types
|
||||
{
|
||||
System.Xml.XmlElement xee = xd.CreateElement("type");
|
||||
xa = xd.CreateAttribute("str");
|
||||
xa.InnerText = str;
|
||||
xee.Attributes.SetNamedItem(xa);
|
||||
xst.AppendChild(xee);
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (sti)
|
||||
{
|
||||
case 0: //text
|
||||
{
|
||||
|
||||
if (!cbxSrchTypeUsage.Checked) // text search
|
||||
{
|
||||
xa = xd.CreateAttribute("text");
|
||||
xa.InnerText = cbxTextSearchText.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("case");
|
||||
xa.InnerText = cbxCaseSensitive.Checked.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("ro");
|
||||
xa.InnerText = cbxIncROTextSrch.Checked.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("byword");
|
||||
xa.InnerText = cbxByWord.Checked.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
|
||||
}
|
||||
if (xp != null) xd.DocumentElement.AppendChild(xp); // want criteria as first xml node
|
||||
if (xst != null) xd.DocumentElement.AppendChild(xst); // do procsets & steptypes after
|
||||
// do results
|
||||
xe = xd.CreateElement("results");
|
||||
xa = xd.CreateAttribute("style");
|
||||
xa.InnerText = cmbResultsStyle.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
// B2020-107: save procedures sets & step types
|
||||
// do procsets selected
|
||||
System.Xml.XmlElement xp = null;
|
||||
System.Xml.XmlElement xst = null;
|
||||
if (sti != 4) // C2020-033: no procsets or step types for Incoming transitions
|
||||
foreach (ItemInfo ii in myList)
|
||||
{
|
||||
if (lstCheckedDocVersions != null && lstCheckedDocVersions.Count > 0)
|
||||
{
|
||||
xp = xd.CreateElement("procsets");
|
||||
foreach (DocVersionInfo dvi in lstCheckedDocVersions)
|
||||
{
|
||||
System.Xml.XmlElement xee = xd.CreateElement("set");
|
||||
xa = xd.CreateAttribute("fid");
|
||||
xa.InnerText = dvi.MyFolder.FolderID.ToString();
|
||||
xee.Attributes.SetNamedItem(xa);
|
||||
xp.AppendChild(xee);
|
||||
}
|
||||
}
|
||||
if (lstCheckedStepTypesStr != null && lstCheckedStepTypesStr.Count > 0)
|
||||
{
|
||||
xst = xd.CreateElement("StepType");
|
||||
foreach (string str in lstCheckedStepTypesStr) // Limited by step types
|
||||
{
|
||||
System.Xml.XmlElement xee = xd.CreateElement("type");
|
||||
xa = xd.CreateAttribute("str");
|
||||
xa.InnerText = str;
|
||||
xee.Attributes.SetNamedItem(xa);
|
||||
xst.AppendChild(xee);
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (sti)
|
||||
{
|
||||
case 0: //text
|
||||
{
|
||||
|
||||
if (!cbxSrchTypeUsage.Checked) // text search
|
||||
{
|
||||
xa = xd.CreateAttribute("text");
|
||||
xa.InnerText = cbxTextSearchText.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("case");
|
||||
xa.InnerText = cbxCaseSensitive.Checked.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("ro");
|
||||
xa.InnerText = cbxIncROTextSrch.Checked.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("byword");
|
||||
xa.InnerText = cbxByWord.Checked.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
|
||||
}
|
||||
if (xp != null) xd.DocumentElement.AppendChild(xp); // want criteria as first xml node
|
||||
if (xst != null) xd.DocumentElement.AppendChild(xst); // do procsets & steptypes after
|
||||
// do results
|
||||
xe = xd.CreateElement("results");
|
||||
xa = xd.CreateAttribute("style");
|
||||
xa.InnerText = cmbResultsStyle.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
foreach (ItemInfo ii in myList)
|
||||
{
|
||||
System.Xml.XmlElement xee = xd.CreateElement("item");
|
||||
xa = xd.CreateAttribute("id");
|
||||
xa.InnerText = ii.ItemID.ToString();
|
||||
xee.Attributes.SetNamedItem(xa);
|
||||
xe.AppendChild(xee);
|
||||
}
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
xd.Save(sfdSearchResults.FileName);
|
||||
break;
|
||||
}
|
||||
case 1: //annotation
|
||||
{
|
||||
xa = xd.CreateAttribute("type");
|
||||
xa.InnerText = cbxAnnoTypes.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("text");
|
||||
xa.InnerText = cbxTextSearchAnnotation.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("case");
|
||||
xa.InnerText = cbxCaseSensitiveAnnoText.Checked.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
if (xp != null) xd.DocumentElement.AppendChild(xp); // want criteria as first xml node
|
||||
if (xst != null) xd.DocumentElement.AppendChild(xst); // do procsets & steptypes after
|
||||
xe = xd.CreateElement("results");
|
||||
xa = xd.CreateAttribute("style");
|
||||
xa.InnerText = cmbResultsStyle.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
foreach (ItemInfo ii in myList)
|
||||
{
|
||||
System.Xml.XmlElement xee = xd.CreateElement("item");
|
||||
xa = xd.CreateAttribute("id");
|
||||
xa.InnerText = ii.ItemID.ToString();
|
||||
xee.Attributes.SetNamedItem(xa);
|
||||
xe.AppendChild(xee);
|
||||
}
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
xd.Save(sfdSearchResults.FileName);
|
||||
break;
|
||||
}
|
||||
case 2: // ro
|
||||
case 3: // transitions
|
||||
{
|
||||
FlexibleMessageBox.Show(this, "Saving Search Results for this search type is under construction.", "Under Construction", MessageBoxButtons.OK);
|
||||
break;
|
||||
}
|
||||
case 4: // C2020-033: Incoming Transitions
|
||||
{
|
||||
// do results
|
||||
xe = xd.CreateElement("results");
|
||||
xa = xd.CreateAttribute("style");
|
||||
xa.InnerText = cmbResultsStyle.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("toid");
|
||||
xa.InnerText = SearchIncTransII.ItemID.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
foreach (ItemInfo ii in myList)
|
||||
{
|
||||
System.Xml.XmlElement xee = xd.CreateElement("item");
|
||||
xa = xd.CreateAttribute("id");
|
||||
xa.InnerText = ii.ItemID.ToString();
|
||||
xee.Attributes.SetNamedItem(xa);
|
||||
xe.AppendChild(xee);
|
||||
}
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
xd.Save(sfdSearchResults.FileName);
|
||||
break;
|
||||
}
|
||||
System.Xml.XmlElement xee = xd.CreateElement("item");
|
||||
xa = xd.CreateAttribute("id");
|
||||
xa.InnerText = ii.ItemID.ToString();
|
||||
xee.Attributes.SetNamedItem(xa);
|
||||
xe.AppendChild(xee);
|
||||
}
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
xd.Save(sfdSearchResults.FileName);
|
||||
break;
|
||||
}
|
||||
case 2: //csv
|
||||
case 3: //tsv
|
||||
case 4: //bsf
|
||||
case 1: //annotation
|
||||
{
|
||||
FlexibleMessageBox.Show(this, "Saving Search Results to this file type is under construction.", "Under Construction", MessageBoxButtons.OK);
|
||||
xa = xd.CreateAttribute("type");
|
||||
xa.InnerText = cbxAnnoTypes.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("text");
|
||||
xa.InnerText = cbxTextSearchAnnotation.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("case");
|
||||
xa.InnerText = cbxCaseSensitiveAnnoText.Checked.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
if (xp != null) xd.DocumentElement.AppendChild(xp); // want criteria as first xml node
|
||||
if (xst != null) xd.DocumentElement.AppendChild(xst); // do procsets & steptypes after
|
||||
xe = xd.CreateElement("results");
|
||||
xa = xd.CreateAttribute("style");
|
||||
xa.InnerText = cmbResultsStyle.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
foreach (ItemInfo ii in myList)
|
||||
{
|
||||
System.Xml.XmlElement xee = xd.CreateElement("item");
|
||||
xa = xd.CreateAttribute("id");
|
||||
xa.InnerText = ii.ItemID.ToString();
|
||||
xee.Attributes.SetNamedItem(xa);
|
||||
xe.AppendChild(xee);
|
||||
}
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
xd.Save(sfdSearchResults.FileName);
|
||||
break;
|
||||
}
|
||||
case 2: // ro
|
||||
case 3: // transitions
|
||||
{
|
||||
FlexibleMessageBox.Show(this, "Saving Search Results for this search type is under construction.", "Under Construction", MessageBoxButtons.OK);
|
||||
break;
|
||||
}
|
||||
case 4: // C2020-033: Incoming Transitions
|
||||
{
|
||||
// do results
|
||||
xe = xd.CreateElement("results");
|
||||
xa = xd.CreateAttribute("style");
|
||||
xa.InnerText = cmbResultsStyle.Text;
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
xa = xd.CreateAttribute("toid");
|
||||
xa.InnerText = SearchIncTransII.ItemID.ToString();
|
||||
xe.Attributes.SetNamedItem(xa);
|
||||
foreach (ItemInfo ii in myList)
|
||||
{
|
||||
System.Xml.XmlElement xee = xd.CreateElement("item");
|
||||
xa = xd.CreateAttribute("id");
|
||||
xa.InnerText = ii.ItemID.ToString();
|
||||
xee.Attributes.SetNamedItem(xa);
|
||||
xe.AppendChild(xee);
|
||||
}
|
||||
xd.DocumentElement.AppendChild(xe);
|
||||
xd.Save(sfdSearchResults.FileName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//string fn = sfdSearchResults.FileName;
|
||||
//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 == null ? "" : 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user