Added Progress Bar output
This commit is contained in:
parent
2cfc430128
commit
313cb28327
@ -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)
|
||||
|
@ -13,6 +13,7 @@ using Csla.Validation;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using System.IO;
|
||||
using Volian.Base.Library;
|
||||
using DevComponents.DotNetBar;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
@ -517,7 +518,6 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
Console.WriteLine("dts mouse down; {0}", DateTime.Now.ToLongTimeString());
|
||||
OwnerInfoList oil = null;
|
||||
OwnerInfo oi = null;
|
||||
VETreeNode tn = this.GetNodeAt(new Point(e.X, e.Y)) as VETreeNode;
|
||||
@ -649,7 +649,6 @@ namespace Volian.Controls.Library
|
||||
if (ui.IsAdministrator() || ui.IsSetAdministrator(dvi))
|
||||
{
|
||||
MenuItem urv = cm.MenuItems.Add("Update RO Values", new EventHandler(mi_Click));
|
||||
Console.WriteLine("dts mouse down NewerRoFst; {0}", DateTime.Now.ToLongTimeString());
|
||||
urv.Enabled = dvi.NewerRoFst;
|
||||
}
|
||||
}
|
||||
@ -1095,8 +1094,8 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
#region MenuPaste
|
||||
// Find what's in paste buffer & determine whether the paste can occur for the selected node.
|
||||
ItemInfo iiClipboard = OnClipboardStatus(this,new vlnTreeEventArgs(tn));
|
||||
if(iiClipboard != null)
|
||||
ItemInfo iiClipboard = OnClipboardStatus(this, new vlnTreeEventArgs(tn));
|
||||
if (iiClipboard != null)
|
||||
{
|
||||
// can it be pasted at current node.
|
||||
if (tn.VEObject as DocVersionInfo != null) // paste item must be a proc
|
||||
@ -1378,31 +1377,35 @@ namespace Volian.Controls.Library
|
||||
|
||||
private void UpdateROValues(VETreeNode tn)
|
||||
{
|
||||
InitialProgressBarMessage = "Updating ROs";
|
||||
DocVersionInfo MyDVI = tn.VEObject as DocVersionInfo;
|
||||
// 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)
|
||||
{
|
||||
MessageBox.Show("Error Updating ro.fst. No associated ro.fst");
|
||||
FinalProgressBarMessage = "No ROs associated";
|
||||
return;
|
||||
}
|
||||
ROFstInfo roFstInfo = MyDVI.DocVersionAssociations[0].MyROFst;
|
||||
|
||||
string rofstPath = roFstInfo.MyRODb.FolderPath + @"\ro.fst";
|
||||
if (!File.Exists(rofstPath))
|
||||
{
|
||||
MessageBox.Show("No existing ro.fst in path " + roFstInfo.MyRODb.FolderPath + ". Check for invalid path");
|
||||
FinalProgressBarMessage = "No existing RO.FST";
|
||||
return;
|
||||
}
|
||||
FileInfo fiRofst = new FileInfo(rofstPath);
|
||||
if (roFstInfo.DTS == fiRofst.LastWriteTimeUtc)
|
||||
{
|
||||
MessageBox.Show("ro.fst files are same for path " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done");
|
||||
FinalProgressBarMessage = "RO.FST up to date";
|
||||
return;
|
||||
}
|
||||
if (roFstInfo.DTS > fiRofst.LastWriteTimeUtc)
|
||||
{
|
||||
MessageBox.Show("Cannot copy older ro.fst from " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done");
|
||||
FinalProgressBarMessage = "Older RO.FST";
|
||||
return;
|
||||
}
|
||||
Cursor = Cursors.WaitCursor;
|
||||
@ -1410,18 +1413,56 @@ namespace Volian.Controls.Library
|
||||
if (!MySessionInfo.CanCheckOutItem(MyDVI.VersionID, CheckOutType.DocVersion, ref message))
|
||||
{
|
||||
MessageBox.Show(this, message, "Working Draft Has Items Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
FinalProgressBarMessage = "Cannot check-out Working Draft";
|
||||
return;
|
||||
}
|
||||
int ownerid = MySessionInfo.CheckOutItem(MyDVI.VersionID, CheckOutType.DocVersion);
|
||||
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");
|
||||
}
|
||||
MySessionInfo.CheckInItem(ownerid);
|
||||
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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user