Added Progress Bar output

This commit is contained in:
Rich
2015-02-10 15:51:38 +00:00
parent 2cfc430128
commit 313cb28327
2 changed files with 110 additions and 26 deletions

View File

@@ -10,6 +10,7 @@ using System.Text.RegularExpressions;
using VEPROMS.CSLA.Library;
using Accentra.Controls;
using Volian.Base.Library;
using DevComponents.DotNetBar;
namespace Volian.Controls.Library
{
@@ -1893,10 +1894,12 @@ namespace Volian.Controls.Library
private void btnUpdROVal_Click(object sender, EventArgs e)
{
InitialProgressBarMessage = "Updating ROs";
// use rodb directory path of the first rofst for the this document version. Later, will need
// to modify code to get which one (when there is more than one)
if (MyDVI.DocVersionAssociations.Count < 1)
{
FinalProgressBarMessage = "No ROs associated";
MessageBox.Show("Error Updating ro.fst. No associated ro.fst");
return;
}
@@ -1905,17 +1908,20 @@ namespace Volian.Controls.Library
string rofstPath = roFstInfo.MyRODb.FolderPath + @"\ro.fst";
if (!File.Exists(rofstPath))
{
FinalProgressBarMessage = "No existing RO.FST";
MessageBox.Show("No existing ro.fst in path " + roFstInfo.MyRODb.FolderPath + ". Check for invalid path");
return;
}
FileInfo fiRofst = new FileInfo(rofstPath);
if (roFstInfo.DTS == fiRofst.LastWriteTimeUtc)
{
FinalProgressBarMessage = "RO.FST up to date";
MessageBox.Show("ro.fst files are same for path " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done");
return;
}
if (roFstInfo.DTS > fiRofst.LastWriteTimeUtc)
{
FinalProgressBarMessage = "RO.FST is older";
MessageBox.Show("Cannot copy older ro.fst from " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done");
return;
}
@@ -1924,13 +1930,50 @@ namespace Volian.Controls.Library
using (DocVersion dv = DocVersion.Get(MyDVI.VersionID))
{
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
ROFst newrofst = ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv.DocVersionAssociations[0], dv, roFstInfo);
ROFst newrofst = ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv.DocVersionAssociations[0], dv, roFstInfo, DoProgressBarRefresh);
roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("DisplayROUpdateROFST");
MyEditItem.MyStepPanel.OnTabDisplay(sender, args);
btnUpdROVal.Enabled = false;
}
Cursor = Cursors.Default;
FinalProgressBarMessage = "ROs values updated";
}
private ProgressBarItem _ProgressBar = null;
public ProgressBarItem ProgressBar
{
get { return _ProgressBar; }
set { _ProgressBar = value; }
}
private void DoProgressBarRefresh(int value, int max, string text)
{
if (ProgressBar == null) return;
ProgressBar.Value = value;
ProgressBar.Maximum = max;
ProgressBar.Text = text;
Application.DoEvents();
}
private string InitialProgressBarMessage
{
set
{
if (ProgressBar == null) return;
ProgressBar.Value = 0;
ProgressBar.Maximum = 100;
ProgressBar.Text = value;
Application.DoEvents();
}
}
private string FinalProgressBarMessage
{
set
{
if (ProgressBar == null) return;
ProgressBar.Value = 100;
ProgressBar.Maximum = 100;
ProgressBar.Text = value;
Application.DoEvents();
}
}
public List<string> roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)