protected override void Initialize() {
     base.Initialize();
     this.Application = this.GetHostItem<Microsoft.Office.Interop.InfoPath.Application>(typeof(Microsoft.Office.Interop.InfoPath.Application), "Application");
     Globals.ThisAddIn = this;
     global::System.Windows.Forms.Application.EnableVisualStyles();
     this.InitializeCachedData();
     this.InitializeControls();
     this.InitializeComponents();
     this.InitializeData();
 }
 protected override void Initialize()
 {
     base.Initialize();
     this.Application  = this.GetHostItem <Microsoft.Office.Interop.InfoPath.Application>(typeof(Microsoft.Office.Interop.InfoPath.Application), "Application");
     Globals.ThisAddIn = this;
     global::System.Windows.Forms.Application.EnableVisualStyles();
     this.InitializeCachedData();
     this.InitializeControls();
     this.InitializeComponents();
     this.InitializeData();
 }
        public void Initialize()
        {
            this.HostItemHost = ((Microsoft.VisualStudio.Tools.Applications.Runtime.IHostItemProvider)(this.RuntimeCallback.GetService(typeof(Microsoft.VisualStudio.Tools.Applications.Runtime.IHostItemProvider))));
            this.DataHost     = ((Microsoft.VisualStudio.Tools.Applications.Runtime.ICachedDataProvider)(this.RuntimeCallback.GetService(typeof(Microsoft.VisualStudio.Tools.Applications.Runtime.ICachedDataProvider))));
            object hostObject = null;

            this.HostItemHost.GetHostObject("Microsoft.Office.Interop.InfoPath.Application", "Application", out hostObject);
            this.Application  = ((Microsoft.Office.Interop.InfoPath.Application)(hostObject));
            Globals.ThisAddIn = this;
            System.Windows.Forms.Application.EnableVisualStyles();
            this.InitializeCachedData();
            this.InitializeControls();
            this.InitializeComponents();
            this.InitializeData();
            this.BeginInitialization();
        }