Exemple #1
0
        public Form1()
        {
            InitializeComponent();

            this.Closing += new CancelEventHandler(Form1_Closing);

            // create the control and set Forms properties.
            this.globeControl = new GlobeControl();
            this.SuspendLayout();
            this.globeControl.Location = new System.Drawing.Point(0, 0);
            this.globeControl.Name     = "globeControl";
//            this.globeControl.Size = this.ClientSize;
//            this.globeControl.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
            this.globeControl.Dock     = DockStyle.Fill;
            this.globeControl.TabIndex = 0;
//            this.globeControl.SendToBack(); // we want the button to be on top

            this.toolStripContainer1.ContentPanel.Controls.Add(this.globeControl);
            this.ResumeLayout(false);

            this.loader = PlugInLoader.CreateLoader(this.globeControl.Host);

            // at this stage, it is safe to attach events to the control, but otherwise wait until Initialized.
            this.globeControl.Host.RenderEngine.Initialized += new EventHandler(Initialized);
        }
        public GlobeViewControl()
        {
            InitializeComponent();
            requirements = new Requirements();

            //Check if VE3D is installed
            Type veCheckType = Type.GetTypeFromProgID("Microsoft.SentinelVirtualEarth3DProxy.SentinelVE3DProxy");

            if (veCheckType != null)
            {
                object veCheckObject = Activator.CreateInstance(veCheckType);
                object veVersion     = veCheckType.InvokeMember("CurrentVersion", BindingFlags.GetProperty, null, veCheckObject, null);
                if (veVersion != null)
                {
                    if (double.Parse(veVersion.ToString(), CultureInfo.InvariantCulture) > 4.0)
                    {
                        // create the control and set Forms properties.
                        this.viewBase          = new VirtualEarthViewBase();
                        this.viewBase.Name     = "globeControl";
                        this.viewBase.TabIndex = 0;
                        this.viewBase.SendToBack();

                        mainHost.Child = viewBase;

                        this.loader = PlugInLoader.CreateLoader(this.viewBase.Host);

                        this.viewBase.Host.RenderEngine.Initialized += EngineInitialized;
                    }
                    else
                    {
                        this.Content = requirements;
                    }
                }
            }
            else
            {
                this.Content = requirements;
            }
        }