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:
John Jenko 2019-05-30 13:43:17 +00:00
parent a1b02ff17c
commit fd00dc14ea
4 changed files with 338 additions and 4 deletions

View File

@ -0,0 +1,138 @@
namespace VEPROMS
{
partial class DlgCloseTabsOrExit
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.BtnClsTab = new DevComponents.DotNetBar.ButtonX();
this.BtnExitPROMS = new DevComponents.DotNetBar.ButtonX();
this.btnCancel = new DevComponents.DotNetBar.ButtonX();
this.labelX1 = new DevComponents.DotNetBar.LabelX();
this.symbolBox1 = new DevComponents.DotNetBar.Controls.SymbolBox();
this.SuspendLayout();
//
// BtnClsTab
//
this.BtnClsTab.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.BtnClsTab.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.BtnClsTab.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.BtnClsTab.Location = new System.Drawing.Point(28, 68);
this.BtnClsTab.Name = "BtnClsTab";
this.BtnClsTab.Size = new System.Drawing.Size(148, 23);
this.BtnClsTab.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.BtnClsTab.TabIndex = 0;
this.BtnClsTab.Text = "Close the Current Tab";
this.BtnClsTab.Click += new System.EventHandler(this.BtnClsTab_Click);
//
// BtnExitPROMS
//
this.BtnExitPROMS.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.BtnExitPROMS.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.BtnExitPROMS.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.BtnExitPROMS.Location = new System.Drawing.Point(226, 68);
this.BtnExitPROMS.Name = "BtnExitPROMS";
this.BtnExitPROMS.Size = new System.Drawing.Size(95, 23);
this.BtnExitPROMS.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.BtnExitPROMS.TabIndex = 1;
this.BtnExitPROMS.Text = "Exit PROMS";
this.BtnExitPROMS.Click += new System.EventHandler(this.BtnExitPROMS_Click);
//
// btnCancel
//
this.btnCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnCancel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnCancel.Location = new System.Drawing.Point(393, 68);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(77, 23);
this.btnCancel.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "Cancel";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// labelX1
//
//
//
//
this.labelX1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.labelX1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelX1.Location = new System.Drawing.Point(68, 12);
this.labelX1.Name = "labelX1";
this.labelX1.Size = new System.Drawing.Size(401, 20);
this.labelX1.Style = DevComponents.DotNetBar.eDotNetBarStyle.OfficeXP;
this.labelX1.TabIndex = 3;
this.labelX1.Text = "Do you want to Close the Current Tab or Exit PROMS?";
//
// symbolBox1
//
//
//
//
this.symbolBox1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.symbolBox1.Location = new System.Drawing.Point(3, 0);
this.symbolBox1.Name = "symbolBox1";
this.symbolBox1.Size = new System.Drawing.Size(59, 43);
this.symbolBox1.Symbol = "59645";
this.symbolBox1.SymbolColor = System.Drawing.Color.Navy;
this.symbolBox1.SymbolSet = DevComponents.DotNetBar.eSymbolSet.Material;
this.symbolBox1.SymbolSize = 24F;
this.symbolBox1.TabIndex = 4;
this.symbolBox1.Text = "symbolBox1";
//
// DlgCloseTabsOrExit
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(486, 113);
this.Controls.Add(this.symbolBox1);
this.Controls.Add(this.labelX1);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.BtnExitPROMS);
this.Controls.Add(this.BtnClsTab);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "DlgCloseTabsOrExit";
this.ShowIcon = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "PROMS";
this.TopMost = true;
this.ResumeLayout(false);
}
#endregion
private DevComponents.DotNetBar.ButtonX BtnClsTab;
private DevComponents.DotNetBar.ButtonX BtnExitPROMS;
private DevComponents.DotNetBar.ButtonX btnCancel;
private DevComponents.DotNetBar.LabelX labelX1;
private DevComponents.DotNetBar.Controls.SymbolBox symbolBox1;
}
}

View File

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace VEPROMS
{
// B2019-071 Dialog will ask user if he wants to close the current tab, exit PROMS, or cancel
// This is displayed when user click on the PROMS X (upper right corner), V button Exit, or the Word X button inside a Word attachment
public partial class DlgCloseTabsOrExit : DevComponents.DotNetBar.Office2007Form
{
private bool _Cancel = true;
public bool Cancel
{
get { return _Cancel; }
}
private bool _ExitPROMS;
public bool ExitPROMS
{
get { return _ExitPROMS; }
set { _ExitPROMS = value; }
}
public DlgCloseTabsOrExit()
{
InitializeComponent();
}
private void BtnClsTab_Click(object sender, EventArgs e)
{
_Cancel = false;
_ExitPROMS = false;
this.Hide();
}
private void BtnExitPROMS_Click(object sender, EventArgs e)
{
_Cancel = false;
_ExitPROMS = true;
this.Hide();
}
private void btnCancel_Click(object sender, EventArgs e)
{
_Cancel = true;
_ExitPROMS = false;
this.Hide();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

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 (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.MyDSOTabPanel != null && tc._MyDisplayTabItems.Count > 0)
if (!dctoe.ExitPROMS) // B2019-071 close just the current tab and continue working
{
_MyLog.WarnFormat(string.Format("Stack Does not contain a MouseUp, a ButtonDown, an Exception\r\n" +
n = 0;
e.Cancel = true;
dctoe.Close();
return;
}
}
if (tc.SelectedDisplayTabItem != null && tc._MyDisplayTabItems.Count > 0 && dctoe.ExitPROMS)
{
_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