Debug - Split a line into multiple lines to determine the cause of an error.

Debug - Added logic so that focus is not given to an object that is being disposed.
This commit is contained in:
Rich 2010-12-17 12:12:53 +00:00
parent 1757d238d5
commit dd802ce319
2 changed files with 18 additions and 3 deletions

View File

@ -57,7 +57,14 @@ namespace VEPROMS
}
else // Step Tab Panel
{
SelectedDVI = value.MyStepPanel.MyProcedureItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
// The following line was broken into separate lines because a NullReferenceError was occuring.
// Now we should be able to tell what is wrong by which line causes the Null Reference Error
// RHM 20101217
//SelectedDVI = value.MyStepPanel.MyProcedureItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
StepPanel stepPanel = value.MyStepPanel;
ItemInfo itemInfo = stepPanel.MyProcedureItemInfo;
ProcedureInfo procedureInfo = itemInfo.MyProcedure;
SelectedDVI = procedureInfo.ActiveParent as DocVersionInfo;
// Remove it first, if it wasn't set, this doesn't do anything, but if it was set, you don't want
// multiple events because the print dialog will be displayed for each time the event was added.
_SelectedStepTabPanel.MyStepTabRibbon.PrintRequest -= new StepTabRibbonEvent(MyStepTabRibbon_PrintRequest);

View File

@ -2161,8 +2161,16 @@ namespace Volian.Controls.Library
/// </summary>
public void ItemSelect()
{
_MyStepRTB.Focus();
_MyStepRTB.Select(0, 0);
// Was getting an Error that _MyStepRTB was Disposed RHM 20101217
if (!_MyStepRTB.Disposing)
{
_MyStepRTB.Focus();
_MyStepRTB.Select(0, 0);
}
else
{
_MyLog.WarnFormat("Attempt to give Focus to Disposed Object {0}", MyID);
}
// if (CanExpand) AutoExpand(); // Expand the item if you can
ScrollToCenter();
}