Fixed bug where status bars not always complete when importing or exporting a procedure in which the last section is a word sections, or when the last section of the last procedure in a set is word section.

This commit is contained in:
John Jenko 2016-05-05 20:11:36 +00:00
parent 0b0ed771ba
commit 34d4c2e5b5

View File

@ -1608,7 +1608,17 @@ namespace VEPROMS
pbExportStep.Maximum = pbExportStep.Value; pbExportStep.Maximum = pbExportStep.Value;
if(ii.Sections != null) if(ii.Sections != null)
pbExportSection.Maximum = ii.Sections.Count; pbExportSection.Maximum = ii.Sections.Count;
} else
{
pbExportSection.Maximum = 1;
pbExportSection.PerformStep();
pbExportStep.Maximum = 1;
pbExportStep.PerformStep();
lblExportSection.Text = "Sections";
lblExportStep.Text = "Steps";
Application.DoEvents();
}
}
if (ii.IsSection && ii.ActiveParent.IsProcedure) if (ii.IsSection && ii.ActiveParent.IsProcedure)
{ {
pbExportSection.PerformStep(); pbExportSection.PerformStep();
@ -1616,14 +1626,21 @@ namespace VEPROMS
Application.DoEvents(); Application.DoEvents();
pbExportStep.Value = 0; pbExportStep.Value = 0;
pbExportStep.Maximum = pbExportStep.Value; pbExportStep.Maximum = pbExportStep.Value;
if (ii.Steps != null) if (ii.Steps != null)
pbExportStep.Maximum = ii.Steps.Count; pbExportStep.Maximum = ii.Steps.Count;
else
{
pbExportStep.Maximum = 1;
pbExportStep.PerformStep();
lblExportStep.Text = "Word Section Data";
Application.DoEvents();
}
} }
if (ii.IsStep && ii.ActiveParent.IsSection && ii.ActiveParent.ActiveParent.IsProcedure) if (ii.IsStep && ii.ActiveParent.IsSection && ii.ActiveParent.ActiveParent.IsProcedure)
{ {
pbExportStep.PerformStep(); pbExportStep.PerformStep();
lblExportStep.Text = string.Format("{0} of {1} Steps", pbExportStep.Value.ToString(), pbExportStep.Maximum.ToString()); lblExportStep.Text = string.Format("{0} of {1} Steps", pbExportStep.Value.ToString(), pbExportStep.Maximum.ToString());
Application.DoEvents(); Application.DoEvents();
} }
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "itemid", ii.ItemID.ToString())); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "itemid", ii.ItemID.ToString()));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "previousid", ii.PreviousID.ToString())); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "previousid", ii.PreviousID.ToString()));
@ -1690,6 +1707,18 @@ namespace VEPROMS
pbExportSection.Value = 0; pbExportSection.Value = 0;
pbExportStep.Value = 0; pbExportStep.Value = 0;
pbExportSection.Maximum = ii.Sections.Count; pbExportSection.Maximum = ii.Sections.Count;
if (ii.Sections != null)
pbExportSection.Maximum = ii.Sections.Count;
else
{
pbExportSection.Maximum = 1;
pbExportSection.PerformStep();
pbExportStep.Maximum = 1;
pbExportStep.PerformStep();
lblExportSection.Text = "Sections";
lblExportStep.Text = "Steps";
Application.DoEvents();
}
} }
if (ii.IsSection) if (ii.IsSection)
{ {
@ -1699,6 +1728,13 @@ namespace VEPROMS
pbExportStep.Value = 0; pbExportStep.Value = 0;
if (ii.Steps != null) if (ii.Steps != null)
pbExportStep.Maximum = ii.Steps.Count; pbExportStep.Maximum = ii.Steps.Count;
else
{
pbExportStep.Maximum = 1;
pbExportStep.PerformStep();
lblExportStep.Text = "Word Section Data";
Application.DoEvents();
}
} }
if (ii.IsStep) if (ii.IsStep)
{ {
@ -2973,6 +3009,11 @@ namespace VEPROMS
case "tables": case "tables":
AddTables(xn, parentInfo); AddTables(xn, parentInfo);
break; break;
case "entry": // this is word section max out the status bar
lblImportStep.Text = "Word Section Data";
pbImportStep.Maximum = 1;
pbImportStep.PerformStep();
break;
default: default:
break; break;
} }