tags:

views:

49

answers:

1

I have a third party dll that I am trying to reference in my Silverlight project. I am able to use this dll and reference it in a test WPF application. Trying to reference this same dll in my silverlight application is not working. I am using the automationFactory class to get a handle on the dll but I am not sure if I am doing this correctly.

dynamic btApp = AutomationFactory.CreateObject("BarTender.Application");

By putting Bartender.Application as the argument in the CreateObject method I am able to get a handle on a dll, but Im afraid it is not the correct dll. How do I reference a particular dll that I need to use.


Code

dynamic btApp = AutomationFactory.CreateObject("BarTender.Application"); 
//dynamic btMessages = null; 
dynamic btFormat = btApp.Formats.Open("c:\\Temp/Format1.btw", false, "");
btFormat.SetNamedSubStringValue("testing", barcodeValue); 
btFormat.Print("Job1");
btFormat.Close(2);
A: 

Silverlight is a complete different framework from wpf. You need to get a the dll built for the silverlight runtime.

Reason: WPF is more integrated into windows/.net framework. This Dll may reference system calls. Silverlight has its own framework (very small subset of the .net framework).


Silverlight 4:

If shipping the library: This guy explained it here.


I do not suggest usint COM integration for this purpose (I see something about Print(). Maybe that DLL requires the full .net framework. Not all users of silverlight will have that. Its best if you go WPF.

Shawn Mclean
Is it not possible to get a handle on a dll then using the AutomationFactory class?
gevjen
Crap, I should delete this answer, this is a silverlight 3 answer. Forgot 4 supported COM integration.
Shawn Mclean
If I do have a dll built for silverlight do I reference it just like I would any other dll in other project?
gevjen
Yes. (comment filler)
Shawn Mclean
Any guidance on this AutomationFactory and how I can get a handle on this dll, if SL4 does indeed do this..
gevjen
I'll edit my post, you can use COM integration to reference non silverlight dlls.
Shawn Mclean
It only works out of browser though, and I think the user must confirm being admin. More about COM integration here: http://justinangel.net/CuttingEdgeSilverlight4ComFeatures
herzmeister der welten
I am running OOB...thanks for the link..i will take a look at that now.
gevjen
Shawn...thanks for all the help..im going to try what is mentioned in this link..if this works..your the king!...thanks again.
gevjen