c# - Howto host and activate WinForm-AddIns that run out of process (new AddInProcess())? -
fact
i'm trying create host application manages addins(legacy winform exe's) out of process using maf (eg. add-ins , extensibility)
the addin activation done out of process like:
addintoken.activate<pluginhostview>(new addinprocess(), addinsecuritylevel.fulltrust); in host application keeps track of plugins , shows them in toostripmenu. toolstripmenuitem.click event in host application fires plugin.showmaindialog() - method part of addin contract:
(sender plugintoolstripmenuitem).plugin.showmaindialog(); the addin x project (a winform application) implements contract in class contains:
public override void showmaindialog() { new form1().show(); } running above host application makes addin x form , process hang , quite hard find out what's wrong :-(
question
are there working samples utilize new addinprocess() host addins containing winforms out there?
showing modeless forms out of process in maf not straightforward. easiest way have found spawn new thread , showdialog on thread:
thread t = new thread(()=> { var f = new form1(); f.showdialog(); }); t.setapartmentstate(apartmentstate.sta); t.start(); c# maf
No comments:
Post a Comment