B2015-089 Restore inner xml when there is a problem trying to save a duplicate RO, C2015-017 – added red text that appears when Duplicate button is pressed.

This commit is contained in:
John Jenko 2017-02-02 18:44:40 +00:00
parent bdabdd1c1f
commit 83c3a69a89
3 changed files with 48 additions and 15 deletions

View File

@ -363,7 +363,17 @@ namespace ROEditor
private System.Windows.Forms.TreeView roTreeView; private System.Windows.Forms.TreeView roTreeView;
private System.Windows.Forms.ListView roListView; private System.Windows.Forms.ListView roListView;
private System.Windows.Forms.ToolBar tbar; private System.Windows.Forms.ToolBar tbar;
private bool duplicate_active; private bool _duplicate_active;
private bool duplicate_active
{
get { return _duplicate_active; }
set
{
_duplicate_active = value;
// C2015-017 hide the label indicating user is working with a duplicate of an exiting RO
lblDuplicateRO.Visible = value;
}
}
private const int ROGROUPIMAGE = 0; private const int ROGROUPIMAGE = 0;
private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Panel panel2;
@ -376,6 +386,7 @@ namespace ROEditor
private ToolBarButton tbtnDuplicate; private ToolBarButton tbtnDuplicate;
private System.Windows.Forms.MenuItem menuItem2; private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.ImageList imageListToolBar; private System.Windows.Forms.ImageList imageListToolBar;
private Label lblDuplicateRO;
private ToolBarButton tbtnZoom; private ToolBarButton tbtnZoom;
public Form1(string PassedInPath, string specificro) public Form1(string PassedInPath, string specificro)
@ -1148,6 +1159,7 @@ namespace ROEditor
this.tbtnDuplicate = new System.Windows.Forms.ToolBarButton(); this.tbtnDuplicate = new System.Windows.Forms.ToolBarButton();
this.tbtnZoom = new System.Windows.Forms.ToolBarButton(); this.tbtnZoom = new System.Windows.Forms.ToolBarButton();
this.imageListToolBar = new System.Windows.Forms.ImageList(this.components); this.imageListToolBar = new System.Windows.Forms.ImageList(this.components);
this.lblDuplicateRO = new System.Windows.Forms.Label();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -1160,9 +1172,9 @@ namespace ROEditor
// //
// splitter1 // splitter1
// //
this.splitter1.Location = new System.Drawing.Point(264, 31); this.splitter1.Location = new System.Drawing.Point(220, 28);
this.splitter1.Name = "splitter1"; this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(10, 588); this.splitter1.Size = new System.Drawing.Size(8, 591);
this.splitter1.TabIndex = 4; this.splitter1.TabIndex = 4;
this.splitter1.TabStop = false; this.splitter1.TabStop = false;
// //
@ -1354,9 +1366,9 @@ namespace ROEditor
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel1.Controls.Add(this.panel2); this.panel1.Controls.Add(this.panel2);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(274, 31); this.panel1.Location = new System.Drawing.Point(228, 28);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(542, 588); this.panel1.Size = new System.Drawing.Size(588, 591);
this.panel1.TabIndex = 5; this.panel1.TabIndex = 5;
// //
// panel2 // panel2
@ -1364,7 +1376,7 @@ namespace ROEditor
this.panel2.AutoScroll = true; this.panel2.AutoScroll = true;
this.panel2.Location = new System.Drawing.Point(0, 0); this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2"; this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(282, 136); this.panel2.Size = new System.Drawing.Size(235, 118);
this.panel2.TabIndex = 0; this.panel2.TabIndex = 0;
this.panel2.Visible = false; this.panel2.Visible = false;
// //
@ -1375,10 +1387,10 @@ namespace ROEditor
this.roTreeView.ImageIndex = 0; this.roTreeView.ImageIndex = 0;
this.roTreeView.ImageList = this.imageListRoTree; this.roTreeView.ImageList = this.imageListRoTree;
this.roTreeView.ItemHeight = 18; this.roTreeView.ItemHeight = 18;
this.roTreeView.Location = new System.Drawing.Point(0, 31); this.roTreeView.Location = new System.Drawing.Point(0, 28);
this.roTreeView.Name = "roTreeView"; this.roTreeView.Name = "roTreeView";
this.roTreeView.SelectedImageIndex = 0; this.roTreeView.SelectedImageIndex = 0;
this.roTreeView.Size = new System.Drawing.Size(264, 588); this.roTreeView.Size = new System.Drawing.Size(220, 591);
this.roTreeView.TabIndex = 3; this.roTreeView.TabIndex = 3;
this.roTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.roTreeView_AfterSelect_1); this.roTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.roTreeView_AfterSelect_1);
// //
@ -1397,7 +1409,7 @@ namespace ROEditor
this.tbar.Location = new System.Drawing.Point(0, 0); this.tbar.Location = new System.Drawing.Point(0, 0);
this.tbar.Name = "tbar"; this.tbar.Name = "tbar";
this.tbar.ShowToolTips = true; this.tbar.ShowToolTips = true;
this.tbar.Size = new System.Drawing.Size(816, 31); this.tbar.Size = new System.Drawing.Size(816, 28);
this.tbar.TabIndex = 0; this.tbar.TabIndex = 0;
this.tbar.TextAlign = System.Windows.Forms.ToolBarTextAlign.Right; this.tbar.TextAlign = System.Windows.Forms.ToolBarTextAlign.Right;
this.tbar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.tbar_OnClick); this.tbar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.tbar_OnClick);
@ -1455,10 +1467,22 @@ namespace ROEditor
this.imageListToolBar.Images.SetKeyName(4, ""); this.imageListToolBar.Images.SetKeyName(4, "");
this.imageListToolBar.Images.SetKeyName(5, ""); this.imageListToolBar.Images.SetKeyName(5, "");
// //
// lblDuplicateRO
//
this.lblDuplicateRO.AutoSize = true;
this.lblDuplicateRO.ForeColor = System.Drawing.Color.Red;
this.lblDuplicateRO.Location = new System.Drawing.Point(491, 9);
this.lblDuplicateRO.Name = "lblDuplicateRO";
this.lblDuplicateRO.Size = new System.Drawing.Size(139, 13);
this.lblDuplicateRO.TabIndex = 6;
this.lblDuplicateRO.Text = "Working With Duplicate RO";
this.lblDuplicateRO.Visible = false;
//
// Form1 // Form1
// //
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(816, 619); this.ClientSize = new System.Drawing.Size(816, 619);
this.Controls.Add(this.lblDuplicateRO);
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
this.Controls.Add(this.splitter1); this.Controls.Add(this.splitter1);
this.Controls.Add(this.roTreeView); this.Controls.Add(this.roTreeView);
@ -2329,6 +2353,7 @@ namespace ROEditor
bool success; bool success;
VlnXmlElement newro = (VlnXmlElement) roTreeView.SelectedNode.Tag; VlnXmlElement newro = (VlnXmlElement) roTreeView.SelectedNode.Tag;
VlnXmlElement origro = (VlnXmlElement) newro.Clone(); VlnXmlElement origro = (VlnXmlElement) newro.Clone();
string savedInnerXML = newro.InnerXml;
XmlNode parent = newro.ParentNode; XmlNode parent = newro.ParentNode;
success = ctlXMLEdit2.SaveData(); success = ctlXMLEdit2.SaveData();
if (!success) if (!success)
@ -2353,13 +2378,14 @@ namespace ROEditor
//isduplicateaccpageid needs no recid attribute for any new //isduplicateaccpageid needs no recid attribute for any new
// ros (which is what we have hear for saveas or duplicate) // ros (which is what we have hear for saveas or duplicate)
newro.RemoveAttribute("RecID"); newro.RemoveAttribute("RecID");
dup = myrodb.IsDuplicateAccPageID(newro,newacc); dup = myrodb.IsDuplicateAccPageID(newro, newacc);
newro.SetAttribute("RecID",savrec); newro.SetAttribute("RecID",savrec);
if (dup==true) if (dup == true)
{ {
MessageBox.Show("The fields used for the \"Accessory Pages Access\" values must be unique. The fields used in these values can be found under \"Properties\" of an RO Group. Cannot save.","Problem saving data"); MessageBox.Show("The fields used for the \"Accessory Pages Access\" values must be unique. The fields used in these values can be found under \"Properties\" of an RO Group. Cannot save.", "Problem saving data");
ctlXMLEdit2.SetNotSaved(); ctlXMLEdit2.SetNotSaved();
tbtnRestore.Enabled = false; // can't restore data, may have saved tbtnRestore.Enabled = false; // can't restore data, may have saved
ctlXMLEdit2.RestoreInnerXml(savedInnerXML); //B2017-089 - restore the inner xml so orignial does not get new changes
return; return;
} }
} }
@ -2374,6 +2400,7 @@ namespace ROEditor
parent.RemoveChild(origro); parent.RemoveChild(origro);
tbtnRestore.Enabled = false; tbtnRestore.Enabled = false;
ctlXMLEdit2.SetNotSaved(); ctlXMLEdit2.SetNotSaved();
ctlXMLEdit2.RestoreInnerXml(savedInnerXML); //B2017-089 - restore the inner xml so orignial does not get new changes
return; return;
} }
if (acctmpl!=null)newro.SetAttribute("AccPageID", newro.GetAccPageIDString(acctmpl)); if (acctmpl!=null)newro.SetAttribute("AccPageID", newro.GetAccPageIDString(acctmpl));

View File

@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACE ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACE
CAAAAk1TRnQBSQFMAgEBAgEAAQQBAAEEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo CAAAAk1TRnQBSQFMAgEBAgEAARQBAAEUAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQA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AAEUAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -563,6 +563,12 @@ namespace ctlXMLEditLib
return false; return false;
} }
//B2015-089 - restore the inner xml data when user duplicated an RO and tried to save with out giving it a new setpoint ID (Accessory Page ID)
public void RestoreInnerXml(string savedInnerXml)
{
editelem.InnerXml = savedInnerXml;
}
// SaveData saves the data in the element which had been sent to the control. Return // SaveData saves the data in the element which had been sent to the control. Return
// true if success, false if fail. // true if success, false if fail.
public bool SaveData() public bool SaveData()