diff --git a/PROMS/VEPROMS User Interface/frmVersionsProperties.cs b/PROMS/VEPROMS User Interface/frmVersionsProperties.cs index 5e5971b0..3d81f250 100644 --- a/PROMS/VEPROMS User Interface/frmVersionsProperties.cs +++ b/PROMS/VEPROMS User Interface/frmVersionsProperties.cs @@ -1087,7 +1087,7 @@ namespace VEPROMS // a docversion can have more than one rofst (for now, just use first?) - should I bring up a dialog? if (_DocVersionConfig.MyDocVersion.DocVersionAssociations.Count < 1) { - MessageBox.Show("Error Updating ro.fst. No associated ro.fst"); + MessageBox.Show("Error Updating ro.fst.", "No associated ro.fst"); //B2017-125 added title to messagebox return; } foreach (DocVersionAssociation dva in _DocVersionConfig.MyDocVersion.DocVersionAssociations) @@ -1098,20 +1098,20 @@ namespace VEPROMS if (!File.Exists(rofstPath)) { FinalProgressBarMessage = "No existing RO.FST"; - MessageBox.Show("No existing ro.fst in path " + rdi.FolderPath + ". Check for invalid path"); + MessageBox.Show("No existing ro.fst in path " + rdi.FolderPath + ". Check for invalid path", "No existing RO.FST"); //B2017-125 added title to messagebox 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"); + MessageBox.Show("ro.fst files are same for path " + rdi.FolderPath + ", import of that ro.fst will not be done", "RO.FST up to date"); //B2017-125 added title to messagebox 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"); + MessageBox.Show("Cannot copy older ro.fst from " + rdi.FolderPath + ", import of that ro.fst will not be done", "RO.FST is older"); //B2017-125 added title to messagebox break; } Cursor = Cursors.WaitCursor; diff --git a/PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs index bc0b72dc..c5d20bd2 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs @@ -107,6 +107,23 @@ namespace VEPROMS.CSLA.Library _Xp["ROUpdate", "LastCompleted"] = value; // save selected value } } + // B2017-125 save status of loading RO Figues + [Category("RO Update")] + [DisplayName("Loading Figures")] + [RefreshProperties(RefreshProperties.All)] + [Description("Loading Figures Status")] + public string ROUpdate_LoadingFigures + { + get + { + string s = _Xp["ROUpdate", "LoadingFigures"];// get the saved value + return s; + } + set + { + _Xp["ROUpdate", "LoadingFigures"] = value; // save selected value + } + } #endregion // ROUpdate #region ToString public override string ToString() diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocVersionExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocVersionExt.cs index 0923bdbb..c0a5b9b3 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocVersionExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocVersionExt.cs @@ -87,6 +87,29 @@ namespace VEPROMS.CSLA.Library if (att == null) return string.Empty; return att.InnerText; } + // B2017-125 put info in the config as to the status of loading RO Figures during the Update RO Values + // This will help us determine if the Update RO Values was terminated during the loading of the RO Figures + public bool ROfstLoadingFigures + { + get + { + if (DocVersionAssociations == null || DocVersionAssociationCount == 0) return true; // no ROs associated this will turn off the update ROs button + if (ROLoadingFigures(DocVersionAssociations[0]) == string.Empty) return false; + return true; + } + } + // B2017-125 return the loading figures status + private string ROLoadingFigures(DocVersionAssociation dva) + { + XmlDocument xd = new XmlDocument(); + if (dva.Config == null || dva.Config.Length == 0) return string.Empty; + xd.LoadXml(dva.Config); + XmlNode xn = xd.DocumentElement.SelectSingleNode("//ROUpdate"); + if (xn == null) return string.Empty; + XmlAttribute att = xn.Attributes["LoadingFigures"]; + if (att == null) return string.Empty; + return att.InnerText; + } #region VersionType public VersionTypeEnum eVersionType { @@ -270,6 +293,12 @@ namespace VEPROMS.CSLA.Library AssociationConfig ac = new AssociationConfig(associationInfo); return ac.ROUpdate_LastCompleted; } + // B2017-125 return the loading figures status + private string ROLoadingFigures(AssociationInfo associationInfo) + { + AssociationConfig ac = new AssociationConfig(associationInfo); + return ac.ROUpdate_LoadingFigures; + } #region SearchPaths public string _SearchDVPath; public string SearchDVPath diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs index 05ed3228..a030bedb 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs @@ -306,7 +306,7 @@ namespace VEPROMS.CSLA.Library public static ROFst RefreshROFst(RODbInfo rdi, DocVersionAssociation dva, DocVersion docver, ROFstInfo origROFst, ROFstInfoProgressBarRefresh myProgressBarRefresh, System.Windows.Forms.TextBox tbStatus) { ROFst rofst = null; - if (docver.NewerRoFst) + if (docver.ROfstLoadingFigures || docver.NewerRoFst) // B2017-125 see if loading figures was completed { // only load the RO.fst Volian.Base.Library.VlnSettings.DoUpdateRO = false; @@ -339,13 +339,21 @@ namespace VEPROMS.CSLA.Library // this witll tell us if the RO Update was completed, interrupted, or just needs done and whether to make the Update ROs button available private static void SetAssociationLastCompleted(DocVersion docver, string value) { - //Association asc = dva.MyAssociation; string cfg = docver.DocVersionAssociations[0].Config; AssociationConfig ac = new AssociationConfig((cfg== null || cfg.Length == 0) ? "" : cfg); ac.ROUpdate_LastCompleted = value; docver.DocVersionAssociations[0].Config = ac.ToString(); docver.Save(); } + // Place the status of loading the RO Figures when updating RO Values + private static void SetAssociationROFiguresLoading(DocVersion docver, string value) + { + string cfg = docver.DocVersionAssociations[0].Config; + AssociationConfig ac = new AssociationConfig((cfg== null || cfg.Length == 0) ? "" : cfg); + ac.ROUpdate_LoadingFigures = value; + docver.DocVersionAssociations[0].Config = ac.ToString(); + docver.Save(); + } /// /// Updates an ro.fst into a sql database. /// @@ -368,11 +376,18 @@ namespace VEPROMS.CSLA.Library if (rofst != null) { // Get a list of figures which have changed content (DTS) - List changedFigures = GetChangedFigureROIDs(origROFst, ROFstInfo.GetJustROFst(rofst.ROFstID),DocVersionInfo.Get(docver.VersionID), myProgressBarRefresh); + List MyChangedFigureROIDs = null; + if (docver.ROfstLoadingFigures) // B2017-125 see if loading figures was completed + { + ROFSTLookup myLookup = ROFstInfo.GetJustROFst(rofst.ROFstID).GetROFSTLookup(DocVersionInfo.Get(docver.VersionID)); + MyChangedFigureROIDs = UpdateROFigures(rdi, myProgressBarRefresh, rofst, RODb.GetJustRoDb(rdi.RODbID), myLookup, docver); + } + else + MyChangedFigureROIDs = GetChangedFigureROIDs(origROFst, ROFstInfo.GetJustROFst(rofst.ROFstID), DocVersionInfo.Get(docver.VersionID), myProgressBarRefresh); docver.DocVersionAssociations[0].MyROFst = rofst; - docver.Save(); + SetAssociationLastCompleted(docver, string.Empty); if (!Volian.Base.Library.VlnSettings.GetCommandFlag("NOUPDATERO") && Volian.Base.Library.VlnSettings.DoUpdateRO) - UpdateROValuesText(origROFst, rofst, DocVersionInfo.Get(docver.VersionID),myProgressBarRefresh,changedFigures); + UpdateROValuesText(origROFst, rofst, DocVersionInfo.Get(docver.VersionID), myProgressBarRefresh, MyChangedFigureROIDs); return rofst; } @@ -387,33 +402,11 @@ namespace VEPROMS.CSLA.Library // Hook this into the current docversion by replacing the rofstid field in the doc version // association object: dva.MyROFst = rofst; - docver.Save(); + SetAssociationROFiguresLoading(docver, "Started"); // B2017-125 flag was we are loading the RO figures + //docver.Save(); ROFSTLookup myLookup = ROFstInfo.GetJustROFst(rofst.ROFstID).GetROFSTLookup(DocVersionInfo.Get(docver.VersionID)); // Keep a list of ROIDs for Images that have changed. - List MyChangedFigureROIDs = new List(); - // Now load any images in... type 8 - integrated graphics ro type - using (ROImageInfoList myROImages = ROImageInfoList.GetByRODbIDNoData(rdi.RODbID)) - { - Dictionary myExistingROImages = BuildROImagesList(myROImages); - List myUnChangedROImages = new List(); - List myAddedROImages = new List(); - using (ROFstInfo rfi = ROFstInfo.Get(rofst.ROFstID)) - { - for (int i = 0; i < myLookup.myHdr.myDbs.Length; i++) - { - // walk through the rofst 'database' searching for all nodes that are integrated graphics, type 8: - if (myLookup.myHdr.myDbs[i].children != null) - { - int cnt = rfi.CountRoFstGraphics(myLookup.myHdr.myDbs[i].children); // get the total number of RO figures - int curCnt = 0; - rfi.MigrateRoFstGraphics(rdi, myLookup.myHdr.myDbs[i].children, rodb, rofst, myExistingROImages, myUnChangedROImages, myAddedROImages, MyChangedFigureROIDs,myProgressBarRefresh,cnt,ref curCnt); - } - } - } - // Add references for existing RO Images to the Figure table (Figure table relates ro.fst with its images) - if (myUnChangedROImages.Count > 0) - using (FigureInfoList fil = FigureInfoList.AddByROFstIDImageIDs(rofst.ROFstID, buildImageIDString(myUnChangedROImages))) ; - } + List MyChangedFigureROIDs = UpdateROFigures(rdi, myProgressBarRefresh, rofst, rodb, myLookup,docver); // Now update the usages: compare old to new rofsts and update usages accordingly, i.e. modified // values, deleted ros, etc. if (!Volian.Base.Library.VlnSettings.GetCommandFlag("NOUPDATERO") && Volian.Base.Library.VlnSettings.DoUpdateRO) @@ -421,6 +414,36 @@ namespace VEPROMS.CSLA.Library return rofst; } } + + private static List UpdateROFigures(RODbInfo rdi, ROFstInfoProgressBarRefresh myProgressBarRefresh, ROFst rofst, RODb rodb, ROFSTLookup myLookup, DocVersion docVer) + { + List MyChangedFigureROIDs = new List(); + // Now load any images in... type 8 - integrated graphics ro type + using (ROImageInfoList myROImages = ROImageInfoList.GetByRODbIDNoData(rdi.RODbID)) + { + Dictionary myExistingROImages = BuildROImagesList(myROImages); + List myUnChangedROImages = new List(); + List myAddedROImages = new List(); + using (ROFstInfo rfi = ROFstInfo.Get(rofst.ROFstID)) + { + for (int i = 0; i < myLookup.myHdr.myDbs.Length; i++) + { + // walk through the rofst 'database' searching for all nodes that are integrated graphics, type 8: + if (myLookup.myHdr.myDbs[i].children != null) + { + int cnt = rfi.CountRoFstGraphics(myLookup.myHdr.myDbs[i].children); // get the total number of RO figures + int curCnt = 0; + rfi.MigrateRoFstGraphics(rdi, myLookup.myHdr.myDbs[i].children, rodb, rofst, myExistingROImages, myUnChangedROImages, myAddedROImages, MyChangedFigureROIDs, myProgressBarRefresh, cnt, ref curCnt); + } + } + } + // Add references for existing RO Images to the Figure table (Figure table relates ro.fst with its images) + if (myUnChangedROImages.Count > 0) + using (FigureInfoList fil = FigureInfoList.AddByROFstIDImageIDs(rofst.ROFstID, buildImageIDString(myUnChangedROImages))) ; + } + SetAssociationROFiguresLoading(docVer, string.Empty); // B2017-125 loading RO Figures is completed + return MyChangedFigureROIDs; + } /// /// Get a list of ROIDs for figures that have changed content. This is only used when the contents of a figure /// is changed without changing the filename. diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs index b1deb7c1..0d77bd67 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.cs @@ -816,7 +816,7 @@ namespace Volian.Controls.Library _ProgressBar.Text = ""; _ProgressBar.Maximum = 0; _ProgressBar.Value = 0; - _ProgressBar.TextVisible = false; + //_ProgressBar.TextVisible = false; // B2017-125 text in progress was not alway being displayed } } diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index ebc2255d..11db70da 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -925,7 +925,7 @@ namespace Volian.Controls.Library _ProgressBar.Text = ""; _ProgressBar.Maximum = 0; _ProgressBar.Value = 0; - _ProgressBar.TextVisible = false; + //_ProgressBar.TextVisible = false; // B2017-125 text was not always being displayed } } #endregion diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index dcc682a0..36e5068c 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -2914,7 +2914,7 @@ namespace Volian.Controls.Library if (Mydvi.DocVersionAssociations.Count < 1) { FinalProgressBarMessage = "No ROs associated"; - MessageBox.Show("Error Updating ro.fst. No associated ro.fst"); + MessageBox.Show("Error Updating ro.fst", "No associated ro.fst"); //B2017-125 added title to messagebox return; } ROFstInfo roFstInfo = Mydvi.DocVersionAssociations[0].MyROFst; @@ -2923,20 +2923,20 @@ namespace Volian.Controls.Library if (!File.Exists(rofstPath)) { FinalProgressBarMessage = "No existing RO.FST"; - MessageBox.Show("No existing ro.fst in path " + roFstInfo.MyRODb.FolderPath + ". Check for invalid path"); + MessageBox.Show("No existing ro.fst in path " + roFstInfo.MyRODb.FolderPath + ". Check for invalid path", "No existing RO.FST"); //B2017-125 added title to messagebox 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"); + MessageBox.Show("ro.fst files are same for path " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done", "RO.FST up to date"); //B2017-125 added title to messagebox 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"); + MessageBox.Show("Cannot copy older ro.fst from " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done", "RO.FST is older"); //B2017-125 added title to messagebox return; } Cursor = Cursors.WaitCursor; @@ -2976,6 +2976,7 @@ namespace Volian.Controls.Library ProgressBar.Maximum = max; ProgressBar.Value = value; ProgressBar.Text = text; + ProgressBar.TextVisible = true; //B2017-125 text was not always visible Application.DoEvents(); } private string InitialProgressBarMessage diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.cs b/PROMS/Volian.Controls.Library/vlnTreeView.cs index 163e030e..99d94191 100644 --- a/PROMS/Volian.Controls.Library/vlnTreeView.cs +++ b/PROMS/Volian.Controls.Library/vlnTreeView.cs @@ -1787,7 +1787,7 @@ namespace Volian.Controls.Library // 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"); + MessageBox.Show("Error Updating ro.fst. No associated ro.fst", "No ROs associated"); //B2017-125 added title to messagebox FinalProgressBarMessage = "No ROs associated"; return; } @@ -1795,20 +1795,20 @@ namespace Volian.Controls.Library 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"); + MessageBox.Show("No existing ro.fst in path " + roFstInfo.MyRODb.FolderPath + ". Check for invalid path", "No existing RO.FST"); //B2017-125 added title to messagebox 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"); + MessageBox.Show("ro.fst files are same for path " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done", "RO.FST up to date"); //B2017-125 added title to messagebox 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"); + MessageBox.Show("Cannot copy older ro.fst from " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done", "Older RO.FST"); //B2017-125 added title to messagebox FinalProgressBarMessage = "Older RO.FST"; return; }