From 3519bec6aafa3828ec98f71de9e2f96fd80a8b51 Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 8 Oct 2015 21:03:14 +0000 Subject: [PATCH] Fixed logic to setup the transition panel Fixed the code to open enhanced document windows so that they are not always on top. If a transition to a procedure is created, or exists, it cannot be edited. John Zimmerman of Ginna reported this. The transition can be selected and deleted if the transition panel has not been opened. If the transition panel has been opened, then the code will crash as soon as the transition is selected. Thhis change fixes the code so that it will not crash. --- PROMS/VEPROMS User Interface/frmVEPROMS.cs | 6 ++- .../DisplayTransition.cs | 43 ++++++++++++------- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index 8f2b251f..39a96ffc 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -1247,7 +1247,8 @@ namespace VEPROMS frm.MySessionInfo = MySessionInfo; tc.dicEnhancedDocuments.Add(args.MyItemInfo.MyProcedure.MyDocVersion, frm); frm.FormClosed += frm_FormClosed; - frm.Show(this); + //frm.Show(this); When this was specified the child form displayed on top of the parent form. + frm.Show(); // With this removed either form can be on top (user selectable - currently active form on top) } else { @@ -2454,7 +2455,8 @@ namespace VEPROMS if (SelectedStepTabPanel == null) return; displayTransition.MyRTB = SelectedStepTabPanel.MyStepPanel.SelectedEditItem.MyStepRTB; //displayTransition.RangeColor = global::VEPROMS.Properties.Settings.Default.TransitionRangeColor; - displayTransition.CurTrans = null; + // RHM - The follwing line was reseting the settings on the transtion panel to "not" show the currently selected transition. + //displayTransition.CurTrans = null; } #endregion #region InfoTabLibDocs diff --git a/PROMS/Volian.Controls.Library/DisplayTransition.cs b/PROMS/Volian.Controls.Library/DisplayTransition.cs index d06bcc53..3a94c27b 100644 --- a/PROMS/Volian.Controls.Library/DisplayTransition.cs +++ b/PROMS/Volian.Controls.Library/DisplayTransition.cs @@ -139,12 +139,21 @@ namespace Volian.Controls.Library } ItemInfo tmpitm = selitm; ItemInfo secitm = null; - + // Find the procedure level first. - while (tmpitm.MyContent.Type != 0) + if (tmpitm.MyContent.Type == 0) // If at the procedure level then need to set the default section { - if (tmpitm.MyContent.Type >=10000 && tmpitm.MyContent.Type<20000 && secitm == null) secitm = tmpitm; - tmpitm = tmpitm.MyParent; + int scid = FindSectionStart(tmpitm); + if(scid > 0) secitm = SectionInfo.Get(scid); + } + else + { + while (tmpitm.MyContent.Type != 0) + { + if (tmpitm.MyContent.Type >= 10000 && tmpitm.MyContent.Type < 20000 && secitm == null) + secitm = tmpitm; + tmpitm = tmpitm.MyParent; + } } _CurrentProcedure = tmpitm; _CurrentToProcedure = _CurrentProcedure; @@ -874,22 +883,23 @@ namespace Volian.Controls.Library } } // 2) Look in SectionConfig/OriginalSteps = 'Y' - foreach (SectionInfo sio in prcitm.Sections) + if (prcitm.Sections != null) { - SectionConfig sc = sio.MyConfig as SectionConfig; - if (sc != null && sc.Section_OriginalSteps == "Y") + foreach (SectionInfo sio in prcitm.Sections) { - return sio.ItemID; + SectionConfig sc = sio.MyConfig as SectionConfig; + if (sc != null && sc.Section_OriginalSteps == "Y") + { + return sio.ItemID; + } + } + // 3) Find if any of the section titles contain 'PROCEDURES STEPS' + foreach (SectionInfo sit in prcitm.Sections) + { + if (sit.DisplayText.ToUpper().Contains("PROCEDURE STEPS")) + return sit.ItemID; } } - - // 3) Find if any of the section titles contain 'PROCEDURES STEPS' - foreach (SectionInfo sit in prcitm.Sections) - { - if (sit.DisplayText.ToUpper().Contains("PROCEDURE STEPS")) - return sit.ItemID; - } - // 4) 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 Sction in Format", MessageBoxButtons.OK,MessageBoxIcon.Error); return -1; @@ -908,6 +918,7 @@ namespace Volian.Controls.Library if (sectstartid == -1) btnTranSave.Enabled = false; // if there is an invalid section start - don't allow save. IList chldrn = prcitm.GetChildren(); cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid, true); + btnTranSave.Enabled = true; } private void tvTran_AfterSelect(object sender, TreeViewEventArgs e) {