Adding Models to the silverlight wcf ria services enabled application - silverlight

I have started using the MVVm light2 framework for the wcf ria enabled silverlight 4.0 application.
I was able to add a folder named "Models" to ASP .Net application that hosts the silverlight application, I added a class to this folder, and i am able to set the properties and all for this in my silverlight application, but once i started to add more such classes into my Models folders, they aren't getting accessible anywhere in my silverlight application.
Also in my MainViewModel.cs the intellisense is not showing the newly added class/classes , i made sure the application is build before i accessed them in my silvelight application, also the namespaces are correct.
Am I missing to set a property or something?

Someone on my team faced a similar problem. As I recall it had something to do with the physical location on the .cs files, which may imply that the namespace had changed.

Related

Lync API using PresenceIndicator outputting TypeInitializationException within InitializationCompleted

I am using the Lync API within a WPF application. I have used the Office365 Lync Lab 9.1 within the training kit. However when I move the code into my WPF application the PresenceIndicator or ContactList doesn't work. The controls are displayed however the status of the Lync user is not shown. I am using the exact same accounts that are working within the Office365 Training Lab 9.1.
When I add logging I am shown errors like the following for the PresenceIndicator:
Applying template...
Control 'PresenceIndicator' entering 'OnLoaded'
UCClientInitializationFailed:Failed to Create Provider. Error Type: TypeInitializationException
I am also trying the ContactList and that is outputting:
UCClientInitializationFailed:Failed to Create Provider. Error Type: TypeInitializationException
Also the InitializationError property within the InitializationCompleted event is showing an Unknown error. How would I troubleshoot this issue further?
This is a complete stab in the dark, but are you attempting to add controls to an existing WPF application that has never integrated with Lync before?
It may be that you are missing references in your app - double-check you have references to the following files in %program files%\Microsoft Lync\SDK\Assemblies\Desktop
Microsoft.Lync.Controls.dll
Microsoft.Lync.Controls.Framework.dll
Microsoft.Lync.Model.dll
Microsoft.Lync.Utilities.dll
Microsoft.Office.Uc.dll
Also worth checking:
Is your app builing against .NET Framework 3.5 or 4?
Are you building for AnyCPU?
If that doesn't help, you could try creating a new WPF application using the "Lync WPF Application" template in Visual Studio. If this works correctly, then compare this against your appplication for any differences in references, configuration etc.
This MSDN page may be useful.

Debug Silverlight component from MVC application Visual Studio 2010

In my solution I have a MVC project. Then I added a Silverlight project. When I added the Silverlight project, I set to include it in the existing web application (MVC project).
It added an .aspx page that contains the Silverlight component. The problem is that I cannot debug into the Silverlight code when I start the ASP.NET MVC application. I set a breakpoint in the Application_Startup function in the Silverlight code, but it never stops there. On the breakpoint I have a tooltip:
The breakpoint will not currently be hit. No symbols have been loaded for this document
How do I fix this problem?
Which browser are you using? I've had mixed results with debugging Silverlight with anything besides Internet Explorer, so I'm making sure to use Internet Explorer when developing Silverlight applications.
If you're using Internet Explorer, then Evan's solution should work (at least that's what has stopped me some time - Silverlight debugging disabled in the web project).
Also check that your Silverlight application is present in the list located under Web project properties > Silverlight Applications.
I found the problem. The browser was caching the Silverlight application. I solved that with the following code when initializing the Silverlight component:
param name="source" value="ClientBin/form.xap?<%= DateTime.Now.Ticks %>"

Can you use multiple app domains in silverlight?

Can you use multiple app domains in silverlight? If so, are there any special restrictions?
Depends on what you mean. By default, each Silverlight application runs in what is, effectively, a separate App Domain. But you can't programmatically control application domains like you do in the full .NET runtime. The System.AppDomain namespace is there, but all the "CreateXXXX" methods are missing. Compare the .NET 4.0 docs with the Silverlight docs to see what I mean.

How to access web application class into silverlight application

I am beginner in silverlight..I have created a silverlight project. When a new silverlight project is created it is automatically creating a silverlight application and one web application. I have added a class in both applications. Now I want to access a method of web application class into silverlight application class. Is it possible? I have tried to add web application reference to silverlight but VS is not allowing. Is there any another way to do??
What you need is called WCF. A really simple tutorial that should get you going is found here: How to call WCF methods from Silverlight controls
Fundementally WCF allows the silverlight client to make method calls on a class instance hosted on the web site.
Yes it is possible, but not in the normal way. A Silverlight assembly can only reference another Silverlight assembly (this is a limitation of VS2008, i don't know if it has been changed in VS2010).
What you need to do is add an existing file to your Silverlight project, when the file browse dialog opens you navigate to the class file you want to reuse, but instead of just clicking the Add button, click on the little down arrow on the button and choose Add as link - now the file will "exist" in both projects and can be used in both.
If you are going to do this repeatedly though, you will want to move those shared class files out into a separate assembly, do a project reference from your web app, and have the equivalent Silverlight class library mirroring it (sharing the files as links), and then project reference that Silverlight class library from your Silverlight app.

TestPage.aspx in silverlight

I am a beginner in silverlight. I want to know what is TestPage.aspx and TestPage.html in silverlight. Actually i have google it but din't get enough information. Can any one give me answer??
TestPage.aspx and TestPage.html are the pages which will host your Silverlight content. As you might know, Silverlight is just a project (not a web application) and needs a page that can host it.
These pages are created by default and help you to test your XAML content during your development, which you can later remove from your project.
TestPage.html is dynamically generated by the Silverlight application as part of the Debug process. If you take a look at the Debug tab for the application properties you will see an option to Dynamically generate a test page. If this is selected then you TestPage.html is created in the /Bin/Debug folder of your Silverlight application.
A better solution is to create a web application in the same solution as your Silverlight application then in the properties for the web application go to the Silverlight Applications tab and add your existing Silverlight app to the web project. Also make sure that the Silverlight checkbox is ticked in the Debuggers section of the Web tab of your web application.

Resources