|
THank you very much, one thing I need there is to make the pie bigger, I keep adding to the width but it does not grow.
|
|
|
|
|
What width are you setting? Are you setting the width of the pie chart or the grid?
My signature "sucks" today
|
|
|
|
|
I've been trying to figure out how Silverlight communicates with a WCF Web service when the VS2010 Silverlight solution is set up as an ASP.NET Web Application Project rather than an ASP.NET Web Site. As you know, when you set up a Web Application Project, the Web service is generated as a .dll assembly rather than a set of loose .cs files that are supposed to be compiled once, when the Website is first accessed.
But when the solution is set up as a Web Application Project, the service is encapsulated in a dll assembly. In my case, the service is in a DLL called PPTWebsite.Web.dll. When I build the solution, the Silverlight application is also wrapped in a xap file called PPTWebsite.xap and from what I've read, the xap file and the WCF Web service assembly have to be in the same folder on the Website, and further, the xap file has to be in the ClientBin folder off the root of the Website, so that's also where the PPTWebsite.Web.dll file must be located. (I've tried putting the xap file in the root of the Website and that doesn't work at all.)
When I build my solution, a .svc file also gets created that identifies the location of the C# source file containing my Web service. This .svc file must be in the root of the Website and contains the following line:
<%@ ServiceHost Language="C#" Debug="true" Service="PPTWebsite.Web.PHDWebsiteService" CodeBehind="~/ClientBin/PHDWebsiteService.svc.cs" >
What confuses me is that the value of CodeBehind points to the C# source file containing the source of my service implementation but doesn't identify the assembly containing its CIL code. So: how does the Silverlight application know where the code for the Web service is stored when it makes calls to it?
I should also make clear that I have no problem communicating with the Web service when I execute everything from within VS2010. Everything is working perfectly when executed within the IDE.
The reason this is an issue is because when I deploy everything to the actual Website, the Silverlight application is not communicating with the Web service. I know this is true because I stripped down one of the services to a one line function that simply returns true and when the Silverlight event handler gets control it immediately throws an exception with the text, "The remote server returned an error: NotFound." (Google for that text and you will get thousands of hits on forums like this one, and the scary part is that most of the reported problems never seem to get resolved.)
Actually I don't think my problem is related to whether the solution is a Web Application Project or a Web Site, because originally I had a Web Site solution and got the same error. But for now, I'd just like to understand how Silverlight is supposed to talk to the Web server, given the contents of an svc file that only identifies a C# source file containing the service when what gets deployed is a DLL.
Solution: I just tried removing the CodeBehind attribute and the Silverlight application still correctly accessed the service. The CodeBehind attribute plays no part in finding the service, at least in a Silverlight Web Application Project. What is critical is the location of the service assembly relative to the .svc file: apparently it must be in a bin folder off the folder containing the .svc file.
modified on Wednesday, May 19, 2010 1:44 PM
|
|
|
|
|
Not sure what your question is - the ServiceReferences.ClientConfig file contains information that is used to find the web service.
Hope that helps.
|
|
|
|
|
Abhinav S wrote: Not sure what your question is
I tried to make that clear by displaying my question in italics: how does the Silverlight application know where the code for the Web service is stored when it makes calls to it?
Abhinav S wrote: the ServiceReferences.ClientConfig file contains information that is used to find the web service.
The ServiceReferences.ClientConfig file has a client endpoint element defined which of course has an address attribute. Since making my first post in this thread I've been trying to figure out the answer to my question myself. As near as I can figure out, the service needs to be in a folder named bin that is relative to the endpoint address. When VS2010 makes a new Silveright Web Application project, it places the .svc in the root of localhost, or the root of your project. Then when you build the project, the service assembly winds up in the bin folder off the .Web project.
So presumably when you deploy all this to a live Website, the .svc file goes into the root of the Website and the service assembly goes into a directory called bin that lies off the root of the Website. So I did this and now for the first time since I tried accessing my service from the Website itself, everything works!
I've been pulling my hair out over this for two extremely frustrating and depressing weeks and was ready to bring a consulting firm into my house for $250 an hour to solve my problem. I suspected it would only taken an expert five minutes to find out what was wrong because my Web Application project had no problem at all contacting my service when everything was run from my local PC. And I was right! Once I understood what is written in the previous paragraph, it took me all of two minutes to solve my problem!
Judging from the number of unanswered threads about this on the Web, there seems to be a huge problem of being able to contact the service perfectly fine when the project is executed from within VS2010 and failing miserably when it is deployed to the live Website. Tons of unanswered questions are out there! I really feel for all these people, because until this morning I've been suffering from the same misery for the last two weeks!
However, even though my real concern is now satisfied, I'm not going to mark this thread as SOLVED because my question wasn't "how do I connect to my service when it is located in my live Website," but how does the Silverlight application know where the code for the Web service is stored when it makes calls to it?
You see, I'm still not sure what the answer to this question is or what the CodeBehind attribute in the .svc has to do with anything, since it doesn't point to anything at all that exists (explicitly) on the Website! So my question is more related to how all the plumbing works rather than about a problem I'm still having. Once I have the answer to this question, I should probably write a Code Project article on how to manually deploy Web Application Projects, since judging from the horrendous amount of unanswered threads on the Web asking this question, more easy to follow instructions on how to do this are sorely needed.
|
|
|
|
|
Did you try removing the CodeBehind attribute? Its probably not even needed since the Service attribute specifies the namespace and class of the code. It says Service instead of Assembly because the @ directive just points to the service class, not a different assembly from the rest of the project.
I haven't used a WCF service in a long time so take this with a grain of salt.
|
|
|
|
|
shiznit770 wrote: Did you try removing the CodeBehind attribute? Its probably not even needed since the Service attribute specifies the namespace and class of the code. It says Service instead of Assembly because the @ directive just points to the service class, not a different assembly from the rest of the project.
I just tried removing the CodeBehind attribute and the Silverlight application still correctly accessed the service. So you're absolutely correct. It plays no part in finding the service.
|
|
|
|
|
I want to access some of the public controls in MainWindow from a separate class in the same application domain.
how can I do this?
|
|
|
|
|
Try
Application curApp = Application.Current;<br />
Window mainWnd = curApp.MainWindow;
You can then access public mainWnd objects.
Note: I have not tried this myself.
|
|
|
|
|
Application curApp = Application.Current;
MainWindow mainWnd = curApp.MainWindow;
|
|
|
|
|
I'm working on a SL3 Navigation App in VS2008. By default it created Assets/Styles.xaml. I have been trying to reorganize my xaml resources by moving groups of resources into logically assigned files, and I can't resolve the following issue:
I created a file called "FMBrushesAndColors.XAML", and I was careful to duplicate the property settings that are used by the original "Styles.XAML" fiule.
I then added the file to the App.XAML MergedDictionaries group.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Assets/FMColorsAndBrushes.xaml"/>
<ResourceDictionary Source="Assets/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
The problem is that when the app loads, it claims it can't find resources that are defined in that new resource file.
I've also tried creating a MergedDictionaries section in the original Styles.XAML file (and removing the resource line from App.XAML), but I get the same error.
I then tried adding the following code to the app.xaml.cs file, but it throws an InvalidOperationException.
public App()
{
this.Startup += this.Application_Startup;
this.UnhandledException += this.Application_UnhandledException;
AddResourceDictionary("Views/FMColorsAndBrushes.xaml");<br />
InitializeComponent();
}
<br />
private void AddResourceDictionary(string filename)
{
ResourceDictionary dict = new ResourceDictionary();
try
{
dict.Source = new Uri(filename, UriKind.RelativeOrAbsolute);
if (dict != null)
{
this.Resources.MergedDictionaries.Add(dict);
}
}
catch (Exception ex)
{
}
}
Does anyone know the secret to using multiple resource dictionaries in a silverlight app?
SOLUTION =====================================
Alright. I was using some of the resources defined in one dictionary in two other two dictionaries. The rules are as follows (as near as I can determine):
Give dictionaries A, B, and C...
0) If A requires a resource in B, you need to include the following in dictionary A:
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/AssembblyName;component/Assets/B.xaml"/>
</ResourceDictionary.MergedDictionaries>
1) To merge dictionaries A and C, you need to do this in the app.xaml:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Assets/A.xaml"/>
<ResourceDictionary Source="Assets/C.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Notice that you don't have to include B in app.xaml.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: this.Resources.MergedDictionaries.Add(dict);
Try Application.Current.Resources.MergedDictionaries.Add(dict); here
|
|
|
|
|
I'm more interested in doing it in the XAML. I only tried that because I wanted to illustrate what I had tried.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Just to make sure - your resources start with the <ResourceDictionary> tag right?
|
|
|
|
|
With what tag?
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I found the answer (see OP).
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Thanks for posting the solution.
|
|
|
|
|
You could also take back what you said in the Lounge about Silverlight.
|
|
|
|
|
Never.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Hi All,
I am developing a WYSIWYG editor using Silverlight 4.0 RichText box. I am able to insert images in the RichText box editor, but not able to add shapes (Line, Eclipse, Rectangle etc.)
Can anyone provide me a pointer to do so?
Thanks.
____________________________________________________________
rishabhs
|
|
|
|
|
|
What have you tried so far?
Did you try
myrichTextBox.Selection.Insert(container);
where container is an layout control (say, a stackpanel) containing a shape.
|
|
|
|
|
Thanks Abhinav for your reply. I tried inserting a shape using UIControl.
My requirement is to add shapes like rectangle, ellipse with the same functionality (resize, backcolor, shadow etc) as provided by Word or Visio.
I will try the option suggested by you and will let you know.
Thanks.
____________________________________________________________
rishabhs
|
|
|
|
|
hi,
We are showing Video with slides(images) in silverlight .Our images come from amazon server now we want to cache these images before starting Video.
Any suggestion.
|
|
|
|
|