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:
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.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));