///
/// Raises the event.
///
/// The smart part that is being closed.
protected WorkspaceCancelEventArgs RaiseSmartPartClosing(object smartPart)
{
if (smartPart is ElementHost)
{
smartPart = elementHosts.Unwrap((ElementHost)activeSmartPart);
}
WorkspaceCancelEventArgs cancelArgs = new WorkspaceCancelEventArgs(smartPart);
RaiseSmartPartClosing(cancelArgs);
return cancelArgs;
}
Felet var att variablen activeSmartPart skulle vara smartPart. Såg det genom att man kontrollerar smartPart innan man gör cast och eftersom activeSmartPart är WinForm SmartParten så smäller koden ur vid casten. Vilket innebär att koden ska se ut så här för att fungera:
///
/// Raises the event.
///
/// The smart part that is being closed.
protected WorkspaceCancelEventArgs RaiseSmartPartClosing(object smartPart)
{
if (smartPart is ElementHost)
{
smartPart = elementHosts.Unwrap((ElementHost)smartPart);
}
WorkspaceCancelEventArgs cancelArgs = new WorkspaceCancelEventArgs(smartPart);
RaiseSmartPartClosing(cancelArgs);
return cancelArgs;
}
No comments:
Post a Comment