|
I think the point here though is semantics, not complexity or limitations.
The fact is, asynchronous doesn't mean you can't have the ui wait.
Doing:
enter
callandwait
leave
vs.
enter
beginasync
showmodaldialogforwaiting
leave
receiveasync
hidemodaldialogforwaiting
leave
Is a similar pattern. In other words, there is nothing to prevent you from locking the UI while you wait for the call. We have several pages that are aggregate controls for filters, locations, and other parameters that act on a grid and all must be pulled in before the user can react. Rather than create the awkward situation of freezing the ui while waiting, in which case the user has to be wondering, "What on earth is going?" We can simply set a global state and then lock down the UI and show a user-friendly animation, loading icon, hourglass, or whatever. As each collection of data comes in, the state is updated and when all controls are fully loaded then we remove the modal "hey, we're initializing" and go on with business as usual.
Would that be something that would work in your case? IMHO even if you need it to logically function as if synchronous, asynchronous gives you more flexibility to engage the user appropriately and notify them you are waiting for something as you pull in the call.
|
|
|
|
|
Yeah, I suppose its down to symatics. Functionally its is indisputable that we want to make the user wait for things before the UI responds to results of conditoins, now we just need to get technical work arounds to acheive the functional requirement.
Your example shows where 3 lines of code could achive the same as 7 lines of code for the same functionality, now imagine what the would look like if you were to do 5 different calls, passing the results from each call to the next, possible passing the same results to more than 1 call, managing the status of each async call could be a pain, and you will have far more code on the CPU & RAM than just doing sync calls...
I might be missing something here, but I do not get MS's decision here...
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
Hi Adriaan,
I know it's been a while since you posted your question, but for anyone else reading this thread I thought I'd mention that it is possible to perform synchronous WCF calls in Silverlight. You just can't do them from the UI thread.
Synchronous Web Service Calls with Silverlight: Dispelling the async-only myth[^]
Whether you should or not is another question. I believe that it is AOK to perform sync calls as long as they are not on the UI thread. Without sync call it is very easy to end up with spaghetti code.
Cheers,
Daniel
|
|
|
|
|
|
Your best bet is to ask in the forum that's under the article. The author understands how his code is supposed to work, and we don't.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I did and like other people, he is not responding. Oh well, I guess I will find something else to use...
|
|
|
|
|
Sorry, I've never used it. I would suggest running his sample and looking for ways your code is different to his sample.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Back in the late 90's Java was main stream and XML was becoming popular, a Sun researcher from China postulated that a Swing or AWT UI could be represented by dumping the widget cache to an XML file and then reconstituted using XML parser and Java Reflections.
I was unable to find the original white paper...
I used this researcher's design pattern on a contract once to create a XML version for winforms.
'Who said good things don't grow under the Sun?'
~TheArch
modified on Friday, July 10, 2009 4:48 PM
|
|
|
|
|
1 - this is not a question
2 - C# is obviously based on Java, so what else is new ?
3 - Sun is so awesome that they come up with these ideas, but can't make money off them. How many quarters have Sun made a profit in, in recent years ?
4 - anyone who is trying to create new technology would be stupid to set out NOT to learn from what people have done in the past.
Forgot to add - XAML is the worst thing about WPF. Too verbose, for one. It's often better to do stuff in code.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: 1 - this is not a question
Hmm, Kinda of thought this was an an implied question. Esp. if you can prove other wise.
Christian Graus wrote: 2 - C# is obviously based on Java, so what else is new ?
Yeah, kinda of, but I think the direct relationship faded around 3.0. 3.5 and 4.0 bring new ideas to the table, and Sun has been playing catch up since Generics.
Christian Graus wrote: 3 - Sun is so awesome that they come up with these ideas, but can't make money off them. How many quarters have Sun made a profit in, in recent years ?
Gotta love those guys, but it makes you wonder how many quarters Stanford's research grants increased...
Christian Graus wrote: 4 - anyone who is trying to create new technology would be stupid to set out NOT to learn from what people have done in the past.
Hmm, I wouldn't say stupid. Pig headed maybe.
Christian Graus wrote: Forgot to add - XAML is the worst thing about WPF. Too verbose, for one. It's often better to do stuff in code.
Well Okay, good point. What about designers? Don't they get to play? Try using Model Viewer Presenter with WPF. Where XAML = Viewer, xaml.cs = Presenter, You'r logic = Model. That might work better.
Wow, you owned an Apple ][!
Did you ever program Beagle Bro's?
|
|
|
|
|
TheArchitectualizer wrote: Yeah, kinda of, but I think the direct relationship faded around 3.0. 3.5 and 4.0 bring new ideas to the table, and Sun has been playing catch up since Generics.
True - but that is kind of my point. Innovation and the replication of good ideas from the past, are not mutually exclusive.
TheArchitectualizer wrote: Wow, you owned an Apple ][!
Did you ever program Beagle Bro's?
Hell, yes. I spent hours reading through Beagle Brothers code and learning from it, I had their posters up on the wall around my computer. I loved those guys.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Me to! My first programing book was Beagle Basic and Pro Dos. The IIe didn't have a clock so my fisrt attempt at programming was a huge sub to count the ticks and update the clock on my BBS with out have to buy a $240 add in board just to tell what time it was. Little did I know I was reinventing multi tasking.
|
|
|
|
|
You can see a demo of my quick and dirty implimentation of MVP in my most recent article:
Big O Algroythm Analyzer for .NET[^]
Q: Would you mind voting on it?
Q: I could use some mentoring, would you be my mentor?
|
|
|
|
|
Christian Graus wrote: 4 - anyone who is trying to create new technology would be stupid to set out NOT to learn from what people have done in the past.
With their upcoming "M" meta-language, I wonder how long it will be before some one make a new declarative curly brace based language.
One which act like XAML but feels like C#!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
TheArchitectualizer wrote: Back in the late 90's Java was main stream and XML was becoming popular, a Sun researcher from China postulated that a Swing or AWT UI could be represented by dumping the widget cache to an XML file and then reconstituted using XML parser and Java Reflections.
And here I was, thinking some idiot at Microsoft just pulled it outa' their ass. In any case, I like my version better because it's a better fit.
"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." - Jason Jystad, 10/26/2001
|
|
|
|
|
Uh hua, Uh hua, <nod>, Uh hua, <nod>, <nod>
Interesting bio.
|
|
|
|
|
|
I have to go check this out!
Been waiting for the cool navigation stuff.
|
|
|
|
|
Make sure you don't get caught out by attempting to install the consumer version when you already have Silverlight 2 Tools installed. I ran into that. You need to install the v3 Tools and all will be OK.
Kevin
|
|
|
|
|
Thanks, I will watch for that.
|
|
|
|
|
I am glad that you pointed that out since I would have been googling for it to solve the issue. I am sure that others have had that happen too. Sad thing is that I have updated my Mac to Silverlight3 but not my PC yet
Steve Maier
|
|
|
|
|
No problem.
Kevin
|
|
|
|
|
I thought that if I didn't assign a key name to a style, that the style would be applied to all instances of the specified target type.
I put such a style into a resource dictionary that is merged in the app.xaml file, but *none* of the target controls are using the style.
If I put the style into a specific control/window xaml file, or if I give the style a key name and use it that way, it works as expected.
What am I doing wrong?
EDIT ---------------
Well, I need to move on, so I found an almost reasonably low-impact work-around. I left the style in the dictionary file, but I gave it a key name. I then created a derived style in the resources section of each applicable window/user control like so:
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource TextBoxStyleBase}" />
This has the effect of applying to all of the textbox controls in the containing window/user control without me having to assign the style to each one.
I think what I've found is a bug in WPF, but I'm sure that Microsoft will claim that it's working as designed.
"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." - Jason Jystad, 10/26/2001
modified on Friday, July 10, 2009 4:24 PM
|
|
|
|
|
I have a resource dictionary Dictionary1.xaml that looks like this:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Style TargetType="Button" >
<Setter Property="Background" Value="#FFFF0000" />
</Style>
</ResourceDictionary>
I merge it into an app's resources in App.xaml like this:
<Application x:Class="WPFTester.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Window1.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Dictionary1.xaml" />
<!-- Example importing resource dictionary from another assembly -->
<!--<ResourceDictionary Source="pack://application:,,,/WpfCustomControlLibrary;component/Dictionary1.xaml" />-->
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
All the buttons in the app, unless otherwise styled, have red backgrounds.
What did you do different? Are there other styles earlier in the search order that are
overriding your app-level styles?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|