I am trying to use MEF inside a Silverlight application. All the examples I find use this type "System.ComponentModel.Composition.Hosting.DirectoryCatalog", but is apparently not in Silverlight, only .NET.
I am trying to get it so I drop the dll's (at runtime) in a directory the app has access to and then load those dll's using MEF.
I do understand how the Import and Export work, but I guess the issue is how do I dynamically add the xap files to my project so I can use the import and export?
have a look at Prism : http://compositewpf.codeplex.com/
And here is a tutorial for MEF using Prism: http://www.codeproject.com/Articles/155835/Prism-for-Silverlight-MEF-in-Easy-Samples-Part-1-P
The answer was as simply as I thought. I ended up using a tutorial, which was not as straightforward as I though. Anyone that encounters this issue I suggest simplifying the tutorial version to it's smallest parts and then using it as a template
Related
I'm struggling with a Wpf application, using the Apex MVVM framework.
I suspect instantiation problems.
How can I see the instanced objects in the running app?
You could for example use the Windows Debugger (WinDbg) and its !dumpheap –stat command to list the objects on the heap.
Please refer to Tess Ferrandez's blog post for more information: https://blogs.msdn.microsoft.com/tess/2005/11/25/dumpheap-stat-explained-debugging-net-leaks/
Here am having 3 different WPFapplications and now my requirement is like i want to have only one WPF app which should be invoke the other apps pages when clicking the hyperlink..
Can anyone suggest how to do that...
I tried with one type of solution i.e. having the other three has class lib and invoke the corresponding pages using the created objects, but that is not working.
please help me
Thanks in advance.
Building a Composite Application could be the way to go here. Check out these links:
Patterns For Building Composite Applications With WPF
patterns & practices: Prism
Introduction to Composite WPF
In this pattern each application is called 'Module' and is created as a library that is loaded by a main 'Shell'. The sample in the codeproject link will give you a nice first look about it.
I'm not even sure how to properly ask this question. I'm new to Silverlight and what I'm trying to accomplish is web application that can be referenced using hyperlinks in browser like so:
myapp.com/MaintainUser?UserKey=1
So, I already created modular app with PRISM and using their RegionManager.RequestNavigate and passing URL's here and there. Seems to be working. But browser does not reflect what I'm doing. URL always stays at
myapp.com
I'm not even sure if what I'm doing possible. And if it is, can you point me in correct direction? Or at least terminology.. I thought Navigation will take care of this.
What you are looking for is called deep linking and it's supported by the Silverlight runtime since version 3. However, you should not confuse this with Prism navigation, which is not integrated with the browser.
Here's an quick intro to the standard Silverlight navigation framework.
I have two silverlight assemblies.
In assembly 1 I have implemented an interface ISnProvider.
In assembly 2 I have a concrete class which implements the ISnProvider.
I plan on having more assemblies which will contain different implementations of ISnProvider.
Assembly 1 has no reference to assembly 2.
When my silverlight app starts up, I want to resolve the ISnProvider interface using an IOC container. Ideally I won't have to recompile my app to use different providers. I don't want to hardcode 'assembly2.dll' in my assembly 1.
Which IOC container will allow me to dynamically load these assemblies using silverlight?
Thank you!
santiago
You might want to take a look at the Managed Extensibility Framework (MEF) from Microsoft. That will certainly support your scenario (example here) although it does unfortunately mean you need to use attributes (e.g. [Import] / [Export]) at various places in your code.
Autofac is available in a Silverlight version and I would certainly recommend it for general IOC usage with Silverlight but I've never tried to get it to dynamically load an assembly without a direct reference and I'm not sure if it will support that in Silverlight (I'd love to hear if anyone has accomplished this with Autofac)
You could also use a semi-manual approach - here's an example of loading an assembly dynamically in Silverlight without an IOC container, which may or may not be useful for you.
I am trying to follow Pete Brown's introductory WPF tutorial which makes use of the TweetSharp libraries to interact with Twitter.
I have downloaded what appears to be the latest TweetSharp binaries (and a few others including the ReleaseCandidate) from Codeplex (http://tweetsharp.codeplex.com/).
No matter what references I add and no matter what using statements I try, I cannot create a reference to the TwitterService for the FluentTwitter class.
I simply get the compiler error - "The type or namespace cannot be found".
Now I've noticed that the TweetSharp.dll that Pete references is 518KB but the one contained in each of my different downloads is only 84kb. (I've tried several times - I am getting the full download here).
The link from Pete's article to the TweetSharp libraries, no longer works (http://code.google.com/p/tweetsharp/).
What basic element am I missing here or what could I be doing wrong?
TweetSharp moved to CodePlex since that article was posted, which is why the link to Google Code is dead.
You need references to TweetSharp.dll, TweetSharp.Twitter.dll, (and for good measure Hammock.dll, and Newtonsoft.json.dll).
For using directives, if you're using the FluentTwitter approach:
using TweetSharp.Twitter.Fluent;
using TweetSharp.Twitter.Extensions;
using TweetSharp.Twitter.Model;
If you're using the TwitterService approach:
using TweetSharp.Twitter.Model;
using TweetSharp.Twitter.Service;
There are some other examples kicking around on CodePlex including some starter apps if you download the source code.
I think now it's in github https://github.com/danielcrenna/tweetsharp CodePlex didn't work for me?
Is the Tweetsharp library still on Codeplex? The link above has expired?
Or is Linq to Twitter a better option? I'm new to Twitter API and only need a few simple code examples (Search Feed, Geo Location & Post Photo to Twitter).