Added code to handle Table ROs.

Used generic (static) VlnFlexGrid.ROTableUpdate to determine if the table contents are updated.
Added Error Handling around the code that shuts down PROMs
Added function to ROFSTLookup to retrieve the Accessory Page ID.
Corrected code to handle value changes for Table ROs
Created generic (static) VlnFlexGrid.ROTableUpdate to determine if the table contents are updated.
This commit is contained in:
Rich
2014-03-19 15:30:26 +00:00
parent cf79d6a313
commit 0376212e09
9 changed files with 200 additions and 109 deletions

View File

@@ -591,7 +591,10 @@ namespace Volian.Controls.Library
ContentAuditInfo cai = tn.Tag as ContentAuditInfo;
if (MessageBox.Show(this, "Do you want to restore this content change?", "Confirm Content Change Restore", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
{
ContentInfo ci = ContentInfo.RestoreContent(cai);
ROFstInfo myRoFst = MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst;
myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
ContentInfo ci = ContentInfo.RestoreContent(cai,myRoFst);
myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
RefreshRequired = true;
UpdateHistory();
myRTB.Clear();
@@ -609,8 +612,10 @@ namespace Volian.Controls.Library
ItemInfo ii = null;
if (iai.Level == 2)
{
ii = MyItemInfo.RestoreItem(iai);
ROFstInfo myRoFst = MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst;
myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
ii = MyItemInfo.RestoreItem(iai,myRoFst);
myRoFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
//_MyEditItem.AddChild((E_FromType)fromtype, contenttype);
//ii.ItemParts[0].FromType
//ii.MyContent.Type
@@ -674,7 +679,10 @@ namespace Volian.Controls.Library
}
else
{
ii = MyItemInfo.RestoreSibling(iai);
ROFstInfo myRoFst = MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst;
myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
ii = MyItemInfo.RestoreSibling(iai,myRoFst);
myRoFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
if (ii.IsStep)
ii = StepInfo.Get(ii.ItemID);
else if (ii.IsSection)
@@ -729,7 +737,10 @@ namespace Volian.Controls.Library
if (MessageBox.Show(this, "Do you want to restore this table?", "Confirm Table Restore", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
{
ContentAuditInfo cai = ContentAuditInfo.Get(gai.ContentAuditID);
ContentInfo ci = ContentInfo.RestoreContent(cai);
ROFstInfo myRoFst = MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst;
myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
ContentInfo ci = ContentInfo.RestoreContent(cai,myRoFst);
myRoFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
RefreshRequired = true;
UpdateHistory();
myRTB.Clear();
@@ -737,6 +748,11 @@ namespace Volian.Controls.Library
}
}
}
List<string> myRoFst_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
{
return VlnFlexGrid.ROTableUpdate(sender, args);
}
private void DisplayTagRTF(TreeNode tn)
{
if (tn.Tag != null)

View File

@@ -1759,45 +1759,46 @@ namespace Volian.Controls.Library
public List<string> roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
{
string xml = null;
string srchtxt = null;
Content content = (Content)sender;
using (VlnFlexGrid myGrid = new VlnFlexGrid(content.ContentItems[0]))
{
using (StringReader sr = new StringReader(args.OldGridXml))
{
myGrid.ReadXml(sr);
sr.Close();
}
string roid = content.ContentRoUsages[0].ROID; //myGrid.ROID;
int rodbid = content.ContentRoUsages[0].RODbID; //myGrid.RODbId;
////Font GridFont = myGrid.Font;
//myGrid.MergedRanges.Clear();
//myGrid.Clear();
//myGrid.ParseTableFromText(args.ROText);
//myGrid.AutoSizeCols();
//myGrid.AutoSizeRows();
//myGrid.MakeRTFcells();
//myGrid.RODbId = rodbid;
//myGrid.ROID = roid;
//myGrid.IsRoTable = true;
myGrid.Visible = false;
myGrid.ConvertTableROToGrid(args.ROText, rodbid, roid);
myGrid.FixTableCellsHeightWidth();
myGrid.AdjustGridControlSize();
myGrid.Visible = true;
using (StringWriter sw = new StringWriter())
{
myGrid.WriteXml(sw);
xml = sw.GetStringBuilder().ToString();
sw.Close();
}
srchtxt = myGrid.GetSearchableText();
}
List<string> retlist = new List<string>();
retlist.Add(srchtxt);
retlist.Add(xml);
return retlist;
return VlnFlexGrid.ROTableUpdate(sender, args);
//string xml = null;
//string srchtxt = null;
//Content content = (Content)sender;
//using (VlnFlexGrid myGrid = new VlnFlexGrid(content.ContentItems[0]))
//{
// using (StringReader sr = new StringReader(args.OldGridXml))
// {
// myGrid.ReadXml(sr);
// sr.Close();
// }
// string roid = content.ContentRoUsages[0].ROID; //myGrid.ROID;
// int rodbid = content.ContentRoUsages[0].RODbID; //myGrid.RODbId;
// ////Font GridFont = myGrid.Font;
// //myGrid.MergedRanges.Clear();
// //myGrid.Clear();
// //myGrid.ParseTableFromText(args.ROText);
// //myGrid.AutoSizeCols();
// //myGrid.AutoSizeRows();
// //myGrid.MakeRTFcells();
// //myGrid.RODbId = rodbid;
// //myGrid.ROID = roid;
// //myGrid.IsRoTable = true;
// myGrid.Visible = false;
// myGrid.ConvertTableROToGrid(args.ROText, rodbid, roid);
// myGrid.FixTableCellsHeightWidth();
// myGrid.AdjustGridControlSize();
// myGrid.Visible = true;
// using (StringWriter sw = new StringWriter())
// {
// myGrid.WriteXml(sw);
// xml = sw.GetStringBuilder().ToString();
// sw.Close();
// }
// srchtxt = myGrid.GetSearchableText();
//}
//List<string> retlist = new List<string>();
//retlist.Add(srchtxt);
//retlist.Add(xml);
//return retlist;
}
private void rtabAdmin_Click(object sender, EventArgs e)

View File

@@ -114,10 +114,10 @@ namespace Volian.Controls.Library
{
get
{
return IsGridChanged(this._MyItemInfo.MyContent.MyGrid.Data, this.GetXMLData());
return IsGridChanged(this._MyItemInfo.MyContent.MyGrid.Data, this.GetXMLData(), true);
}
}
private bool IsGridChanged(string oldXml, string newXml)
private bool IsGridChanged(string oldXml, string newXml, bool checkFormat)
{
if (this.TableCellEditor.Text.Contains("<NewID>"))
return false;
@@ -126,16 +126,16 @@ namespace Volian.Controls.Library
XmlDocument XdNew = new XmlDocument();
XdNew.LoadXml(AdjustHeightAndWidthForDPI(newXml));
//check volian borders 1st
if (XdNew.SelectSingleNode("C1FlexGrid/Control/MyBorderDetailString").InnerText != XdOld.SelectSingleNode("C1FlexGrid/Control/MyBorderDetailString").InnerText)
if (checkFormat && XdNew.SelectSingleNode("C1FlexGrid/Control/MyBorderDetailString").InnerText != XdOld.SelectSingleNode("C1FlexGrid/Control/MyBorderDetailString").InnerText)
return true;
//check row/col sizes 2nd
if (GetRowColSizeString(XdNew) != GetRowColSizeString(XdOld))
if (checkFormat && ( GetRowColSizeString(XdNew) != GetRowColSizeString(XdOld)))
return true;
//check for cell data changes 3rd
if (GetCellDataString(XdNew) != GetCellDataString(XdOld))
return true;
//check for cell format changes 4th
if (GetCellFormatString(XdNew) != GetCellFormatString(XdOld))
if (checkFormat && GetCellFormatString(XdNew) != GetCellFormatString(XdOld))
return true;
//check for merged cells 5th
if (GetCellMergeString(XdNew) != GetCellMergeString(XdOld))
@@ -3589,7 +3589,43 @@ namespace Volian.Controls.Library
rtn = ofd.SafeFileName;
return rtn;
}
public static List<string> ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
{
string xml = null;
string srchtxt = null;
Content content = (Content)sender;
bool isdirty = false;
using (VlnFlexGrid myGrid = new VlnFlexGrid(content.ContentItems[0]))
{
using (StringReader sr = new StringReader(args.OldGridXml))
{
myGrid.ReadXml(sr);
sr.Close();
}
string roid = content.ContentRoUsages[0].ROID; //myGrid.ROID;
int rodbid = content.ContentRoUsages[0].RODbID; //myGrid.RODbId;
myGrid.Visible = false;
myGrid.ConvertTableROToGrid(args.ROText, rodbid, roid);
myGrid.FixTableCellsHeightWidth();
myGrid.AdjustGridControlSize();
myGrid.Visible = true;
using (StringWriter sw = new StringWriter())
{
myGrid.WriteXml(sw);
xml = sw.GetStringBuilder().ToString();
sw.Close();
}
srchtxt = myGrid.GetSearchableText();
isdirty = myGrid.IsGridChanged(args.OldGridXml, xml, false);
}
List<string> retlist = new List<string>();
retlist.Add(srchtxt);
if(isdirty)
retlist.Add(xml);
else
retlist.Add(args.OldGridXml);
return retlist;
}
public void ConvertTableROToGrid(string valtext, int rodbid, string roid)
{
VE_Font vefont = _MyItemInfo.GetItemFont();

View File

@@ -1302,39 +1302,40 @@ namespace Volian.Controls.Library
}
public List<string> roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
{
string xml = null;
string srchtxt = null;
using (VlnFlexGrid myGrid = new VlnFlexGrid())
{
using (StringReader sr = new StringReader(args.OldGridXml))
{
myGrid.ReadXml(sr);
myGrid.KeyActionTab = C1.Win.C1FlexGrid.KeyActionEnum.MoveAcross;
sr.Close();
}
string roid = myGrid.ROID;
int rodbid = myGrid.RODbId;
Font GridFont = myGrid.Font;
myGrid.Clear();
myGrid.ParseTableFromText(args.ROText, GridLinePattern.Single);
myGrid.AutoSizeCols();
myGrid.AutoSizeRows();
myGrid.MakeRTFcells();
myGrid.RODbId = rodbid;
myGrid.ROID = roid;
myGrid.IsRoTable = true;
using (StringWriter sw = new StringWriter())
{
myGrid.WriteXml(sw);
xml = sw.GetStringBuilder().ToString();
sw.Close();
}
srchtxt = myGrid.GetSearchableText();
}
List<string> retlist = new List<string>();
retlist.Add(srchtxt);
retlist.Add(xml);
return retlist;
return VlnFlexGrid.ROTableUpdate(sender, args);
//string xml = null;
//string srchtxt = null;
//using (VlnFlexGrid myGrid = new VlnFlexGrid())
//{
// using (StringReader sr = new StringReader(args.OldGridXml))
// {
// myGrid.ReadXml(sr);
// myGrid.KeyActionTab = C1.Win.C1FlexGrid.KeyActionEnum.MoveAcross;
// sr.Close();
// }
// string roid = myGrid.ROID;
// int rodbid = myGrid.RODbId;
// Font GridFont = myGrid.Font;
// myGrid.Clear();
// myGrid.ParseTableFromText(args.ROText, GridLinePattern.Single);
// myGrid.AutoSizeCols();
// myGrid.AutoSizeRows();
// myGrid.MakeRTFcells();
// myGrid.RODbId = rodbid;
// myGrid.ROID = roid;
// myGrid.IsRoTable = true;
// using (StringWriter sw = new StringWriter())
// {
// myGrid.WriteXml(sw);
// xml = sw.GetStringBuilder().ToString();
// sw.Close();
// }
// srchtxt = myGrid.GetSearchableText();
//}
//List<string> retlist = new List<string>();
//retlist.Add(srchtxt);
//retlist.Add(xml);
//return retlist;
}
private void RunROEditor(VETreeNode tn)