I can't seem to wire up IActiveViewEvents for an IDockableWindow. I am using a straight out-of-the-box IDockableWindow which inherits BaseCommand. The snippet below shows what I have added to the autogenerated code. Problem is, when I try to run ArcMap, it (the main ArcMap GUI) never loads. Please see attached screenshot to see what I mean.
public override void OnCreate(object hook)
{
if (hook != null)
m_application = hook as IApplication;
if (m_application != null)
{
SetupDockableWindow();
base.m_enabled = m_dockableWindow != null;
}
else
base.m_enabled = false;
IMxDocument mxDoc = (IMxDocument)m_application.Document;
IActiveViewEvents_Event activeViewEvents = mxDoc.ActiveView as IActiveViewEvents_Event;
activeViewEvents.ViewRefreshed += new IActiveViewEvents_ViewRefreshedEventHandler(activeViewEvents_ViewRefreshed);
}
void activeViewEvents_ViewRefreshed(IActiveView view, esriViewDrawPhase phase, object Data, ESRI.ArcGIS.Geometry.IEnvelope envelope)
{
MessageBox.Show("ViewRefreshed");
}
No comments:
Post a Comment