MapWindow 4 - Plugins : MapWindow Discussion Forum
Hi Friends, I developed a plug-ins and put the button on the menu bar (Name "Assessment"). At the first run, I can click this button and work without problem. But, after close it and I try to click it again, it crashes. Do you have any suggestions on this? I
Plug Ins Cannot be Loaded Second Time
Posted by: sarawutj ()
Date: October 03, 2009 02:54AM

Hi Friends,
I developed a plug-ins and put the button on the menu bar (Name "Assessment").
At the first run, I can click this button and work without problem.
But, after close it and I try to click it again, it crashes.
Do you have any suggestions on this? I suspect few things as follows
1. I use Install Shield to do the set up project and after that the problem occur.
2. I install MapWindowCF47RC-x86-Setup.exe and it seems my plug in folder was updated.
Here is the report after it crashes

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'ClassAssignment'.
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at WeifenLuo.WinFormsUI.DockContentHandler.set_DockPanel(DockPanel value)
at WeifenLuo.WinFormsUI.DockContentHandler.Show(DockPanel dockPanel, DockState dockState)
at WeifenLuo.WinFormsUI.DockContent.Show(DockPanel dockPanel, DockState dockState)
at MapWindow.MapWindowForm.ToolStripButton2_Click(Object sender, EventArgs e) in C:\#maisak\MAPWINDOW\MapWindow\Forms\frmMain.vb:line 4572
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Thanks in advance
Sarawut

Options: ReplyQuote
Re: Plug Ins Cannot be Loaded Second Time
Posted by: bmarch ()
Date: November 06, 2009 07:42PM

Hi Sarawut,

Can you post your code please?

What I suspect you are doing is something like this.


If(button = "MyButton")
MyDialog.show()
endif


Which will cause the error you are getting if the next time the user clicks the button MyDialog is disposed of (For example if they closed the form) Try this instead:

If(button = "MyButton")
If (MyDialog.IsDisposed = True OrElse MyDialog is nothing)
MyDialog = new DialogType()
endif
MyDialog.show()
endif

That is all is sudo code so you can't just copy and paste it but it should give you the general idea.

Brian

Options: ReplyQuote


Sorry, only registered users may post in this forum.





Banner Exchange




GISCP.com




Send us your banner logo (160x120) for the space above, and add this MapWindow banner ad to your site:

Just paste this text in your page: