Added ErrorLog Message if a disconnected item is processed

Added logic to keep disconnected items from being displayed in the search results
If the user selects a disconnected item the code will display a message rather than crashing.
This commit is contained in:
Rich
2015-04-10 11:51:05 +00:00
parent 3754f2f00d
commit f7c265c388
2 changed files with 30 additions and 7 deletions

View File

@@ -122,7 +122,8 @@ namespace Volian.Controls.Library
btnOpenLibDoc.Enabled = false;
foreach (ItemInfo ii in dicnt.LibraryDocumentUsageList)
{
listBoxUsages.Items.Add(ii.MyProcedure.ToString() + " - " + ii.MyContent.Number + " " + ii.MyContent.Text);
if(ii.MyDocVersion!=null)
listBoxUsages.Items.Add(ii.MyProcedure.ToString() + " - " + ii.MyContent.Number + " " + ii.MyContent.Text);
}
btnPrint.Enabled = listBoxUsages.Items.Count > 0 ? true : false;
}
@@ -284,8 +285,14 @@ namespace Volian.Controls.Library
MessageBox.Show("No Content in this document");
return;
}
if (listBoxUsages.SelectedIndex < di.LibraryDocumentUsageList.Count && listBoxUsages.SelectedIndex >= 0)
_DisplayTabControl.OpenItem(di.LibraryDocumentUsageList[listBoxUsages.SelectedIndex]);
if (listBoxUsages.SelectedIndex < di.LibraryDocumentUsageList.Count && listBoxUsages.SelectedIndex >= 0)
{
ItemInfo ii = di.LibraryDocumentUsageList[listBoxUsages.SelectedIndex];
if (ii.MyDocVersion == null)
MessageBox.Show("This usage is not connected properly", "Disconnected Data", MessageBoxButtons.OK, MessageBoxIcon.Warning);
else
_DisplayTabControl.OpenItem(ii);
}
_ProcessingSelectedValueChanged = false;
}
}