Added MyItemInfo property

Fixed format of ToString for AnnotationAuditInfo
Fixed format of ToString for ContentAuditInfo
Fixed Restore if no next item
Fixed ActiveParent logic after restore
Added Timing logic and then Commented it
Fixed Logic when there is not a NextNode
Timing Debug code
Update UserID when saving annotation
Commented Timing Debug
Created and used FixPath - StepPath
Use MyItemInfo.SearchPath if Content doesn't have path
Refresh Change List from Timer.Tick
Added Timer for Refresh
Added code to refresh ChangeBar
Added and Commented timing debug
Changed logic for saving ROUsages
Added Closed Property that is set when the handle is destroyed
Don't refresh StepRTB if it is closed
This commit is contained in:
Rich
2011-08-23 14:14:14 +00:00
parent 472f4768b1
commit 2aeee7fdbc
11 changed files with 203 additions and 28 deletions

View File

@@ -300,6 +300,7 @@ namespace Volian.Controls.Library
annotation.SearchText = rtxbComment.Text;
annotation.MyAnnotationType = annotationType;
annotation.DTS = DateTime.Now;
annotation.UserID = Volian.Base.Library.VlnSettings.UserID;
annotation.Save();
}
}

View File

@@ -120,8 +120,8 @@ namespace Volian.Controls.Library
private void UpdateHistory()
{
this.Cursor = Cursors.WaitCursor;
DateTime start = DateTime.Now;
Console.WriteLine(start);
//DateTime start = DateTime.Now;
//Console.WriteLine(start);
#region setup
btnRestore.Enabled = false;
myRTB.Clear();
@@ -380,15 +380,15 @@ namespace Volian.Controls.Library
tnn.Tag = iai;
#endregion
}
Console.WriteLine("UpdateHistory: {0} seconds",TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds);
//Console.WriteLine("UpdateHistory: {0} seconds",TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds);
this.Cursor = Cursors.Default;
}
private void WalkProcedure()
{
//return;
this.Cursor = Cursors.WaitCursor;
DateTime start = DateTime.Now;
Console.WriteLine(start);
//DateTime start = DateTime.Now;
//Console.WriteLine(start);
lbChanges.Items.Clear();
if (MyProcedureInfo == null)
{
@@ -397,17 +397,16 @@ namespace Volian.Controls.Library
return;
}
ContentAuditInfoList cail2 = ContentAuditInfoList.GetChronology(MyProcedureInfo.ItemID, MyProcedureInfo.ItemID, false);
Console.WriteLine("WalkProcedure cail2: {0} seconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds);
//Console.WriteLine("WalkProcedure cail2: {0} seconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds);
_ChronologyAuditList = cail2;
ContentAuditInfoList cail3 = ContentAuditInfoList.GetSummary(MyProcedureInfo.ItemID, MyProcedureInfo.ItemID, false);
_SummaryAuditList = cail3;
AnnotationAuditInfoList aail2 = AnnotationAuditInfoList.GetChronology(MyProcedureInfo.ItemID, MyProcedureInfo.ItemID);
Console.WriteLine("WalkProcedure aail2: {0} seconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds);
//Console.WriteLine("WalkProcedure aail2: {0} seconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds);
_AnnotationList = aail2;
foreach (ContentAuditInfo cai in cail2)
{
string itemTitle = Regex.Replace(cai.Path, "^..+?\\u0007", "");
itemTitle = itemTitle.Replace("\x11", itemTitle[0]=='\x11' ? "" : " - ");
string itemTitle = FixPath(cai.Path);
lbChanges.Items.Add(string.Format("{4} item {0} by {1} on {2} @ {3}", cai.ActionWhat, cai.UserID, cai.ActionWhen == DateTime.MinValue ? cai.DTS.ToShortDateString() : cai.ActionWhen.ToShortDateString(), cai.ActionWhen == DateTime.MinValue ? cai.DTS.ToShortTimeString() : cai.ActionWhen.ToShortTimeString(), itemTitle));
}
foreach (AnnotationAuditInfo aai in aail2)
@@ -417,13 +416,19 @@ namespace Volian.Controls.Library
{
if (cai.ContentID == aai.IContentID)
{
stepnum = Regex.Replace(cai.Path, "^..+?\\u0007.", "");
stepnum = FixPath(cai.Path);
break;
}
}
lbChanges.Items.Add(string.Format("{4} Annotation {0} by {1} on {2} @ {3}", aai.ActionWhat, aai.UserID, aai.ActionWhen.ToShortDateString(), aai.ActionWhen.ToShortTimeString(), stepnum));
if (stepnum == string.Empty)
{
ItemInfo iii = aai.MyItemInfo;
if(iii != null)
stepnum = FixPath(iii.SearchPath);
}
lbChanges.Items.Add(string.Format("{0} Annotation {1}", stepnum, aai.ToString()));
}
Console.WriteLine("WalkProcedure fini: {0} seconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds);
//Console.WriteLine("WalkProcedure fini: {0} seconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds);
this.Cursor = Cursors.Default;
btnViewSummaryReport.Enabled = btnViewChronologyReport.Enabled = lbChanges.Items.Count > 0;
return;
@@ -559,6 +564,12 @@ namespace Volian.Controls.Library
}
btnViewSummaryReport.Enabled = btnViewChronologyReport.Enabled = lbChanges.Items.Count > 0;
}
private static string FixPath(string path)
{
string itemTitle = Regex.Replace(path, "^..+?\\u0007", "");
itemTitle = itemTitle.Replace("\x11", itemTitle[0] == '\x11' ? "" : " - ").Replace("\\u8209?", "-");
return itemTitle;
}
private void btnViewChronologyReport_Click(object sender, EventArgs e)
{
//if (lbChanges.Items.Count > 0)
@@ -596,7 +607,7 @@ namespace Volian.Controls.Library
ItemAuditInfo iai = tn.Tag as ItemAuditInfo;
if (MessageBox.Show(this, string.Format("Do you want to restore this {0}?",iai.ItemType), string.Format("Confirm {0} Restore",iai.ItemType), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
{
Console.WriteLine("DisplayHistory.btnRestore_Click @ {0}", DateTime.Now);
//Console.WriteLine("DisplayHistory.btnRestore_Click @ {0}", DateTime.Now);
ItemInfo ii = null;
if (iai.Level == 2)
{
@@ -829,6 +840,17 @@ namespace Volian.Controls.Library
{
if(this.Visible)this.RefreshList();
}
public void RefreshChangeList()
{
myTimer.Enabled = false;
myTimer.Enabled = true;
}
private void myTimer_Tick(object sender, System.EventArgs e)
{
myTimer.Enabled = false;
RefreshList();
}
}
public delegate void ItemRestoredHandler(ItemInfo restoredItemInfo);

View File

@@ -195,6 +195,7 @@ namespace Volian.Controls.Library
{
// Update the text to reflect the content change
MyItemInfo.RefreshItemAnnotations();
ChangeBar = MyItemInfo.HasChangeBar;
RefreshContent();
}
void value_OrdinalChanged(object sender)
@@ -544,29 +545,40 @@ namespace Volian.Controls.Library
}
public void RemoveItem()
{
//Volian.Base.Library.VlnTimer _MyTimer = new VlnTimer();
BeingRemoved = true;
MyStepPanel.SelectedEditItem = null; // Unselect the item to be deleted
//ShowTops("\r\n");
int TopMostYBefore = TopMostEditItem.Top;
//_MyTimer.ActiveProcess = "DeleteItem";
EditItem newFocus = DeleteItem();
if (newFocus == null) return;
//_MyTimer.ActiveProcess = "SetFocus";
newFocus.SetFocus();
//_MyTimer.ActiveProcess = "Dispose";
Dispose();
//_MyTimer.ActiveProcess = "SetAllTabs";
newFocus.SetAllTabs();
//_MyTimer.ActiveProcess = "TopMostYAfter";
int TopMostYAfter = newFocus.TopMostEditItem.Top;
if (TopMostYAfter > TopMostYBefore)
newFocus.TopMostEditItem.Top = TopMostYBefore;
//_MyTimer.ActiveProcess = "AdjustLocation";
newFocus.AdjustLocation();
//newFocus.ShowTops("");
//_MyTimer.ShowElapsedTimes("RemoveItem");
}
public EditItem DeleteItem()
{
//Volian.Base.Library.VlnTimer _MyTimer = new VlnTimer();
//_MyTimer.ActiveProcess = "_LookupEditItems.Remove";
MyStepPanel._LookupEditItems.Remove(MyID);
EditItem newFocus = null;
int? TopMostParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.TopMostEditItem.Top));
int? ParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.Top));
try
{
//_MyTimer.ActiveProcess = "DeleteItemAndChildren";
Item.DeleteItemAndChildren(MyItemInfo);
}
catch (System.Data.SqlClient.SqlException ex)
@@ -575,7 +587,9 @@ namespace Volian.Controls.Library
return null;
}
// Remove EditItems
//_MyTimer.ActiveProcess = "RemoveFromParentsChildList";
RemoveFromParentsChildList();
//_MyTimer.ActiveProcess = "MyNextEditItem";
if (MyNextEditItem != null)
{
if (MyPreviousEditItem != null)
@@ -608,6 +622,7 @@ namespace Volian.Controls.Library
MyParentEditItem = null;
//Console.Write(",\"Parent\",");
}
//_MyTimer.ShowElapsedTimes("DeleteItem");
return newFocus;
}

