Is it possibl开发者_开发技巧e for a Silverlight project within a .NET solution to use methods, objects and what nots within other .NET projects?
@all, thank you for all of the response. My solution in my mind is to have a project with in the .NET solution that listens to a certain port and send an XML object based on the input. And have a separate Silverlight project that sends the query to the previously mentioned .NET solution port.
Do you think that it is possible without too much overhead? I don't even know you can make TCP connection with Silverlight...
No, because the Silverlight code is executing within the secure runtime environment inside the user's browser, some of the regular .NET features, such as COM Interop (a way to access Windows libraries) is disabled for security reasons.
If from your Silverlight code you need to access local resources (exposed via Windows APIs), you will need to create an Active-X control (for Internet Explorer, other methods exist for different browsers) which is written in C++ and can access all resources on the user's computer. You can then interact from your Silverlight control with that Active-X control using Javascript (called from Silverlight).
Manually maintaining the links between files in multiple projects using Visual Studio is possible, but it can be time consuming and error prone. For this reason, the Composite Application Guidance for WPF and Silverlight provides the Project Linker tool.
Project Linker: Synchronization Tool
Off the top of my head here are a few ways to reuse code (not binaries) across Silverlight/.NET libraries:
- You can use the Add existing File "Add as link" option to bring source code files into Silverlight (assuming the
using
statements are compatible) - You can use RIA service libraries to have code shared between server libraries (which are standard .NET libraries) and Silverlight clients. As well as the auto-generated RIA data stuff, there is a feature where you just name your files
whatever.***shared***.cs
, and it will be copied to the matching client library.
Unfortunately, you cannot just link with non-Silverlight binaries as it uses its own version of .NET.
精彩评论