Loading MenuBar into SplitContainer on a TabPage

Nov 18, 2012 at 4:33 AM

Hi,

I have built a custom form that acts as a "Geospatial Dashboard" of sorts, and is comprised of a tab control that has GPS connections tab, GPS data tab, and a Map tab (Legend/Map inside of a splitcontainer), in that order. 

I am trying to load a MenuBar onto my map (panel 2 of my splitcontainer, as I know that SpatialToolStrip is deprecated), and it just doesn't work after calling AppManager.LoadExtensions. I have tried setting my shell to this, this.splitcontainer2, and everything else I could think of.

It is believed to be as easy as putting the extension into your Plugins folder (which I have tried both /Plugins and /Application Extensions), yet it still doesn't show up.

Here is my code that pertains to this endeavor:

 public partial class GPSForm : Form
    {
        
        [Export("Shell", typeof(ContainerControl))]
        private static ContainerControl Shell;

        public GPSForm()
        {
            InitializeComponent();

         
            Devices.DeviceDetectionAttempted += Devices_DeviceDetectionAttempted;
            Devices.DeviceDetectionAttemptFailed += Devices_DeviceDetectionAttemptFailed;
            Devices.DeviceDetectionStarted += Devices_DeviceDetectionStarted;
            Devices.DeviceDetectionCompleted += Devices_DeviceDetectionCompleted;
            Devices.DeviceDetectionCanceled += Devices_DeviceDetectionCanceled;
            Devices.DeviceDetected += Devices_DeviceDetected;

  
            Application.ThreadException += Application_ThreadException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
        }

private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tabControl1.SelectedTab.Text == "  Map")
            {
                
                if (Globals.ExtensionsLoaded == 1)
                {
                    appManager1.RefreshExtensions();
                    return;
                }
                Shell = this.splitContainer2;
                appManager1.LoadExtensions();
                Globals.ExtensionsLoaded = 1;
                
            }
            
            
        }

 

If there is anything else I am missing here, please let me know (Oh, and it is compiled to x86, as I would like to also have GDAL capabilities).

Thanks,

Logan

Nov 20, 2012 at 4:24 PM

Any news on this?

Nov 21, 2012 at 1:52 PM

I think you need to implement the IdockManager, Iheadercontrol and istatuscontrol as sayd here

http://mudnug.wordpress.com/2012/01/31/how-to-load-dotspatial-extensions-into-my-toolbar/

in the following discussion someone shows sample coding for these requirements

http://dotspatial.codeplex.com/discussions/395940

I found useful to see the implementation of the demomap project in the dotspatial source code

 

Oscar

Nov 23, 2012 at 11:17 PM

So I have implemented these interfaces as shown in the DemoMap project. I am still running into the issue where I cannot set "Shell" to SplitContainer.Panel2 on the second tab. This is where I need the controls at. This almost makes me feel like I am going to have to programmatically add every single control in sequence.

Any ideas there?