View File

@@ -509,20 +509,20 @@ namespace Volian.Controls.Library
MyStepRTB.ClearUndo();
}
}
private string DoLinkForRoTable()
private string DoLinkForRoTable(Item itm)
{
// if no ro has been defined yet, just return null
if (MyFlexGrid.ROID == null) return null;
ContentRoUsage rousg = null;
using (Item itm = MyItemInfo.Get())
{
// using (Item itm = MyItemInfo.Get())
// {
using (RODb rodb = RODb.GetJustRoDb(MyFlexGrid.RODbId))
{
string padroid = (MyFlexGrid.ROID.Length <= 12) ? MyFlexGrid.ROID + "0000" : MyFlexGrid.ROID;
rousg = itm.MyContent.ContentRoUsages.Add(MyFlexGrid.ROID, rodb);
}
itm.Save();
}
//itm.Save();
// }
MyItemInfo.MyContent.RefreshContentRoUsages();
return string.Format(@"#Link:ReferencedObject:{0} {1} {2}", rousg.ROUsageID, MyFlexGrid.ROID, MyFlexGrid.RODbId);
}
@@ -566,7 +566,7 @@ namespace Volian.Controls.Library
// been saved.
if (MyFlexGrid.IsRoTable && MyFlexGrid.ROID != null && itm.MyContent.ContentRoUsageCount < 1)
{
searchableText = string.Format(@"\v<START]\v0 {0} \v {1}[END>\v0 ", searchableText, DoLinkForRoTable());
searchableText = string.Format(@"\v<START]\v0 {0} \v {1}[END>\v0 ", searchableText, DoLinkForRoTable(itm));
//if (itm.MyContent.Text != searchableText)
//{
itm.MyContent.Text = searchableText;

View File

@@ -372,8 +372,15 @@ namespace Volian.Controls.Library
}
public void RefreshDisplay()
{
if (Disposing) return;
RefreshDisplay(ActiveMode);
if (Closed) return;
try
{
RefreshDisplay(ActiveMode);
}
catch (Exception ex)
{
_MyLog.Error(string.Format("MyItemInfo: {0} - {1} Problem doing RefreshDisplay",MyItemInfo.ItemID,MyItemInfo.ShortPath), ex);
}
}
// RefreshDisplay is used to update the rtb for an entire Item as defined by MyItemInfo.
public void RefreshDisplay(bool activeMode)
@@ -576,6 +583,7 @@ namespace Volian.Controls.Library
this.SelectionChanged -= new EventHandler(StepRTB_SelectionChanged);
this.ContextMenuStripChanged -= new EventHandler(StepRTB_ContextMenuStripChanged);
this.RTBSelectionChanged -= new StepRTBEvent(StepRTB_RTBSelectionChanged);
this.HandleDestroyed -= new EventHandler(StepRTB_HandleDestroyed);
}
private void AddEventHandlers()
{
@@ -594,6 +602,18 @@ namespace Volian.Controls.Library
this.SelectionChanged +=new EventHandler(StepRTB_SelectionChanged);
this.ContextMenuStripChanged += new EventHandler(StepRTB_ContextMenuStripChanged);
this.RTBSelectionChanged += new StepRTBEvent(StepRTB_RTBSelectionChanged);
this.HandleDestroyed += new EventHandler(StepRTB_HandleDestroyed);
}
private bool _Closed = false;
public bool Closed
{
get { return _Closed; }
set { _Closed = value; }
}
void StepRTB_HandleDestroyed(object sender, EventArgs e)
{
Closed = true;
RemoveEventHandlers();
}
void StepRTB_RTBSelectionChanged(object sender, EventArgs args)
{