Select to view content in your preferred language

OnCreate Method not Firing

2249
1
09-25-2013 05:27 AM
pra
by
New Contributor
Hi,
        I have a below code in my project and I tried to create an instance of TrackChartToo  class.

        TrackChartToo objTrackChartToo  = new TrackChartToo();

        But OnCreate method is never fired.
        Please let me know how to solve this issue.


namespace TrackArchitect.Exporter
{
      /// <summary>
   /// An ESRI toolbar button that allows the
   /// user to export a series of map portraits.
   /// </summary>
   public class TrackChartToo : BaseCommand
   {
      /// <summary>
      /// The ESRI Application
      /// </summary>
      private IMxApplication ESRIApplication { get; set; }

      /// <summary>
      ///
      /// </summary>
      private IMxDocument MxDocument { get; set; }

      /// <summary>
      /// The TrackPrintTool constructor.
      /// </summary>
      public TrackChartToo()
      {

          try
          {


              base.m_category = "Track Chart Too!";
              base.m_caption = "Exporting to Visio";
              base.m_message = "Track Map Export";
              base.m_toolTip =
                 "Push to begin the TrackChartToo " +
                 "Map Export to the Visio format.";


              Assembly a = Assembly.GetCallingAssembly();

              Stream imgStream = a.GetManifestResourceStream(
                 "TrackArchitect.Images.TrackChart.ico");

              base.m_bitmap = new System.Drawing.Bitmap(imgStream);
          }

          catch (Exception ex)
          {
             
          }
      }

      /// <summary>
      ///
      /// </summary>
      /// <param name="hook"></param>
      public override void OnCreate( object hook )
      {
          if (hook != null)
          {
              if (hook is IMxApplication)
              {
                  ESRIApplication = (IMxApplication)hook;

                  MxDocument = (IMxDocument)((IApplication)ESRIApplication).Document;

              }
          }
           
        
      }

}

}
0 Kudos
1 Reply
KatherineDalton
Esri Regular Contributor
Hello,

It looks like this is actually an ArcMap question, not an Esri Maps for SharePoint question. Could you re-post in the appropriate forum, please.

Thanks,
Katy
Katy Dalton | Technical Consultant
THE SCIENCE OF WHERE™
0 Kudos