Handle Range Transitions for Invalid Transitions
Add a prefix to transitions converted to text which were invalid Add counters for invalid transitions converted to text. Added a method to convert invalid transitions to text Cleanup debug Changed the panel so that it only requires a default section if the default is not set and it is required Fix invalid transitions when a step is activated. Don't fail when you open a step with an invalid transition. Display Transition Refresh Statistics
This commit is contained in:
parent
88db9605ed
commit
849b7230f2
@ -46,7 +46,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
string lookFor;
|
string lookFor;
|
||||||
if (tran == null)
|
if (tran == null)
|
||||||
{
|
{
|
||||||
int loc1 = Text.IndexOf("#Link:Transition:", 0) + ("#Link:Transition:").Length;
|
// B2018-002 - Invalid Transitions - Handle Range Transitions
|
||||||
|
int loc1 = Text.IndexOf("#Link:Transition:", 0);
|
||||||
|
if(loc1 > 0) loc1+=("#Link:Transition:").Length;
|
||||||
|
else
|
||||||
|
loc1 = Text.IndexOf("#Link:TransitionRange:", 0)+ ("#Link:TransitionRange:").Length;;
|
||||||
int loc2 = Text.IndexOf(" ", loc1);
|
int loc2 = Text.IndexOf(" ", loc1);
|
||||||
string trantype = Text.Substring(loc1, loc2 - loc1);
|
string trantype = Text.Substring(loc1, loc2 - loc1);
|
||||||
loc1 = loc2 + 1;
|
loc1 = loc2 + 1;
|
||||||
@ -77,8 +81,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
using (Item myitem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
|
using (Item myitem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
|
||||||
{
|
{
|
||||||
myitem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060
|
myitem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060
|
||||||
// B2016-225 (follow through) added more descriptive Annotation Type when transition is converted to text
|
// B2016-225 (follow through) added more descriptive Annotation Type when transition is converted to text]
|
||||||
Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Link Converted To Text"), "", string.Format("Transition ({0}) converted to text", ItemInfo.ConvertToDisplayText(gg)), null);
|
//Check for validity
|
||||||
|
// B2018-002 - Invalid Transitions - Add a prefix of invalid if the transition record is missing
|
||||||
|
string prefix = "";
|
||||||
|
if (tran == null) prefix = "Invalid ";
|
||||||
|
Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Link Converted To Text"), "", prefix + string.Format("Transition ({0}) converted to text", ItemInfo.ConvertToDisplayText(gg)), null);
|
||||||
}
|
}
|
||||||
if(tran != null)
|
if(tran != null)
|
||||||
Transition.Delete(tran.TransitionID);
|
Transition.Delete(tran.TransitionID);
|
||||||
@ -174,7 +182,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
string lookFor;
|
string lookFor;
|
||||||
if (tran == null)
|
if (tran == null)
|
||||||
{
|
{
|
||||||
int loc1 = MyGrid.Data.IndexOf("#Link:Transition:", 0) + ("#Link:Transition:").Length;
|
// B2018-002 - Invalid Transitions - Added code to support range transitions
|
||||||
|
int loc1 = MyGrid.Data.IndexOf("#Link:Transition:", 0);
|
||||||
|
if (loc1 > 0) loc1 += ("#Link:Transition:").Length;
|
||||||
|
else
|
||||||
|
loc1 = MyGrid.Data.IndexOf("#Link:TransitionRange:", 0) + ("#Link:TransitionRange:").Length; ;
|
||||||
|
//int loc1 = MyGrid.Data.IndexOf("#Link:Transition:", 0) + ("#Link:Transition:").Length;
|
||||||
int loc2 = MyGrid.Data.IndexOf(" ", loc1);
|
int loc2 = MyGrid.Data.IndexOf(" ", loc1);
|
||||||
string trantype = MyGrid.Data.Substring(loc1, loc2 - loc1);
|
string trantype = MyGrid.Data.Substring(loc1, loc2 - loc1);
|
||||||
loc1 = loc2 + 1;
|
loc1 = loc2 + 1;
|
||||||
@ -228,7 +241,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
string lookFor;
|
string lookFor;
|
||||||
if (tran == null)
|
if (tran == null)
|
||||||
{
|
{
|
||||||
int loc1 = Text.IndexOf("#Link:Transition:", 0) + ("#Link:Transition:").Length;
|
// B2018-002 - Invalid Transitions - Added code to support range transitions
|
||||||
|
int loc1 = Text.IndexOf("#Link:Transition:", 0);
|
||||||
|
if (loc1 > 0) loc1 += ("#Link:Transition:").Length;
|
||||||
|
else
|
||||||
|
loc1 = Text.IndexOf("#Link:TransitionRange:", 0) + ("#Link:TransitionRange:").Length; ;
|
||||||
int loc2 = Text.IndexOf(" ", loc1);
|
int loc2 = Text.IndexOf(" ", loc1);
|
||||||
string trantype = Text.Substring(loc1, loc2 - loc1);
|
string trantype = Text.Substring(loc1, loc2 - loc1);
|
||||||
loc1 = loc2 + 1;
|
loc1 = loc2 + 1;
|
||||||
@ -758,7 +775,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return _CacheByPrimaryKey.ContainsKey(contentID.ToString());
|
return _CacheByPrimaryKey.ContainsKey(contentID.ToString());
|
||||||
}
|
}
|
||||||
public static event StaticContentInfoEvent StaticContentInfoChange;
|
public static event StaticContentInfoEvent StaticContentInfoChange;
|
||||||
private static void OnStaticContentInfoChange(object sender, StaticContentInfoEventArgs args)
|
// B2018-002 - Invalid Transitions - Changed to Public
|
||||||
|
public static void OnStaticContentInfoChange(object sender, StaticContentInfoEventArgs args)
|
||||||
{
|
{
|
||||||
if (StaticContentInfoChange != null)
|
if (StaticContentInfoChange != null)
|
||||||
StaticContentInfoChange(sender, args);
|
StaticContentInfoChange(sender, args);
|
||||||
|
@ -590,9 +590,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
TranCheckCount = 0;
|
TranCheckCount = 0;
|
||||||
TranFixCount = 0;
|
TranFixCount = 0;
|
||||||
|
TranConvertCount = 0;// B2018-002 - Invalid Transitions - Initialize Transition Conversion Count
|
||||||
}
|
}
|
||||||
public static int TranCheckCount = 0;
|
public static int TranCheckCount = 0;
|
||||||
public static int TranFixCount = 0;
|
public static int TranFixCount = 0;
|
||||||
|
public static int TranConvertCount = 0;// B2018-002 - Invalid Transitions - Declare Transition Conversion Count
|
||||||
internal static TransitionInfoList TransitionsToDisconnected;
|
internal static TransitionInfoList TransitionsToDisconnected;
|
||||||
internal static TransitionInfoList TransitionsToNonEditable;
|
internal static TransitionInfoList TransitionsToNonEditable;
|
||||||
internal static void MyRefreshTransitions(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
|
internal static void MyRefreshTransitions(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
|
||||||
@ -621,7 +623,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
//foreach (ItemInfo ii in myItems)
|
//foreach (ItemInfo ii in myItems)
|
||||||
MyRefreshTransitions(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, procInfo, docVersionInfo, tranLookup);
|
MyRefreshTransitions(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, procInfo, docVersionInfo, tranLookup);
|
||||||
}
|
}
|
||||||
if (itemInfo.MyContent.ContentTransitionCount > 0)
|
// B2018-002 - Invalid Transitions - Convert Invalid Transitions to Text
|
||||||
|
// An invalid transition is a transition embedded in the content text that does not match the transition table record.
|
||||||
|
if(ConvertInvalidTransitionsToText(itemInfo))
|
||||||
{
|
{
|
||||||
itemInfo.ResetOrdinal();
|
itemInfo.ResetOrdinal();
|
||||||
foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions)
|
foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions)
|
||||||
@ -693,7 +697,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
string newText = itemInfo.MyContent.Text;
|
string newText = itemInfo.MyContent.Text;
|
||||||
// B2017-165 added check of newValue (special case for old 16-bit transition that was not fixed by the customer)
|
// B2017-165 added check of newValue (special case for old 16-bit transition that was not fixed by the customer)
|
||||||
string newValue = traninfo.ResolvePathTo(itemInfo.ActiveFormat, itemInfo, traninfo.TranType, traninfo.MyItemToID, traninfo.MyItemRangeID);
|
string newValue = traninfo.ResolvePathTo(itemInfo.ActiveFormat, itemInfo, traninfo.TranType, traninfo.MyItemToID, traninfo.MyItemRangeID);
|
||||||
if (newText != oldText|| newValue == "?")
|
if (newText != oldText || newValue == "?")
|
||||||
{
|
{
|
||||||
TranFixCount++;
|
TranFixCount++;
|
||||||
Content content = Content.Get(itemInfo.MyContent.ContentID);
|
Content content = Content.Get(itemInfo.MyContent.ContentID);
|
||||||
@ -704,6 +708,42 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// // B2018-002 - Invalid Transitions - Method to check for invalid transitions and convert them to text
|
||||||
|
public static bool ConvertInvalidTransitionsToText(ItemInfo itemInfo)
|
||||||
|
{
|
||||||
|
bool retval = true;
|
||||||
|
MatchCollection mc = Regex.Matches(itemInfo.MyContent.Text, @"\#Link\:Transition");
|
||||||
|
if (itemInfo.MyContent.ContentTransitionCount <= 0 || mc.Count > itemInfo.MyContent.ContentTransitionCount)
|
||||||
|
{
|
||||||
|
retval = false;
|
||||||
|
if (itemInfo.MyContent.Text.Contains("Link:Transition"))
|
||||||
|
{
|
||||||
|
//Console.WriteLine("\"TranCount\"\t\"{0}\"\t{1}\t{2}\t{3}", itemInfo.ShortPath, itemInfo.ItemID, mc.Count, itemInfo.MyContent.ContentTransitionCount);
|
||||||
|
Content content = Content.Get(itemInfo.MyContent.ContentID);
|
||||||
|
//if (itemInfo.InList(616031, 615898, 5516866))
|
||||||
|
// Console.WriteLine("here");
|
||||||
|
if (itemInfo.MyContent.ContentTransitions != null)
|
||||||
|
foreach (TransitionInfo ct in itemInfo.MyContent.ContentTransitions)
|
||||||
|
Transition.Delete(ct.TransitionID);
|
||||||
|
itemInfo.MyContent.RefreshContentTransitions();
|
||||||
|
//if (content.Text.Contains("Link:TransitionRange"))
|
||||||
|
// Console.WriteLine("Here");
|
||||||
|
while (content.Text.Contains("Link:Transition"))
|
||||||
|
{
|
||||||
|
TranCheckCount++;
|
||||||
|
TranConvertCount++;
|
||||||
|
if (content.FixTransitionText(null, true))
|
||||||
|
{
|
||||||
|
ContentInfo.OnStaticContentInfoChange(itemInfo, new StaticContentInfoEventArgs("", "", ""));
|
||||||
|
if (itemInfo.MyContent.MyGrid != null)
|
||||||
|
content.ConvertTransitionToTextInGrid(null, null);
|
||||||
|
content.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
//private static bool IsTransitionToDisconnected(TransitionInfo ti)
|
//private static bool IsTransitionToDisconnected(TransitionInfo ti)
|
||||||
//{
|
//{
|
||||||
// foreach (TransitionInfo til in TransitionsToDisconnected)
|
// foreach (TransitionInfo til in TransitionsToDisconnected)
|
||||||
|
@ -1456,8 +1456,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
string str = BuildSectionPath(ToSections);
|
string str = BuildSectionPath(ToSections);
|
||||||
str = Regex.Replace(str, @"\<U\>", tb._ToItem.MyDocVersion.DocVersionConfig.Unit_Number, RegexOptions.IgnoreCase);
|
str = Regex.Replace(str, @"\<U\>", tb._ToItem.MyDocVersion.DocVersionConfig.Unit_Number, RegexOptions.IgnoreCase);
|
||||||
str = Regex.Replace(str, @"\<ID\>", tb._ToItem.MyDocVersion.DocVersionConfig.Unit_ID, RegexOptions.IgnoreCase);
|
str = Regex.Replace(str, @"\<ID\>", tb._ToItem.MyDocVersion.DocVersionConfig.Unit_ID, RegexOptions.IgnoreCase);
|
||||||
if(str != str1)
|
|
||||||
Console.WriteLine("Difference In Strings: {0}\r\n{1}",str,str1);
|
|
||||||
//if (!str.EndsWith(".") && tb._ToItem.ItemID != tb._ToItem.ActiveSection.ItemID)
|
//if (!str.EndsWith(".") && tb._ToItem.ItemID != tb._ToItem.ActiveSection.ItemID)
|
||||||
tb.StepPrefix = ".";
|
tb.StepPrefix = ".";
|
||||||
tb.SectionNumberLength = str.Length;
|
tb.SectionNumberLength = str.Length;
|
||||||
|
@ -162,7 +162,8 @@ namespace Volian.Controls.Library
|
|||||||
_OrigGroupPanelProcs = groupPanelTransitionProcs.Style.BackColor;
|
_OrigGroupPanelProcs = groupPanelTransitionProcs.Style.BackColor;
|
||||||
_OrigGroupPanelSects = groupPanelTransitionSect.Style.BackColor;
|
_OrigGroupPanelSects = groupPanelTransitionSect.Style.BackColor;
|
||||||
_OrigGroupPanelSteps = groupPanelTranstionSteps.Style.BackColor;
|
_OrigGroupPanelSteps = groupPanelTranstionSteps.Style.BackColor;
|
||||||
|
// B2018-002 - Invalid Transitions - Get default section - side effect sets HasDefault
|
||||||
|
if (_CurItemFrom != null) FindSectionStart(_CurItemFrom.MyProcedure);
|
||||||
ListBoxTranFmtFillIn();
|
ListBoxTranFmtFillIn();
|
||||||
|
|
||||||
// if new, use _CurItemFrom to setup the initial selections in the controls,
|
// if new, use _CurItemFrom to setup the initial selections in the controls,
|
||||||
@ -214,6 +215,7 @@ namespace Volian.Controls.Library
|
|||||||
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI;
|
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI;
|
||||||
if ((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault)
|
if ((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault)
|
||||||
{
|
{
|
||||||
|
NeedsDefault = true; // B2018-002 - Invalid Transitions - if (SectDefault set in TransFormat set NeedsDefault to true
|
||||||
secStartId = FindSectionStart(_CurrentProcedure);
|
secStartId = FindSectionStart(_CurrentProcedure);
|
||||||
if (secStartId > -1)
|
if (secStartId > -1)
|
||||||
{
|
{
|
||||||
@ -223,6 +225,10 @@ namespace Volian.Controls.Library
|
|||||||
else
|
else
|
||||||
btnTranSave.Enabled = false; // if there is an invalid section start - don't allow save.
|
btnTranSave.Enabled = false; // if there is an invalid section start - don't allow save.
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NeedsDefault = false;// B2018-002 - Invalid Transitions - if (SectDefault not set in TransFormat set NeedsDefault to false
|
||||||
|
}
|
||||||
cbTranSectsFillIn(secitm, secitm == null ? -1 : secStartId, true);
|
cbTranSectsFillIn(secitm, secitm == null ? -1 : secStartId, true);
|
||||||
// Fill step items, passing in the active step to the selected item, or the first
|
// Fill step items, passing in the active step to the selected item, or the first
|
||||||
// step if the selection was not at the step level.
|
// step if the selection was not at the step level.
|
||||||
@ -248,6 +254,7 @@ namespace Volian.Controls.Library
|
|||||||
tvTran.Nodes.Clear();
|
tvTran.Nodes.Clear();
|
||||||
}
|
}
|
||||||
SetControlsEnabling();
|
SetControlsEnabling();
|
||||||
|
SaveCancelEnabling();// B2018-002 - Invalid Transitions - Set button enabled or disabled
|
||||||
}
|
}
|
||||||
private void tvInitHiliteRange() //bool rangeSameLevel, ItemInfo stpitm, ItemInfo rngitm, int uplevel)
|
private void tvInitHiliteRange() //bool rangeSameLevel, ItemInfo stpitm, ItemInfo rngitm, int uplevel)
|
||||||
{
|
{
|
||||||
@ -474,9 +481,12 @@ namespace Volian.Controls.Library
|
|||||||
listBoxTranFmt.Items.Add(new TransItem(ttl[i].TransMenu.Replace("?.",""),ttl[i].TransFormat.Replace("?.","")));
|
listBoxTranFmt.Items.Add(new TransItem(ttl[i].TransMenu.Replace("?.",""),ttl[i].TransFormat.Replace("?.","")));
|
||||||
//listBoxTranFmt.Items.Add(ttl[i].TransFormat.Replace("?.",""));
|
//listBoxTranFmt.Items.Add(ttl[i].TransFormat.Replace("?.",""));
|
||||||
listBoxTranFmt.SelectedIndex = _TranFmtIndx;
|
listBoxTranFmt.SelectedIndex = _TranFmtIndx;
|
||||||
groupPanelTranFmt.Style.BackColor = (_CurTrans == null && _TranFmtIndx==0) ? Color.Yellow : Color.Orange;
|
|
||||||
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI;
|
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI;
|
||||||
_DoingRange = (etm & E_TransUI.StepLast) == E_TransUI.StepLast;
|
_DoingRange = (etm & E_TransUI.StepLast) == E_TransUI.StepLast;
|
||||||
|
// B2018-002 - Invalid Transitions - Determine if a default section is required for this format
|
||||||
|
NeedsDefault = ((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault);
|
||||||
|
// B2018-002 - Invalid Transitions - Set backcolor to red if it doesn't have a default section and it Needs a Default Section
|
||||||
|
groupPanelTranFmt.Style.BackColor = !HasDefault && NeedsDefault ? Color.Red : Color.Orange;
|
||||||
}
|
}
|
||||||
private void tvTranFillIn(ItemInfo startitm)
|
private void tvTranFillIn(ItemInfo startitm)
|
||||||
{
|
{
|
||||||
@ -595,6 +605,8 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do section combo, in 16-bit system it was types 0, 3, 4, 5
|
// Do section combo, in 16-bit system it was types 0, 3, 4, 5
|
||||||
|
// B2018-002 - Invalid Transitions - Determine if a default section is required for this format
|
||||||
|
NeedsDefault = (etm & E_TransUI.SectDefault) == E_TransUI.SectDefault;
|
||||||
if (cbTranSects.Items.Count > 0 &&
|
if (cbTranSects.Items.Count > 0 &&
|
||||||
( (((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault &&
|
( (((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault &&
|
||||||
_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.DoSectionTransitions) ||
|
_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.DoSectionTransitions) ||
|
||||||
@ -800,11 +812,15 @@ namespace Volian.Controls.Library
|
|||||||
IList chldrn = _CurrentProcedure.GetChildren();
|
IList chldrn = _CurrentProcedure.GetChildren();
|
||||||
int secIdForCbSect = secitm == null ? sectstartid : secitm.ItemID;
|
int secIdForCbSect = secitm == null ? sectstartid : secitm.ItemID;
|
||||||
// if this transition format requires the default section, use it:
|
// if this transition format requires the default section, use it:
|
||||||
if ((etmnew & E_TransUI.SectDefault) == E_TransUI.SectDefault) secIdForCbSect = sectstartid;
|
if ((etmnew & E_TransUI.SectDefault) == E_TransUI.SectDefault)
|
||||||
|
secIdForCbSect = sectstartid;
|
||||||
if (chldrn != null && chldrn.Count > 0) cbTranSectsFillIn((ItemInfo)chldrn[0], secIdForCbSect, true); //sectstartid);
|
if (chldrn != null && chldrn.Count > 0) cbTranSectsFillIn((ItemInfo)chldrn[0], secIdForCbSect, true); //sectstartid);
|
||||||
}
|
}
|
||||||
|
// B2018-002 - Invalid Transitions - Determine if Default Section is required
|
||||||
|
NeedsDefault = ((etmnew & E_TransUI.SectDefault) == E_TransUI.SectDefault);
|
||||||
_TranFmtIndx = listBoxTranFmt.SelectedIndex;
|
_TranFmtIndx = listBoxTranFmt.SelectedIndex;
|
||||||
groupPanelTranFmt.Style.BackColor = (_CurTrans == null && _TranFmtIndx == 0) ? Color.Yellow : Color.Orange;
|
// B2018-002 - Invalid Transitions - Set the backcolor to red if it doesn't have a default section and it needs one
|
||||||
|
groupPanelTranFmt.Style.BackColor = !HasDefault && NeedsDefault ? Color.Red : Color.Orange;
|
||||||
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI;
|
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI;
|
||||||
_DoingRange = (etm & E_TransUI.StepLast) == E_TransUI.StepLast;
|
_DoingRange = (etm & E_TransUI.StepLast) == E_TransUI.StepLast;
|
||||||
// get section selected and if it's a step section, fill in the treeview of steps
|
// get section selected and if it's a step section, fill in the treeview of steps
|
||||||
@ -883,8 +899,12 @@ namespace Volian.Controls.Library
|
|||||||
SaveCancelEnabling();
|
SaveCancelEnabling();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// B2018-002 - Invalid Transitions - Declare Default Section variables
|
||||||
|
private bool NeedsDefault;
|
||||||
|
private bool HasDefault;
|
||||||
private int FindSectionStart(ItemInfo prcitm)
|
private int FindSectionStart(ItemInfo prcitm)
|
||||||
{
|
{
|
||||||
|
HasDefault = true;// B2018-002 - Invalid Transitions - Initialize Has Default to true
|
||||||
// Steps to get the section start. continue down list until finding a valid id. If none is found
|
// Steps to get the section start. continue down list until finding a valid id. If none is found
|
||||||
// put up a message dialog - and if returns a result of -1, caller should disable the 'ok' button
|
// put up a message dialog - and if returns a result of -1, caller should disable the 'ok' button
|
||||||
// so that a transition cannot be entered until the default section is defined:
|
// so that a transition cannot be entered until the default section is defined:
|
||||||
@ -959,7 +979,8 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 5) Display messagebox to tell user to specify which section should be used as the 'default section'.
|
// 5) Display messagebox to tell user to specify which section should be used as the 'default section'.
|
||||||
MessageBox.Show("No default step section was found. Set the appropriate Step Section as the default by using the Section Property Page, Format Tab.", "Transition using Default Step Section in Format", MessageBoxButtons.OK,MessageBoxIcon.Error);
|
//MessageBox.Show("No default step section was found. Set the appropriate Step Section as the default by using the Section Property Page, Format Tab.", "Transition using Default Step Section in Format", MessageBoxButtons.OK,MessageBoxIcon.Error);
|
||||||
|
HasDefault = false;// B2018-002 - Invalid Transitions - Set Has default to false
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
private void cbTranProcs_SelectedIndexChanged(object sender, EventArgs e)
|
private void cbTranProcs_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
@ -1032,8 +1053,19 @@ namespace Volian.Controls.Library
|
|||||||
// || ( selii != null && _CurTrans.ToID != selii.ItemID);
|
// || ( selii != null && _CurTrans.ToID != selii.ItemID);
|
||||||
bool hasChanged = SettingsChanged;
|
bool hasChanged = SettingsChanged;
|
||||||
bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep;
|
bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep;
|
||||||
btnTranSave.Enabled = !isenh && hasChanged && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
|
// B2018-002 - Invalid Transitions - Set button enabled if it has a default section or it doesn't need a default
|
||||||
|
btnTranSave.Enabled = (HasDefault || !NeedsDefault) && !isenh && hasChanged && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
|
||||||
btnTranCancel.Enabled = _CurTrans != null && hasChanged;
|
btnTranCancel.Enabled = _CurTrans != null && hasChanged;
|
||||||
|
groupPanelTranFmt.Text = !HasDefault && NeedsDefault ? "Requires Default" : "Select Format";
|
||||||
|
// B2018-002 - Invalid Transitions - Set tool tip based upon HasDefault and NeedsDefault
|
||||||
|
if (!HasDefault || NeedsDefault)
|
||||||
|
this.superToolTipDispTran.SetSuperTooltip(this.listBoxTranFmt,
|
||||||
|
new DevComponents.DotNetBar.SuperTooltipInfo("Requires Default", "",
|
||||||
|
"The selected Transition Format requires a Default Section.\r\n" +
|
||||||
|
"This can be set on the format tab of the section property window.", null, null, DevComponents.DotNetBar.eTooltipColor.Yellow));
|
||||||
|
else
|
||||||
|
this.superToolTipDispTran.SetSuperTooltip(this.listBoxTranFmt, new DevComponents.DotNetBar.SuperTooltipInfo("", "", "This is where transition types are selected. This also defines how the transitio" +
|
||||||
|
"n will look in the text.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
|
||||||
//btnTranSave.Enabled = allowSave;
|
//btnTranSave.Enabled = allowSave;
|
||||||
//if (CurTrans != null && selii != null)
|
//if (CurTrans != null && selii != null)
|
||||||
//{
|
//{
|
||||||
|
@ -445,7 +445,8 @@ namespace Volian.Controls.Library
|
|||||||
EditItem lastEI = _SelectedEditItem;
|
EditItem lastEI = _SelectedEditItem;
|
||||||
if (value != null) value.SetActive(); // Set the active color
|
if (value != null) value.SetActive(); // Set the active color
|
||||||
if (lastEI == value) return; // Same - No Change
|
if (lastEI == value) return; // Same - No Change
|
||||||
|
// B2018-002 - Invalid Transitions - If the current step contains an invalid transition convert it to text
|
||||||
|
if(value != null) ItemInfo.ConvertInvalidTransitionsToText(value.MyItemInfo);
|
||||||
if (lastEI != null && lastEI.BeingDisposed == false)
|
if (lastEI != null && lastEI.BeingDisposed == false)
|
||||||
{
|
{
|
||||||
bool shouldDelete = !lastEI.BeingRemoved && lastEI.Empty && (lastEI.MyItemInfo.MyContent.ContentEntryCount <= 0);
|
bool shouldDelete = !lastEI.BeingRemoved && lastEI.Empty && (lastEI.MyItemInfo.MyContent.ContentEntryCount <= 0);
|
||||||
|
@ -281,6 +281,12 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
if (args.MyLinkText.LinkInfoText.IndexOf("Transition") > -1)
|
if (args.MyLinkText.LinkInfoText.IndexOf("Transition") > -1)
|
||||||
{
|
{
|
||||||
|
// B2018-002 - Invalid Transitions - Don't fail on invalid transition
|
||||||
|
if(args.MyLinkText.MyTransitionInfo == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("This transition is invalid\r\n\r\nDelete it and replace it with \r\na valid transition", "Invalid Transition", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
return; // Not a valid transition
|
||||||
|
}
|
||||||
ItemInfo item = args.MyLinkText.MyTranToItemInfo;
|
ItemInfo item = args.MyLinkText.MyTranToItemInfo;
|
||||||
if (item == null || item.MyDocVersion == null || (item.PreviousID == null && item.ItemPartCount == 0 && item.ItemDocVersionCount == 0))
|
if (item == null || item.MyDocVersion == null || (item.PreviousID == null && item.ItemPartCount == 0 && item.ItemDocVersionCount == 0))
|
||||||
{
|
{
|
||||||
|
@ -3312,10 +3312,10 @@ namespace Volian.Controls.Library
|
|||||||
private void btnTranRefresh_Click(object sender, System.EventArgs e)
|
private void btnTranRefresh_Click(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
this.Cursor = Cursors.WaitCursor;
|
this.Cursor = Cursors.WaitCursor;
|
||||||
ProcedureInfo.ResetTranCounters();
|
|
||||||
ProcedureInfo.RefreshTransitions(MyItemInfo.MyProcedure as ProcedureInfo);
|
ProcedureInfo.RefreshTransitions(MyItemInfo.MyProcedure as ProcedureInfo);
|
||||||
this.Cursor = Cursors.Default;
|
this.Cursor = Cursors.Default;
|
||||||
MessageBox.Show(this, string.Format("Checked {0} transitions, fixed {1} transitions", ProcedureInfo.TranCheckCount, ProcedureInfo.TranFixCount), "Results of Refresh Transitions", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
// B2018-002 - Invalid Transitions - Display Transition Refresh Statistics
|
||||||
|
MessageBox.Show(this, string.Format("Checked {0} transitions, modified {1} transitions, converted to text {2} transitions", ProcedureInfo.TranCheckCount, ProcedureInfo.TranFixCount, ProcedureInfo.TranConvertCount), "Results of Refresh Transitions", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
private void btnRefObjRefresh_Click(object sender, System.EventArgs e)
|
private void btnRefObjRefresh_Click(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user