C2021-006: Search results save/load only show xml file type as option

This commit is contained in:
Kathy Ruffing 2021-03-26 15:44:37 +00:00
parent 4168218dc9
commit 25b9af0d7c
2 changed files with 252 additions and 301 deletions

View File

@ -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

View File

@ -2328,11 +2328,7 @@ namespace Volian.Controls.Library
if (unitPrefix.EndsWith("#"))
unitPrefix = unitPrefix.Replace("#", "");
SearchResults = ItemInfoList.GetByContentID(0);
int k = ofdSearchResults.FilterIndex;
switch (k)
{
case 1: //xml
{
// 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:
@ -2408,7 +2404,7 @@ namespace Volian.Controls.Library
{
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;
if (ii.SearchAnnotationText == null && ii.ItemAnnotations != null) ii.SearchAnnotationText = AnnotationInfo.Get(ii.ItemAnnotations[0].AnnotationID).SearchText;
SearchResults.AddItemInfo(ii);
}
lbSrchResults.DataSource = SearchResults;
@ -2464,21 +2460,6 @@ namespace Volian.Controls.Library
break;
}
}
break;
}
case 2: //csv
{
break;
}
case 3: //tsv
{
break;
}
case 4: //bsf
{
break;
}
}
Cursor = Cursors.Default;
}
btnTranCvtAllToTxt.Enabled = IncTransCvtAllToTextPerm(); // C2020-033: does user have access to at least one item
@ -2497,11 +2478,7 @@ namespace Volian.Controls.Library
sfdSearchResults.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS";
if (sfdSearchResults.ShowDialog(this) == DialogResult.OK)
{
int k = sfdSearchResults.FilterIndex;
switch (k)
{
case 1: //xml
{
// 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);
@ -2642,30 +2619,6 @@ namespace Volian.Controls.Library
break;
}
}
break;
}
case 2: //csv
case 3: //tsv
case 4: //bsf
{
FlexibleMessageBox.Show(this, "Saving Search Results to this file type is under construction.", "Under Construction", MessageBoxButtons.OK);
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);
}
}