|
How about trying it this way:
<Image HorizontalAlignment="Center" Grid.Row="2" Grid.Column="1" Height="40" Width="40"
Source="/WpfApplication1;component/Pictures/CELabel.png"></Image>
Still if it doesn't work, then put it in the code-behind(not a good way though!)
myImage.Source=new BitmapImage(new Uri("WpfApplication1;component/Pictures/CELabel.png",UriKind.Relative));
This should work.
People with high attitude deserve the standing ovation of our highest finger!
My Technical Blog![ ^]
|
|
|
|
|
In one of the pages of the silverlight 4 application, I access the windows service to check for some data...
All works fine so far.
If the windows service has been stopped, I get an error when the code tries to access it.
I am using try catch but it seems the code gives error and does not go to the catch block if the windows service is stopped.
Question:
How can I check if the windows service is stopped so that then I do not have to call the method inside the windows service? I think this way, I will not get any errors?
Thanks
|
|
|
|
|
|
I checked the website but it does not solve my issue because there is no servicecontroller in silverlight as far as I see.
|
|
|
|
|
Please post code including try catch statements and the exception being thrown, might be able to help then.
"You get that on the big jobs."
|
|
|
|
|
In silverlight app when it is running, if the windows service has stopped, then on the bottom right hand side of the website, it shows as Error. When I click on it, it shows that the error has occured when calling the service with the method name.
I basically would like to get a message in say a label control to say something like : Possible error is due to the service being stopped.
Thanks
|
|
|
|
|
In your App class, you will probably already have code that catches UnhandledExceptions. You need to hook into this code.
|
|
|
|
|
In below code, The Getsettings() is called.
And definitely the client_GetSettingsCompleted is NOT called because the windows service is stopped.
The code passes the client.GetSettingsAsync(); but then the error seems to occur in EndGetSetting in the reference.cs file.
Any thoughts please?
Thanks
private void GetSettings()
{
MyWinService.myClassClient client = new MyWinService.myClassClient();
client.GetSettingsCompleted += new EventHandler<MyWinService.GetSettingsCompletedEventArgs>(client_GetSettingsCompleted);
client.GetSettingsAsync();
}
void client_GetSettingsCompleted(object sender, MyWinService.GetSettingsCompletedEventArgs e)
{
...
}
|
|
|
|
|
I must admit, I'm a bit confused. Are you running this code Out Of Browser? Are you trying to determine if the service is running on the client side, or on the server side?
|
|
|
|
|
Hi,
I start the windows service.
When it is running, I then browse to the silverlight page. And that is when it gives error.
|
|
|
|
|
You still haven't answered the basic question. Client side or server side?
|
|
|
|
|
The error is on the silverlight side, so I guess the answer to your question is client.
|
|
|
|
|
Are you sure? Unless the SL app is given elevated permissions, and running OOB you cannot interact with things like services on the client side. Remember, if you are testing the application on the same machine you are running the web server on, you will see different behaviour than if you run the app on a separate server.
|
|
|
|
|
If I run the SL app as well as the win service on my machine, the error happens as explained before. i.e. when there is a call to the service.
If run on the server, the error is shown on the bottom left hand side with the yellow exclamation sign.
My question is how to see if the service is running or not so that I can code around the method which calls the service. i.e. if service is stopped then no nned to call the method inside it...
Hope I have answered your question.
Thank you
|
|
|
|
|
The only thing I could think of is to use WMI to query for the service status. You can use WMI with SL as detailed here[^].
|
|
|
|
|
I will try that.
Many thanks
|
|
|
|
|
Without knowing more about the MyWinService object, it is impossible to answer the question to avoid throwing an exception. You could however catch the exception that is thrown and handle it in the GetSettings method.
private void GetSettings()
{
try
{
MyWinService.myClassClient client = new MyWinService.myClassClient();
client.GetSettingsCompleted += new EventHandler<MyWinService.GetSettingsCompletedEventArgs>(client_GetSettingsCompleted);
client.GetSettingsAsync();
}
catch (TheActualExceptionException e)
{
}
}
You may want to start with catching Exception and refine your catch statement once you know the type of exception is being throw.
"You get that on the big jobs."
|
|
|
|
|
Does the exception come back to the callback or the instigator of the call? I was pretty sure it is the callback!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
It should come back to the callback. In this example, once the async call has been issued, the code would fall out of the call method.
|
|
|
|
|
Arkiboys says the callback is never returned so I'm guessing the exception may be thrown in the GetSetting method. Putting some exception handling in place may resolve his issue.
"You get that on the big jobs."
|
|
|
|
|
In this case, the exception would be caught by the UnhandledException handler. I believe that I told him to catch it there at some point in this thread.
|
|
|
|
|
My Disjointed ,scatterbrained ,unstructured ,cheap Skate ,Self learning program is going well thank you. My cool Gage user control is my first real attempt to Implement Custom dependency Properties. I made a currentVal DP. that returns an int that the progressBar part of my control Binds to , works good , Now I want the TextBlock part of my control to bind to the same currentVal . With 2 day's of research study , I choose ValueConverter. My Goal is to
use lot's of these usercontrols in a window with no window codeBehind events and assignment's ,
just Data Context. So Do you Think I'm taking the right approach , most specifically with ValueConverter Inside of userControl. ?
I probably clean up nice.
|
|
|
|
|
From what I understand, yes, your approach sounds good...
You're binding to a value - which is the progress.
You want to display it both as a progress bar and a number.
I'm not sure why you couldn't just bind your textblock to the same property, in this particular case, but your approach is exactly what I use; have a single property and bind using valueConverters if the property isn't in the format I need it.
The example I choose to discus this was with a Clock using MVVM.
My ViewModel has properties of Hour, Minute and Second (integers).
For a digital clock, binding is easy.
But if you want an analogue clock? Create a value converter to convert each of them from an integer to an angle.
The ViewModel determines the information to be displayed, and the View (with its associated ValueConverter) determines how it is to be displayed.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Yes this approach looks quite ok to me.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Hi i am Nilesh Kshetre My Question is how to Insert Video (Through WebCam)In SqlServer2008 In silverlight Apllication. And How to Show
|
|
|
|