Using statement added so the ContentItems[0].MyItem do not say in cache (caused issues with paste/replace step) B2016-153

When using CopyStep Paste, don’t convert a transition to text if that transition has procedure number information  B2016-148
Fixed <Shift><F5> issue so that Copy Step Paste options menu pops up  B2016-148
Made SetButtonAndMenuEnabling a public function to fix <Shift><F5> issue so that Copy Step Paste options menu pops up  B2016-148
This commit is contained in:
John Jenko 2016-06-29 19:32:06 +00:00
parent ffa8edbdd3
commit 14bb3fcf3b
5 changed files with 29 additions and 13 deletions

View File

@ -73,7 +73,10 @@ namespace VEPROMS.CSLA.Library
{
string rv = ConvertTransitionToText(tran, newvalue);
//Text = Text.Substring(0, myIndex - 14) + gg + Text.Substring(myIndex + myLength);
Annotation.MakeAnnotation(this.ContentItems[0].MyItem, AnnotationType.GetByName("Verification Required"), "", string.Format("Transition ({0}) converted to text", ItemInfo.ConvertToDisplayText(gg)), null);
using (Item myitem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{
Annotation.MakeAnnotation(myitem, AnnotationType.GetByName("Verification Required"), "", string.Format("Transition ({0}) converted to text", ItemInfo.ConvertToDisplayText(gg)), null);
}
if(tran != null)
Transition.Delete(tran.TransitionID);
break;
@ -473,7 +476,10 @@ namespace VEPROMS.CSLA.Library
if (value == "?")
{
retval = this.ConvertROToText(rousg, value, rotype, origROFstInfo);
Annotation.MakeAnnotation(this.ContentItems[0].MyItem, AnnotationType.GetByName("Verification Required"), "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(retval)), null);
using (Item myitem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{
Annotation.MakeAnnotation(myitem, AnnotationType.GetByName("Verification Required"), "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(retval)), null);
}
RoUsage.Delete(rousg.ROUsageID);
return retval;
}

View File

@ -749,7 +749,10 @@ namespace VEPROMS.CSLA.Library
if (roval == "?")
{
oldText = content.ConvertROToText(rousage, roval, roch.type, rofstinfo);
Annotation.MakeAnnotation(content.ContentItems[0].MyItem, AnnotationType.GetByName("Verification Required"), "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(oldText)), null);
using (Item myitem = content.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{
Annotation.MakeAnnotation(myitem, AnnotationType.GetByName("Verification Required"), "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(oldText)), null);
}
}
else
content.FixContentText(rousage, roval, roch.type, rofstinfo);
@ -787,7 +790,10 @@ namespace VEPROMS.CSLA.Library
if (roval == "?")
{
oldText = content.ConvertROToText(rousage, roval, roch.type, rofstinfo);
Annotation.MakeAnnotation(content.ContentItems[0].MyItem, AnnotationType.GetByName("Verification Required"), "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(oldText)), null);
using (Item myitem = content.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{
Annotation.MakeAnnotation(myitem, AnnotationType.GetByName("Verification Required"), "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(oldText)), null);
}
}
else
content.FixContentText(rousage, roval, roch.type, rofstinfo);

View File

@ -803,7 +803,9 @@ namespace VEPROMS.CSLA.Library
}
if (!forceConvertToText)
{
if (tran.MyContent.ContentItems[0].MyDocVersion.VersionID != tran.MyItemToID.MyDocVersion.VersionID)
// bug fix B2016-148 added check if transition had procedure information in which case we do not want to convert it to text
if (tran.MyContent.ContentItems[0].MyDocVersion.VersionID != tran.MyItemToID.MyDocVersion.VersionID &&
!tran.MyContent.ContentItems[0].ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[tran.TranType].TransMenu.Contains("Proc"))
forceConvertToText = true;
}
content.FixTransitionText(tran, forceConvertToText);

View File

@ -2272,13 +2272,15 @@ namespace Volian.Controls.Library
ItemInfo myCopyStep = (this.Parent.Parent.Parent as StepTabPanel).MyDisplayTabControl.MyCopyStep;
if (myCopyStep != null)
{
if (this.MyItemInfo.IsSection && myCopyStep.IsSection)
// commented out as part of bug fix B2016-148 to fix the <Shift><F5> not popping up the paste options
//if (this.MyItemInfo.IsSection && myCopyStep.IsSection)
// OnSetMenu(this, new StepRTBMenuEventArgs("StepPaste"));
//if (this.MyItemInfo.IsStep && myCopyStep.IsStep)
//{
// if ((this.MyItemInfo.IsHigh && myCopyStep.IsHigh) || (!this.MyItemInfo.IsHigh && !myCopyStep.IsHigh))
// OnSetMenu(this, new StepRTBMenuEventArgs("StepPaste"));
//}
OnSetMenu(this, new StepRTBMenuEventArgs("StepPaste"));
if (this.MyItemInfo.IsStep && myCopyStep.IsStep)
{
if ((this.MyItemInfo.IsHigh && myCopyStep.IsHigh) || (!this.MyItemInfo.IsHigh && !myCopyStep.IsHigh))
OnSetMenu(this, new StepRTBMenuEventArgs("StepPaste"));
}
}
//if (!OnCheckClipboard(this, new EventArgs())) return; // check if 'clipboard' contains a step.
//OnSetMenu(this, new StepRTBMenuEventArgs("StepPaste"));

View File

@ -1140,7 +1140,7 @@ namespace Volian.Controls.Library
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
btnInsCaut.Enabled = btnInsNote.Enabled = btnCMInsCaution.Enabled = btnCMInsNote.Enabled = setting && !MyItemInfo.IsInCalvertConditionResponse;
}
private void SetButtonAndMenuEnabling(bool docontextmenus)
public void SetButtonAndMenuEnabling(bool docontextmenus)
{
if (_MyStepRTB == null) return;
if (_MyStepRTB.FieldToEdit != E_FieldToEdit.StepText)