diff --git a/PROMS/Volian.Base.Library/VlnSettings.cs b/PROMS/Volian.Base.Library/VlnSettings.cs index d48f80fe..ccd5bfcc 100644 --- a/PROMS/Volian.Base.Library/VlnSettings.cs +++ b/PROMS/Volian.Base.Library/VlnSettings.cs @@ -17,6 +17,12 @@ namespace Volian.Base.Library // // For DataLoader, this is set via the Debug checkbox on the form. private static bool WasLoaded = false; + private static bool _DoUpdateRO = true; + public static bool DoUpdateRO + { + get { return VlnSettings._DoUpdateRO; } + set { VlnSettings._DoUpdateRO = value; } + } private static bool _DebugPagination = false; public static bool DebugPagination { diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index 81312011..74d1bb2b 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -2873,15 +2873,26 @@ 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, DoProgressBarRefresh); + swROUpdate = new System.IO.StreamWriter(ROFstInfo.ROUpdateResultsPath(Mydvi));// RO changes placed in file in the Documents\VEPROMS folder + ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file + ROFst newrofst = ROFstInfo.RefreshROFst(roFstInfo.MyRODb, dv.DocVersionAssociations[0], dv, roFstInfo, DoProgressBarRefresh, null); + swROUpdate.Close(); + ContentInfo.StaticContentInfoChange -= ContentInfo_StaticContentInfoChange; 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 System.IO.StreamWriter swROUpdate; + // write the RO reference changes to a text file, include the old/new text, location, and the itemid of the step element + void ContentInfo_StaticContentInfoChange(object sender, StaticContentInfoEventArgs args) + { + if (args.Type == "RO") + swROUpdate.Write(string.Format("Fixed Referenced Object for {1}({4}){0}Old Text: {2}{0}New Text: {3}{0}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue, (sender as ItemInfo).ItemID)); + } + private ProgressBarItem _ProgressBar = null; public ProgressBarItem ProgressBar { @@ -2891,8 +2902,8 @@ namespace Volian.Controls.Library private void DoProgressBarRefresh(int value, int max, string text) { if (ProgressBar == null) return; - ProgressBar.Value = value; ProgressBar.Maximum = max; + ProgressBar.Value = value; ProgressBar.Text = text; Application.DoEvents(); } @@ -2979,7 +2990,8 @@ namespace Volian.Controls.Library public bool NewerRoFst() { if (_Mydvi == null)return false; - return _Mydvi.NewerRoFst; + // only allow update if association, and the RO update was not done and/or not completed + return !_Mydvi.ROfstLastCompleted || _Mydvi.NewerRoFst; } public void SetUpdRoValBtn(bool en) { diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.cs b/PROMS/Volian.Controls.Library/vlnTreeView.cs index 4ce8b08a..163e030e 100644 --- a/PROMS/Volian.Controls.Library/vlnTreeView.cs +++ b/PROMS/Volian.Controls.Library/vlnTreeView.cs @@ -764,7 +764,8 @@ namespace Volian.Controls.Library { //_MyLog.WarnFormat("Context Menu 1h - {0}", GC.GetTotalMemory(true)); MenuItem urv = cm.MenuItems.Add("Update RO Values", new EventHandler(mi_Click)); - urv.Enabled = dvi.NewerRoFst; + // only allow update if association, and the RO update was not done and/or not completed + urv.Enabled = !dvi.ROfstLastCompleted || dvi.NewerRoFst; } } else if (tn.VEObject as ProcedureInfo != null) // Procs can only contain sections @@ -1823,7 +1824,11 @@ 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, DoProgressBarRefresh); + swROUpdate = new System.IO.StreamWriter(ROFstInfo.ROUpdateResultsPath(MyDVI)); // RO changes placed in file in the Documents\VEPROMS folder + ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file + ROFst newrofst = ROFstInfo.RefreshROFst(roFstInfo.MyRODb, dv.DocVersionAssociations[0], dv, roFstInfo, DoProgressBarRefresh, null); + swROUpdate.Close(); + ContentInfo.StaticContentInfoChange -= ContentInfo_StaticContentInfoChange; roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); OnTabDisplay(this, new StepPanelTabDisplayEventArgs("DisplayROUpdateROFST")); } @@ -1831,6 +1836,15 @@ namespace Volian.Controls.Library Cursor = Cursors.Default; FinalProgressBarMessage = "ROs values updated"; } + + private System.IO.StreamWriter swROUpdate; + // write the RO reference changes to a text file, include the old/new text, location, and the itemid of the step element + void ContentInfo_StaticContentInfoChange(object sender, StaticContentInfoEventArgs args) + { + if (args.Type == "RO") + swROUpdate.Write(string.Format("Fixed Referenced Object for {1}({4}){0}Old Text: {2}{0}New Text: {3}{0}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue, (sender as ItemInfo).ItemID)); + } + private ProgressBarItem _ProgressBar=null; public ProgressBarItem ProgressBar { @@ -1840,8 +1854,8 @@ namespace Volian.Controls.Library private void DoProgressBarRefresh(int value, int max, string text) { if (ProgressBar == null) return; - ProgressBar.Value = value; ProgressBar.Maximum = max; + ProgressBar.Value = value; ProgressBar.Text = text; Application.DoEvents(); }