From 83c3a69a89d5b694bf29a5db268e9d390471243f Mon Sep 17 00:00:00 2001 From: John Date: Thu, 2 Feb 2017 18:44:40 +0000 Subject: [PATCH] =?UTF-8?q?B2015-089=20Restore=20inner=20xml=20when=20ther?= =?UTF-8?q?e=20is=20a=20problem=20trying=20to=20save=20a=20duplicate=20RO,?= =?UTF-8?q?=20C2015-017=20=E2=80=93=20added=20red=20text=20that=20appears?= =?UTF-8?q?=20when=20Duplicate=20button=20is=20pressed.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Exe/RefObj/ROEditor/ROEditor.cs | 53 ++++++++++++++----- .../Exe/RefObj/ROEditor/ROEditor.resx | 4 +- .../LibSource/ctlXMLEditLib/ctlXMLEdit.cs | 6 +++ 3 files changed, 48 insertions(+), 15 deletions(-) diff --git a/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/ROEditor.cs b/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/ROEditor.cs index 5421addc..2d68a862 100644 --- a/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/ROEditor.cs +++ b/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/ROEditor.cs @@ -363,7 +363,17 @@ namespace ROEditor private System.Windows.Forms.TreeView roTreeView; private System.Windows.Forms.ListView roListView; 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 System.Windows.Forms.Panel panel2; @@ -376,6 +386,7 @@ namespace ROEditor private ToolBarButton tbtnDuplicate; private System.Windows.Forms.MenuItem menuItem2; private System.Windows.Forms.ImageList imageListToolBar; + private Label lblDuplicateRO; private ToolBarButton tbtnZoom; public Form1(string PassedInPath, string specificro) @@ -1148,6 +1159,7 @@ namespace ROEditor this.tbtnDuplicate = new System.Windows.Forms.ToolBarButton(); this.tbtnZoom = new System.Windows.Forms.ToolBarButton(); this.imageListToolBar = new System.Windows.Forms.ImageList(this.components); + this.lblDuplicateRO = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); this.SuspendLayout(); // @@ -1160,9 +1172,9 @@ namespace ROEditor // // 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.Size = new System.Drawing.Size(10, 588); + this.splitter1.Size = new System.Drawing.Size(8, 591); this.splitter1.TabIndex = 4; this.splitter1.TabStop = false; // @@ -1354,9 +1366,9 @@ namespace ROEditor this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.panel1.Controls.Add(this.panel2); 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.Size = new System.Drawing.Size(542, 588); + this.panel1.Size = new System.Drawing.Size(588, 591); this.panel1.TabIndex = 5; // // panel2 @@ -1364,7 +1376,7 @@ namespace ROEditor this.panel2.AutoScroll = true; this.panel2.Location = new System.Drawing.Point(0, 0); 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.Visible = false; // @@ -1375,10 +1387,10 @@ namespace ROEditor this.roTreeView.ImageIndex = 0; this.roTreeView.ImageList = this.imageListRoTree; 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.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.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.Name = "tbar"; 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.TextAlign = System.Windows.Forms.ToolBarTextAlign.Right; 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(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 // - 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.Controls.Add(this.lblDuplicateRO); this.Controls.Add(this.panel1); this.Controls.Add(this.splitter1); this.Controls.Add(this.roTreeView); @@ -2329,6 +2353,7 @@ namespace ROEditor bool success; VlnXmlElement newro = (VlnXmlElement) roTreeView.SelectedNode.Tag; VlnXmlElement origro = (VlnXmlElement) newro.Clone(); + string savedInnerXML = newro.InnerXml; XmlNode parent = newro.ParentNode; success = ctlXMLEdit2.SaveData(); if (!success) @@ -2353,13 +2378,14 @@ namespace ROEditor //isduplicateaccpageid needs no recid attribute for any new // ros (which is what we have hear for saveas or duplicate) newro.RemoveAttribute("RecID"); - dup = myrodb.IsDuplicateAccPageID(newro,newacc); + dup = myrodb.IsDuplicateAccPageID(newro, newacc); 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(); 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; } } @@ -2374,6 +2400,7 @@ namespace ROEditor parent.RemoveChild(origro); tbtnRestore.Enabled = false; ctlXMLEdit2.SetNotSaved(); + ctlXMLEdit2.RestoreInnerXml(savedInnerXML); //B2017-089 - restore the inner xml so orignial does not get new changes return; } if (acctmpl!=null)newro.SetAttribute("AccPageID", newro.GetAccPageIDString(acctmpl)); diff --git a/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/ROEditor.resx b/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/ROEditor.resx index f5122820..99e10a40 100644 --- a/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/ROEditor.resx +++ b/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/ROEditor.resx @@ -125,7 +125,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACE - CAAAAk1TRnQBSQFMAgEBAgEAAQQBAAEEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAARQBAAEUAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -175,7 +175,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAe - CwAAAk1TRnQBSQFMAgEBBgEAAQwBAAEEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CwAAAk1TRnQBSQFMAgEBBgEAARQBAAEUAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/PROMS/ReferencedObjects/LibSource/ctlXMLEditLib/ctlXMLEdit.cs b/PROMS/ReferencedObjects/LibSource/ctlXMLEditLib/ctlXMLEdit.cs index 276ac97c..4e510cbe 100644 --- a/PROMS/ReferencedObjects/LibSource/ctlXMLEditLib/ctlXMLEdit.cs +++ b/PROMS/ReferencedObjects/LibSource/ctlXMLEditLib/ctlXMLEdit.cs @@ -563,6 +563,12 @@ namespace ctlXMLEditLib 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 // true if success, false if fail. public bool SaveData()