tobe81cwb

[C# .NET] Dockable Window Freeze everytime

Discussion created by tobe81cwb on Feb 14, 2012
Latest reply on Feb 15, 2012 by gisprogrammer9
Edit:
forget, worked on another computer!
I still don't know the reason for the addin freeze the entire ArcMap, but I known that the problem is not the program code.



I'm having a little problem with dockable window and the "WebBrowser" .net control!
If I put a webbrowser with some url on a dockable window, the ArcMap freeze everytime that I try to move the dock window.

This is a simple test project that freeze everytime on my and another machine.

- Start Visual Studio (i'm using v2010).
- On template, Select ArcGIS\Desktop Add-Ins and then ArcMap Add-In.
- In the Wizard, on Add-In Type, I select 'Button' and 'Dockable Window'.
- Open the Dockable Window on Visual Studio Designer, and put a WebBrowser component.
- On URL property of WebBrowser component, put some valid URL (like www.esri.com).

- On button class, on the Click event, I put the following code:
        protected override void OnClick()
        {
            ESRI.ArcGIS.esriSystem.UID uid = new ESRI.ArcGIS.esriSystem.UIDClass();
            
            // this is from Config.esriaddinx (<DockableWindow id="Test_TestingAddin1_DockableWindow1" class="testbrowser+AddinImpl"...)
            uid.Value = "Test_TestingAddin1_DockableWindow1"; 

            ESRI.ArcGIS.Framework.IDockableWindow dw = ArcMap.DockableWindowManager.GetDockableWindow(uid);
            if (!dw.IsVisible())
                dw.Show(true);
        }


- Compile the code, rum ArcMap, put the button on Toolbar.
- Click on button! The webbrowser dock windows is visible.
- Move the web browser window (dock and undock, change position) and the ArcMap freeze.

What's wrong with the code?
ArcMap SP3, and ArcObject .NET SP3 too.

The web browser sample from ESRI sometimes freeze too.

Outcomes