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

View File

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