B2019-071 If X in PROMS or in Word (attachment) is clicked, prompt user if we should close the current tab or close PROMS

B2019-071 Dialog that asks user if s/he wants to close the current tab, exit PROMS, or cancel
This commit is contained in:
2019-05-30 13:43:17 +00:00
parent a1b02ff17c
commit fd00dc14ea
4 changed files with 338 additions and 4 deletions

View File

@@ -1165,23 +1165,42 @@ namespace VEPROMS
// B2017-212 If the user uses the X button in Word to close the word attachment, PROMS thinks that the user wants to close out of PROMS as well
// trap for this and close only the Word tab in PROMS
// B2017-214 added a null reference check
if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.MyDSOTabPanel != null && tc._MyDisplayTabItems.Count > 0)
// B2010-071 Since we cannot tell if the user click on the X in Word or the X in PROMS, ask if the current tab
// should be closed or if we should exit PROMS or just Cancel to continue working
if (tc.SelectedDisplayTabItem != null && tc._MyDisplayTabItems.Count > 0)
{
DlgCloseTabsOrExit dctoe = new DlgCloseTabsOrExit(); // B2019-071 dialog to ask user if we are to close one tab or exit
dctoe.ShowDialog();
if (dctoe.Cancel) // B2019-071 user decided to not close any tab and not exit PROMS - so do nothing and continue working
{
e.Cancel = true;
dctoe.Close();
return;
}
string stk = Volian.Base.Library.vlnStackTrace.StackToString();
if (!stk.Contains("MouseUp") && !stk.Contains("ButtonDown") && !stk.Contains("Exception"))
if (!stk.Contains("Exception"))
{
// B2018-091 Allow PROMS to close if only MSWord sections have been opened.
// B2019-071 we will now close one or all of the tabs (even step editor ones)
int n = tc._MyDisplayTabItems.Count;
while (n-- > 0 && tc._MyDisplayTabItems.Count > 0)
{
tc.CloseTabItem(tc.SelectedDisplayTabItem);
if (!dctoe.ExitPROMS) // B2019-071 close just the current tab and continue working
{
n = 0;
e.Cancel = true;
dctoe.Close();
return;
}
}
if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.MyDSOTabPanel != null && tc._MyDisplayTabItems.Count > 0)
if (tc.SelectedDisplayTabItem != null && tc._MyDisplayTabItems.Count > 0 && dctoe.ExitPROMS)
{
_MyLog.WarnFormat(string.Format("Stack Does not contain a MouseUp, a ButtonDown, an Exception\r\n" +
_MyLog.WarnFormat(string.Format("Stack Does not contain an Exception\r\n" +
"PROMS will Not Exit. Stack : \r\n{0}", stk));
e.Cancel = true; // If Display Items still exist don't close.
}
dctoe.Close();
}
}
//C2015-022 Separate Windows - if child windows are open and we are closing the main PROMS window, give user a chance to not close PROMS and that child windows