Added a smarter status message based on the number of items being processed

This commit is contained in:
John Jenko 2015-05-04 19:06:14 +00:00
parent d48819b9d8
commit 3fe7f68166
2 changed files with 32 additions and 15 deletions

View File

@ -148,14 +148,29 @@ namespace CmpRpt
success = myrodb.RODB_GetRootGroups(rootXml); success = myrodb.RODB_GetRootGroups(rootXml);
if (success == false) return; if (success == false) return;
VlnStatusBar showStatBar = new VlnStatusBar("Complete Referenced Object Report"); VlnStatusMessage showStat = null;
showStatBar.BarMax = roIDList.Length; VlnStatusBar showStatBar = null;
showStatBar.StatMsg = "Retrieving RO Information"; int inc = 0;
int inc = 1; int bmax = roIDList.Length;
if (roIDList.Length > 50)
{
showStatBar = new VlnStatusBar("Retrieving RO Information");
showStatBar.BarMax = bmax;
showStatBar.StatMsg = "Retrieving RO Information";
}
else
{
showStat = new VlnStatusMessage("Retrieving RO Information");
showStat.StatusMessage = "Reading RO Information";
}
Application.DoEvents();
foreach (string roid in roIDList) foreach (string roid in roIDList)
{ {
showStatBar.BarValue = inc++; if (showStatBar != null)
Application.DoEvents(); {
showStatBar.StatMsg = string.Format("Retrieving RO {0} of {1}", inc++, bmax);
showStatBar.BarValue = inc;
}
tbl = roid.Substring(0, 4); tbl = roid.Substring(0, 4);
recid = (roid.Length > 4) ? roid.Substring(4, 8) : null; recid = (roid.Length > 4) ? roid.Substring(4, 8) : null;
@ -226,11 +241,15 @@ namespace CmpRpt
for (int i = cnt - 1; i >= 0; i--) for (int i = cnt - 1; i >= 0; i--)
headers.Add(reversehdrs[i]); headers.Add(reversehdrs[i]);
} }
rptele.Show(myrodb,headers); rptele.Show(myrodb, headers, showStat);
Application.DoEvents();
headers.Clear(); headers.Clear();
reversehdrs.Clear(); reversehdrs.Clear();
}// end foreach roid }// end foreach roid
showStatBar.Dispose(); if (showStat != null)
showStat.Dispose();
if (showStatBar != null)
showStatBar.Dispose();
} }
private static string BuildROList(string[] args) private static string BuildROList(string[] args)

View File

@ -1146,20 +1146,20 @@ namespace RODBInterface
if (chldnode is VlnXmlElement) if (chldnode is VlnXmlElement)
{ {
VlnXmlElement elem = (VlnXmlElement) chldnode; VlnXmlElement elem = (VlnXmlElement) chldnode;
showStat.StatusMessage = elem.InnerText; if (showStat !=null)
showStat.StatusMessage = elem.InnerText;
// if it's a group, recurse through it. // if it's a group, recurse through it.
if (chldnode.Name == "vlnGroup") if (chldnode.Name == "vlnGroup")
{
elem.ShowGroup(myrodb, headers, showStat); elem.ShowGroup(myrodb, headers, showStat);
}
// do RO's too. // do RO's too.
else else
{ {
int levelcnt = chldnode.ChildNodes.Count; int levelcnt = chldnode.ChildNodes.Count;
bool isParDisData = chldnode.Name == "Parameter__Display__Data"; bool isParDisData = chldnode.Name == "Parameter__Display__Data";
string TheMenuTitle = elem.GetAttribute("MenuTitle"); string TheMenuTitle = elem.GetAttribute("MenuTitle");
showStat.StatusMessage = TheMenuTitle; if (showStat != null)
showStat.StatusMessage = TheMenuTitle;
if (!isParDisData && ((levelcnt > 1) || (levelcnt==1 && !TheMenuTitle.Equals("")))) if (!isParDisData && ((levelcnt > 1) || (levelcnt==1 && !TheMenuTitle.Equals(""))))
elem.ShowRRO(myrodb, headers); elem.ShowRRO(myrodb, headers);
} }
@ -1173,10 +1173,9 @@ namespace RODBInterface
// put this element, and if a group all it's subelements out to the 'print.tmp' // put this element, and if a group all it's subelements out to the 'print.tmp'
// file for complete reports. // file for complete reports.
public bool Show(RODB myrodb, ArrayList headers) public bool Show(RODB myrodb, ArrayList headers, VlnStatusMessage showStat)
{ {
bool success; bool success;
VlnStatusMessage showStat = new VlnStatusMessage("Reading ROs");
VlnXmlDocument xmldoc = (VlnXmlDocument) this.OwnerDocument; VlnXmlDocument xmldoc = (VlnXmlDocument) this.OwnerDocument;
success = xmldoc.OpenTemp(); success = xmldoc.OpenTemp();
if (success==false) return false; if (success==false) return false;
@ -1207,7 +1206,6 @@ namespace RODBInterface
else else
ShowRRO(myrodb, headers); ShowRRO(myrodb, headers);
} }
showStat.Dispose();
xmldoc.CloseTemp(); xmldoc.CloseTemp();
return true; return true;
} }