Added Progress Bar output

This commit is contained in:
Rich
2015-02-10 15:50:12 +00:00
parent ea42dd8795
commit 7d2273d0d1
3 changed files with 86 additions and 4 deletions

View File

@@ -853,6 +853,7 @@ namespace VEPROMS
private void ppBtnUpRoVals_Click(object sender, EventArgs e)
{
InitialProgressBarMessage = "Updating ROs";
// use rodb directory path of the first rofst for the this document version. Bring up a file
// selection dialog starting with this path. The user can select another path.
// RHM question - we talked about just using the current path, but what is the current path when
@@ -869,27 +870,67 @@ namespace VEPROMS
string rofstPath = rdi.FolderPath + @"\ro.fst";
if (!File.Exists(rofstPath))
{
FinalProgressBarMessage = "No existing RO.FST";
MessageBox.Show("No existing ro.fst in path " + rdi.FolderPath + ". Check for invalid path");
break;
}
FileInfo fiRofst = new FileInfo(rofstPath);
if (SelectedROFst.DTS == fiRofst.LastWriteTimeUtc)
{
FinalProgressBarMessage = "RO.FST up to date";
MessageBox.Show("ro.fst files are same for path " + rdi.FolderPath + ", import of that ro.fst will not be done");
break;
}
if (SelectedROFst.DTS > fiRofst.LastWriteTimeUtc)
{
FinalProgressBarMessage = "RO.FST is older";
MessageBox.Show("Cannot copy older ro.fst from " + rdi.FolderPath + ", import of that ro.fst will not be done");
break;
}
Cursor = Cursors.WaitCursor;
SelectedROFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
ROFst newrofst = ROFstInfo.UpdateRoFst(rdi, dva, _DocVersionConfig.MyDocVersion, SelectedROFst);
ROFst newrofst = ROFstInfo.UpdateRoFst(rdi, dva, _DocVersionConfig.MyDocVersion, SelectedROFst,DoProgressBarRefresh);
SelectedROFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
ppBtnUpRoVals.Enabled = _DocVersionConfig.MyDocVersion.NewerRoFst;
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)
{
@@ -945,11 +986,12 @@ namespace VEPROMS
// get the rodb from the selection - and then do an 'update rofst'...
RODbInfoList rdil = RODbInfoList.Get();
RODbInfo rdi = rdil[cmbRoDb.SelectedIndex];
ROFst tmp = ROFstInfo.AddRoFst(rdi, _DocVersionConfig.MyDocVersion);
ROFst tmp = ROFstInfo.AddRoFst(rdi, _DocVersionConfig.MyDocVersion, null); // RHM Needs To Include Delegate
if (tmp == null)
{
MessageBox.Show("Invalid ro fst directory, use the Property dialog to fix directory path to ro.fst.");
frmRODbProperties dlgROProperties = new frmRODbProperties(_DocVersionConfig.MyDocVersion, rdi);
dlgROProperties.ProgressBar = ProgressBar;
if (dlgROProperties.ShowDialog() == DialogResult.OK)
{
tbRoDb.Text = string.Format("{0} ({1})", SelectedROFst.MyRODb.ROName, SelectedROFst.MyRODb.FolderPath);