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

@ -7,11 +7,48 @@ using System.Text;
using System.Windows.Forms;
using System.IO;
using VEPROMS.CSLA.Library;
using DevComponents.DotNetBar;
namespace VEPROMS
{
public partial class frmRODbProperties : Form
{
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 = 100;
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();
}
}
private Point _ParentLocation;
public Point ParentLocation
{
@ -140,7 +177,7 @@ namespace VEPROMS
RODb newroDb = RODb.MakeRODb(ppRTxtName.Text, ppTxtPath.Text, "cstring", null);
RODbInfo newrdi = RODbInfo.Get(newroDb.RODbID);
newroDb.Save().Dispose();
ROFst rofst = ROFstInfo.AddRoFst(newrdi, _docVersion);
ROFst rofst = ROFstInfo.AddRoFst(newrdi, _docVersion, DoProgressBarRefresh);
DialogResult = DialogResult.OK;
Close();
}

View File

@ -71,6 +71,7 @@ namespace VEPROMS
// multiple events because the print dialog will be displayed for each time the event was added.
_SelectedStepTabPanel.MyStepTabRibbon.PrintRequest -= new StepTabRibbonEvent(MyStepTabRibbon_PrintRequest);
_SelectedStepTabPanel.MyStepTabRibbon.PrintRequest += new StepTabRibbonEvent(MyStepTabRibbon_PrintRequest);
_SelectedStepTabPanel.MyStepTabRibbon.ProgressBar = bottomProgBar;
}
}
}
@ -248,7 +249,8 @@ namespace VEPROMS
tv.GetChangeId += new vlnTreeViewGetChangeIdEvent(tv_GetChangeId);
tv.NodeCopy += new vlnTreeViewEvent(tv_NodeCopy);
tv.ClipboardStatus += new vlnTreeViewClipboardStatusEvent(tv_ClipboardStatus);
tc.ItemPaste += new StepPanelItemPastedEvent(tc_ItemPasted);
tv.ProgressBar = bottomProgBar;
tc.ItemPaste += new StepPanelItemPastedEvent(tc_ItemPasted);
displayHistory.HistorySelectionChanged += new DisplayHistoryEvent(displayHistory_HistorySelectionChanged);
_CommentTitleBckColor = epAnnotations.TitleStyle.BackColor1.Color;
if (!btnAnnoDetailsPushPin.Checked)
@ -1614,6 +1616,7 @@ namespace VEPROMS
else if (args.DocVersionConfig != null)
{
frmVersionsProperties frmver = new frmVersionsProperties(args.DocVersionConfig);
frmver.ProgressBar = bottomProgBar;
dr = frmver.ShowDialog();
}
else if (args.ProcedureConfig != null)

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);