Added logic to default the History Tab to Change Details rather than Change List.
Added logic to return to Change Details after editing a step. Added event handler when ChangeList tab is made active (visible). Removed event handler for the History Panel.
This commit is contained in:
parent
74c96fb09c
commit
4056f5fd96
@ -55,6 +55,7 @@ namespace Volian.Controls.Library
|
|||||||
if (value is ProcedureInfo && _MyProcedureInfo is ProcedureInfo && value.ItemID == _MyProcedureInfo.ItemID)
|
if (value is ProcedureInfo && _MyProcedureInfo is ProcedureInfo && value.ItemID == _MyProcedureInfo.ItemID)
|
||||||
return;
|
return;
|
||||||
_MyProcedureInfo = value;
|
_MyProcedureInfo = value;
|
||||||
|
if (value == null) return;
|
||||||
if (_MyProcedureInfo != null && this.Visible)
|
if (_MyProcedureInfo != null && this.Visible)
|
||||||
WalkProcedure();
|
WalkProcedure();
|
||||||
}
|
}
|
||||||
@ -72,8 +73,11 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
MyProcedureInfo = _MyItemInfo.MyProcedure;
|
MyProcedureInfo = _MyItemInfo.MyProcedure;
|
||||||
this.Visible = true;
|
this.Visible = true;
|
||||||
if (this.Visible)
|
UpdateHistory();
|
||||||
UpdateHistory();
|
if (this.lbChanges.Visible && RefreshRequired)
|
||||||
|
{
|
||||||
|
WalkProcedure();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.Visible = false;
|
this.Visible = false;
|
||||||
@ -103,12 +107,24 @@ namespace Volian.Controls.Library
|
|||||||
UpdateHistory();
|
UpdateHistory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private bool RefreshRequired = false;
|
||||||
|
|
||||||
public DisplayHistory()
|
public DisplayHistory()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
myRTB.FormatFont = null;
|
myRTB.FormatFont = null;
|
||||||
tabControl1.SelectedTab = tabItem1;// Start with Change List
|
RefreshRequired = true;
|
||||||
|
//tabControl1.SelectedTab = tabItem1;// Start with Change List
|
||||||
|
}
|
||||||
|
|
||||||
|
private void lbChanges_VisibleChanged(object sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
if (RefreshRequired)
|
||||||
|
{
|
||||||
|
Console.WriteLine("before walkprocedure - {0}", DateTime.Now.ToLongTimeString());
|
||||||
|
WalkProcedure();
|
||||||
|
Console.WriteLine("after walkprocedure - {0}", DateTime.Now.ToLongTimeString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lbChanges_SelectedIndexChanged(object sender, EventArgs e)
|
private void lbChanges_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
@ -400,7 +416,7 @@ namespace Volian.Controls.Library
|
|||||||
private void WalkProcedure()
|
private void WalkProcedure()
|
||||||
{
|
{
|
||||||
//return;
|
//return;
|
||||||
this.Cursor = Cursors.WaitCursor;
|
this.ParentForm.Cursor = Cursors.WaitCursor;
|
||||||
//DateTime start = DateTime.Now;
|
//DateTime start = DateTime.Now;
|
||||||
//Console.WriteLine(start);
|
//Console.WriteLine(start);
|
||||||
lbChanges.Items.Clear();
|
lbChanges.Items.Clear();
|
||||||
@ -447,140 +463,10 @@ namespace Volian.Controls.Library
|
|||||||
lbChanges.Items.Add(aai);
|
lbChanges.Items.Add(aai);
|
||||||
}
|
}
|
||||||
//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;
|
this.ParentForm.Cursor = Cursors.Default;
|
||||||
btnViewSummaryReport.Enabled = btnViewChronologyReport.Enabled = lbChanges.Items.Count > 0;
|
btnViewSummaryReport.Enabled = btnViewChronologyReport.Enabled = lbChanges.Items.Count > 0;
|
||||||
|
RefreshRequired = false;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string itemType = string.Empty;
|
|
||||||
lbChanges.Items.Clear();
|
|
||||||
ItemInfo myproc = _MyItemInfo.MyProcedure;
|
|
||||||
ItemInfo ii = myproc;
|
|
||||||
int lenNumber = myproc.DisplayNumber.Length + 2;
|
|
||||||
if (ii == null) return;
|
|
||||||
while (ii != null && ii.MyProcedure.ItemID == myproc.ItemID)
|
|
||||||
{
|
|
||||||
itemType = ii.IsCaution ? "Caution for" : ii.IsNote ? "Note for" : ii.IsStep ? "Step" : "Item";
|
|
||||||
//items
|
|
||||||
if (ii.IsItemNew)
|
|
||||||
{
|
|
||||||
lbChanges.Items.Add(string.Format("{4} {0} added by {1} on {2} @ {3}", ii.ShortPath.Substring(lenNumber), ii.UserID, ii.DTS.ToShortDateString(), ii.DTS.ToShortTimeString(), itemType));
|
|
||||||
//int k = lbChanges.Items.Add(string.Format("{0} @ {1} - {2}", "Item Added", ii.DTS.ToString(), ii.DisplayText));
|
|
||||||
//ListViewItem lvi = new ListViewItem("Item Added");
|
|
||||||
//lvi.SubItems.Add(ii.ItemID.ToString());
|
|
||||||
//lvi.SubItems.Add(ii.DTS.ToString());
|
|
||||||
//lvi.SubItems.Add(ii.DisplayText);
|
|
||||||
//lvi.SubItems.Add(ii.ShortPath.Substring(lenNumber));
|
|
||||||
//listView1.Items.Add(lvi);
|
|
||||||
if (ii.IsItemChanged)
|
|
||||||
{
|
|
||||||
ContentAuditInfoList cail = ContentAuditInfoList.Get(ii.ContentID);
|
|
||||||
if (cail.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (ContentAuditInfo cai in cail)
|
|
||||||
{
|
|
||||||
if (cai.Text != string.Empty)
|
|
||||||
{
|
|
||||||
lbChanges.Items.Add(string.Format("{4} {0} changed by {1} on {2} @ {3}", ii.ShortPath.Substring(lenNumber), ii.MyContent.UserID, ii.MyContent.DTS.ToShortDateString(), ii.MyContent.DTS.ToShortTimeString(), itemType));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (ii.IsItemChanged)
|
|
||||||
{
|
|
||||||
//Results.Add(ii);
|
|
||||||
lbChanges.Items.Add(string.Format("{4} {0} changed by {1} on {2} @ {3}", ii.ShortPath.Substring(lenNumber), ii.MyContent.UserID, ii.MyContent.DTS.ToShortDateString(), ii.MyContent.DTS.ToShortTimeString(), itemType));
|
|
||||||
//int k = lbChanges.Items.Add(string.Format("{0} @ {1} - {2}", "Content Changed", ii.DTS.ToString(), ii.DisplayText));
|
|
||||||
//ListViewItem lvi = new ListViewItem("Item Changed");
|
|
||||||
//lvi.SubItems.Add(ii.ItemID.ToString());
|
|
||||||
//lvi.SubItems.Add(ii.MyContent.DTS.ToString());
|
|
||||||
//lvi.SubItems.Add(ii.DisplayText);
|
|
||||||
//lvi.SubItems.Add(ii.ShortPath.Substring(lenNumber));
|
|
||||||
//listView1.Items.Add(lvi);
|
|
||||||
}
|
|
||||||
ItemAuditInfoList iail = ItemAuditInfoList.Get(ii.ItemID);
|
|
||||||
foreach (ItemAuditInfo iai in iail)
|
|
||||||
{
|
|
||||||
if (iai.DeleteStatus > 0 && iai.Level == 1)
|
|
||||||
{
|
|
||||||
lbChanges.Items.Add(string.Format("{4} after {0} deleted by {1} on {2} @ {3}", ii.ShortPath.Substring(lenNumber), iai.UserID, iai.DTS.ToShortDateString(), iai.DTS.ToShortTimeString(), itemType));
|
|
||||||
//int k = lbChanges.Items.Add(string.Format("{0} @ {1} - {2}", "Item Deleted", ii.DTS.ToString(), "TODO: figure out how to get iai.DisplayText"));
|
|
||||||
//ListViewItem lvi = new ListViewItem("Item Deleted");
|
|
||||||
//lvi.SubItems.Add(iai.ItemID.ToString());
|
|
||||||
//lvi.SubItems.Add(iai.DTS.ToString()); //iai.MyContent.DTS.ToString()
|
|
||||||
//lvi.SubItems.Add("TODO: figure out how to get iai.DisplayText"); //TODO: figure out how to get iai.DisplayText
|
|
||||||
//lvi.SubItems.Add("After " + ii.ShortPath.Substring(lenNumber));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PartAuditInfoList pail = null;
|
|
||||||
pail = PartAuditInfoList.GetByItemID(iai.ItemID);
|
|
||||||
if (pail.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (PartAuditInfo pai in pail)
|
|
||||||
{
|
|
||||||
itemType = pai.FromType == 3 ? "Caution for" : pai.FromType == 4 ? "Note for" : pai.FromType == 6 ? "Step" : "Item" + pai.FromType.ToString();
|
|
||||||
lbChanges.Items.Add(string.Format("{4} {0} deleted by {1} on {2} @ {3}", ii.ShortPath.Substring(lenNumber), iai.UserID, iai.DTS.ToShortDateString(), iai.DTS.ToShortTimeString(), itemType));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//annotations
|
|
||||||
if (ii.ItemAnnotations != null)
|
|
||||||
{
|
|
||||||
foreach (AnnotationInfo ai in ii.ItemAnnotations)
|
|
||||||
{
|
|
||||||
if (ai.IsAnnotationNew)
|
|
||||||
{
|
|
||||||
int k = lbChanges.Items.Add(string.Format("{0} @ {1} - {2}", "Annotation Added", ai.DTS.ToString(), ai.SearchText));
|
|
||||||
//ListViewItem lvi = new ListViewItem("Annotation Added");
|
|
||||||
//lvi.SubItems.Add(ai.AnnotationID.ToString());
|
|
||||||
//lvi.SubItems.Add(ai.DTS.ToString());
|
|
||||||
//lvi.SubItems.Add(ai.SearchText);
|
|
||||||
//lvi.SubItems.Add(ii.ShortPath.Substring(lenNumber));
|
|
||||||
//listView1.Items.Add(lvi);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int k = lbChanges.Items.Add(string.Format("{0} @ {1} - {2}", "Annotation Changed", ai.DTS.ToString(), ai.SearchText));
|
|
||||||
//ListViewItem lvi = new ListViewItem("Annotation Changed");
|
|
||||||
//lvi.SubItems.Add(ai.AnnotationID.ToString());
|
|
||||||
//lvi.SubItems.Add(ai.DTS.ToString());
|
|
||||||
//lvi.SubItems.Add(ai.SearchText);
|
|
||||||
//lvi.SubItems.Add(ii.ShortPath.Substring(lenNumber));
|
|
||||||
//listView1.Items.Add(lvi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AnnotationAuditInfoList aail = AnnotationAuditInfoList.GetByItemID(ii.ItemID);
|
|
||||||
foreach (AnnotationAuditInfo aai in aail)
|
|
||||||
{
|
|
||||||
if (aai.DeleteStatus > 0)
|
|
||||||
{
|
|
||||||
int k = lbChanges.Items.Add(string.Format("{0} @ {1} - {2}", "Annotation Deleted", aai.DTS.ToString(), aai.SearchText));
|
|
||||||
//ListViewItem lvi = new ListViewItem("Annotation Deleted");
|
|
||||||
//lvi.SubItems.Add(aai.AnnotationID.ToString());
|
|
||||||
//lvi.SubItems.Add(aai.DTS.ToString());
|
|
||||||
//lvi.SubItems.Add(aai.SearchText);
|
|
||||||
//lvi.SubItems.Add(ii.ShortPath.Substring(lenNumber));
|
|
||||||
//listView1.Items.Add(lvi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//content changes
|
|
||||||
//ContentAuditInfoList cail = ContentAuditInfoList.Get(ii.MyContent.ContentID);
|
|
||||||
//foreach (ContentAuditInfo cai in cail)
|
|
||||||
//{
|
|
||||||
// int k = lbChanges.Items.Add(string.Format("{0} @ {1} - {2}", "Content Changed", cai.DTS.ToString(), cai.Text));
|
|
||||||
//ListViewItem lvi = new ListViewItem("Content Changed");
|
|
||||||
//lvi.SubItems.Add(cai.ContentID.ToString());
|
|
||||||
//lvi.SubItems.Add(cai.DTS.ToString());
|
|
||||||
//lvi.SubItems.Add(cai.Text);
|
|
||||||
//lvi.SubItems.Add(ii.ShortPath.Substring(lenNumber));
|
|
||||||
//listView1.Items.Add(lvi);
|
|
||||||
//}
|
|
||||||
ii = ii.SearchNext;
|
|
||||||
}
|
|
||||||
btnViewSummaryReport.Enabled = btnViewChronologyReport.Enabled = lbChanges.Items.Count > 0;
|
|
||||||
}
|
}
|
||||||
private static string FixPath(string path)
|
private static string FixPath(string path)
|
||||||
{
|
{
|
||||||
@ -621,6 +507,7 @@ namespace Volian.Controls.Library
|
|||||||
if (MessageBox.Show(this, "Do you want to restore this content change?", "Confirm Content Change Restore", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
|
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);
|
ContentInfo ci = ContentInfo.RestoreContent(cai);
|
||||||
|
RefreshRequired = true;
|
||||||
UpdateHistory();
|
UpdateHistory();
|
||||||
myRTB.Clear();
|
myRTB.Clear();
|
||||||
myVFG.Clear();
|
myVFG.Clear();
|
||||||
@ -731,6 +618,7 @@ namespace Volian.Controls.Library
|
|||||||
MyEditItem.MyPreviousEditItem.SetAllTabs();
|
MyEditItem.MyPreviousEditItem.SetAllTabs();
|
||||||
else
|
else
|
||||||
MyEditItem.SetAllTabs();
|
MyEditItem.SetAllTabs();
|
||||||
|
RefreshRequired = true;
|
||||||
UpdateHistory();
|
UpdateHistory();
|
||||||
myRTB.Clear();
|
myRTB.Clear();
|
||||||
myVFG.Clear();
|
myVFG.Clear();
|
||||||
@ -742,6 +630,7 @@ namespace Volian.Controls.Library
|
|||||||
if (MessageBox.Show(this, "Do you want to restore this annotation?", "Confirm Annotation Restore", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
|
if (MessageBox.Show(this, "Do you want to restore this annotation?", "Confirm Annotation Restore", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
AnnotationInfo ai = AnnotationInfo.RestoreAnnotation(aai);
|
AnnotationInfo ai = AnnotationInfo.RestoreAnnotation(aai);
|
||||||
|
RefreshRequired = true;
|
||||||
OnAnnotationRestored(ai, ai.MyItem);
|
OnAnnotationRestored(ai, ai.MyItem);
|
||||||
UpdateHistory();
|
UpdateHistory();
|
||||||
myRTB.Clear();
|
myRTB.Clear();
|
||||||
@ -755,6 +644,7 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
ContentAuditInfo cai = ContentAuditInfo.Get(gai.ContentAuditID);
|
ContentAuditInfo cai = ContentAuditInfo.Get(gai.ContentAuditID);
|
||||||
ContentInfo ci = ContentInfo.RestoreContent(cai);
|
ContentInfo ci = ContentInfo.RestoreContent(cai);
|
||||||
|
RefreshRequired = true;
|
||||||
UpdateHistory();
|
UpdateHistory();
|
||||||
myRTB.Clear();
|
myRTB.Clear();
|
||||||
myVFG.Clear();
|
myVFG.Clear();
|
||||||
@ -858,11 +748,6 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
tvAudits.Height = ((tcpDetail.Height - btnRestore.Height) / 4) * 3;
|
tvAudits.Height = ((tcpDetail.Height - btnRestore.Height) / 4) * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DisplayHistory_VisibleChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if(this.Visible)this.RefreshList();
|
|
||||||
}
|
|
||||||
public void RefreshChangeList()
|
public void RefreshChangeList()
|
||||||
{
|
{
|
||||||
myTimer.Enabled = false;
|
myTimer.Enabled = false;
|
||||||
@ -871,7 +756,10 @@ namespace Volian.Controls.Library
|
|||||||
private void myTimer_Tick(object sender, System.EventArgs e)
|
private void myTimer_Tick(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
myTimer.Enabled = false;
|
myTimer.Enabled = false;
|
||||||
RefreshList();
|
if (this.lbChanges.Visible)
|
||||||
|
this.tabControl1.SelectedTab = tabItem2;
|
||||||
|
UpdateHistory();
|
||||||
|
RefreshRequired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
BIN
PROMS/Volian.Controls.Library/DisplayHistory.designer.cs
generated
BIN
PROMS/Volian.Controls.Library/DisplayHistory.designer.cs
generated
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user