Feature-Request

19 views
Skip to first unread message

Gerhard Kreuzer

unread,
Feb 28, 2011, 1:50:47 AM2/28/11
to nro...@googlegroups.com
Hi Rishi,
 
maybe this will be useful:
 

<n:NavigateIfTrueAction ManageEnableState="True" Command="{Binding CheckSomethingFunction}" Url="/Pages/NextStep" />

 

if true is returned we follow the url, otherwise no navigation is performed. The developer may show some error message or whatever to inform the user about the reason of canceling the navigation request.

The definition of the navigation target is still not hard coded, but we can trigger some function do do something programmatically.

 

With best regards

 

Gerhard

Adrian Hara

unread,
Feb 28, 2011, 2:17:39 PM2/28/11
to nro...@googlegroups.com

I personally don’t shy away from navigating from view-models, especially when there some logic involved (like checking some non-trivial stuff, as you said). In the end, navigation is still a service, and view-models use services, so I don’t really see the problem.

 

Also, when navigation parameters need to be built up using some non-trivial logic, I also navigate from code.

 

Finally, much as I like xaml, blend 4 is useless on non-hello-world level projects (always crashes, throws, doesn’t load designer etc) so then I guess I’d make my life more difficult using xaml-only navigation J

 

Freundliche Grüsse / Best regards

Adrian Hara
Cloud Developer
LinkedIn 


coresystems ag
Villa im Park | Dorfstrasse 69
5210 Windisch | Switzerland


Phone +41 56 500 22 22
Fax +41 56 444 20 50
Infoline +41 848 088 088
www.coresystems.ch
www.coresuite.com
follow us on
twitter

Visit us at CeBIT:
SAP Partner Booth: Hall 5, Booth A18
Cloud Computing: Hall 4, Booth A58
OS X Business Park: Hall 2, Booth A20
Microsoft Booth: Hall 4, Booth P47

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and / or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

Gerhard Kreuzer

unread,
Feb 28, 2011, 4:21:57 PM2/28/11
to nro...@googlegroups.com
Hi Adrian,
 
I also start with nav in code, but after Rishi's post I think about that seriously and came up with a scenario:
 
Think about an app and there is the need of keying in lot of data for lets say a customer. After some hard work you came up with a single input mask with quite a lot of TextBoxes.
After the technical preview the crew decides that this is not very nice and a wizard will be better here.
Ok, you split it into 3 simpler masks and group them in something like a wizard. Thanks to nRoute this will be quite simple. Navigation is made by code.
After a year or so, SmartPhones entered the market and your marketing crew want a WP7 version asap.
Some designer creates views, very small because the screen area is quite smaller than a desktop. You end up with a wizard, so no problem, but ...
The old navigation code should not be touched you still need it for the desktop version and the WP7 navigation is quite different.
You end up with some #if WP7 than .....
 
This breaks the rule 'Separation of Concerns' and the resulting code isn't as easy to read as it could be.
 
With each new UI technology you will get more of this #if stuff .....
 
But if you do navigation strictly in the UI, your business logic is untouched and no navigation stuff is cluttered over it, regardless of the number of different UI technologies of UI versions of the app.
 
I think, its worth to think about this way of designing the app, but for some cases we need the posibillity to invoke some functions and alter the navigation target depending on the return value. With such an extension, we can do things as easy as we have done with programmatically navigation and it also respects the rule 'Seperation of Concerns' and keep navigation stuff strictly in the UI.
 
With best regards
 
Gerhard


Von: nro...@googlegroups.com [mailto:nro...@googlegroups.com] Im Auftrag von Adrian Hara
Gesendet: Montag, 28. Februar 2011 20:18
An: nro...@googlegroups.com
Betreff: RE: [nRoute] Feature-Request

Adrian Hara

unread,
Feb 28, 2011, 5:52:09 PM2/28/11
to nro...@googlegroups.com

Hmm...i’m not sure I get what you’re saying: why is wp7 navigation different than desktop/Silverlight? Using nRoute it should be exactly the same. Or am I missing something?

 

Adi

Gerhard Kreuzer

unread,
Mar 1, 2011, 12:30:01 AM3/1/11
to nro...@googlegroups.com
Hi Adrian,
 
from a technical view, you were right, but there is a big difference in screen space, and now, you probably split a rich desktop input mask in some steps eg. some smaller input masks and navigation between this new masks.
The navigation urls were different and so you need different 'magic' strings in your program. To support desktop and WP7, you have to switch between this string sets and/or ommit some navigation calls. This is usually done by #if .. constructs, and code gets more and more unreadable if the count of supported UI versions grows.
 
Doing the other way round, each UI brings his own navigation stuff into play and logic isn't touched. As an advantage, there is the fact, that logic isn't altered by any of the UI versions. Code is still readable and the rule 'Seperation of Concerns' is fullfilled. 
 
I know, my english is .....
 
With best regards
 
Gerhard


Von: nro...@googlegroups.com [mailto:nro...@googlegroups.com] Im Auftrag von Adrian Hara
Gesendet: Montag, 28. Februar 2011 23:52

Rishi Oberoi

unread,
Mar 2, 2011, 5:13:17 AM3/2/11
to nro...@googlegroups.com
Adrian, I think Gerhard's got a point in that if you want to support multiple platforms/uses then it will always be better to keep View related stuff off the ViewModels. For example, consider you have a form that takes up one screen in a web-app, but on a mobile form-factor it might take two - now if you were navigating from the VM then you'll need to #if-else your VM as opposed to just creating platform/use specific views with their own navigation schemes. Then again, sometimes such SOC efforts might not be worth the time they take..

On a related note, I'm going to update nRoute to allow you sourcing the SiteMaps in the View itself, because SiteMaps to me are View concerns.. 

Cheers,
Rishi

Adrian Hara

unread,
Mar 2, 2011, 7:26:08 AM3/2/11
to nro...@googlegroups.com

But wait, if it takes two screens, don’t you have then two VMs? Or you reuse just one, in which case it would have to anyway implement some logic for parsing parameters passed between the pages, which otherwise (in the one-screen-view) wouldn’t have been passed? Which means you still have some different logic depending on the application context?

 

So I’m not sure this otherwise ideal separation is easily achievable. As to navigation, I have a wrapper over the navigation service with named methods such as “NavigateToFeature” or “NavigateToMenuItem” or “NavigateShellTo”, which themselves decide where exactly to navigate depending on the application context (Silverlight or wp7), so all those #ifs are in one place and view models remain “clean” J

 

Cheers,

Adi

Freundliche Grüsse / Best regards

Adrian Hara
Cloud Developer
LinkedIn 


coresystems ag
Villa im Park | Dorfstrasse 69
5210 Windisch | Switzerland


Phone +41 56 500 22 22
Fax +41 56 444 20 50
Infoline +41 848 088 088
www.coresystems.ch
www.coresuite.com
follow us on
twitter

Visit us at CeBIT:
SAP Partner Booth: Hall 5, Booth A18
Cloud Computing: Hall 4, Booth A58
OS X Business Park: Hall 2, Booth A20
Microsoft Booth: Hall 4, Booth P47

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and / or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

Gerhard Kreuzer

unread,
Mar 2, 2011, 7:58:16 AM3/2/11
to nro...@googlegroups.com
Hi Adrian,
 
you have one instance of a VM and you can present all properties using one view or some properties on one view and the rest on another view, as limited screen space dictates such design. As you always uses the same instance of the VM, no parameters were needed and you dont need wrappers or some other stuff. The VM didn't know anything about the views presenting properties, and thats ok. The usage of the VM is very natural and straight foreward. Designers can do some 'lets play around' things, like special animations or whatever they want, doesn't matter to your code and code is clean. The dependencies between the objects were only one direction. Views depend on VMs, VMs depend on Services, but neither Services or VMs depend on some view. Thats the big advantage of MVVM.
 
Unfortunately, I am not able to have multiple views working with exactly the same instance of a VM, for what reason ever, so maybe I made some mistake or nRoute didn't work as I expected. Hope I get this solved this week.
 
I just want to have some container, which holds an instance of a VM and navigate between n views all using the same instance of VM and all presented by this container. After jumping to a view which is mapped to another type of VM, the instance of the VM in the container changes. This way we can make wizards very natural and jump to other VM or the next wizard or whatever very natural without need of some 'technical' code.
 
With best regards
 
Gerhard


Von: nro...@googlegroups.com [mailto:nro...@googlegroups.com] Im Auftrag von Adrian Hara
Gesendet: Mittwoch, 02. März 2011 13:26
An: nro...@googlegroups.com
Betreff: RE: RE: [nRoute] Feature-Request

Adrian Hara

unread,
Mar 2, 2011, 8:01:57 AM3/2/11
to nro...@googlegroups.com

Well, if you want to have the same instance of a VM between screens, there is a discussion on codeplex about that. I’m not sure it’s a good idea myself, that’s why I was thinking that I’d rather pass some parameters (or just one, the data) to the same *type* of VM, but a different *instance*. But again, if you do that, you won’t have context independence.

 

In the end we each should use I guess whatever works for us, for me it’s ok that the VM depends on a NavigationService ;)

Freundliche Grüsse / Best regards

Adrian Hara
Cloud Developer
LinkedIn 


coresystems ag
Villa im Park | Dorfstrasse 69
5210 Windisch | Switzerland


Phone +41 56 500 22 22
Fax +41 56 444 20 50
Infoline +41 848 088 088
www.coresystems.ch
www.coresuite.com
follow us on
twitter

Visit us at CeBIT:
SAP Partner Booth: Hall 5, Booth A18
Cloud Computing: Hall 4, Booth A58
OS X Business Park: Hall 2, Booth A20
Microsoft Booth: Hall 4, Booth P47

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and / or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

From: nro...@googlegroups.com [mailto:nro...@googlegroups.com] On Behalf Of Gerhard Kreuzer


Sent: Wednesday, March 02, 2011 1:58 PM
To: nro...@googlegroups.com

Gerhard Kreuzer

unread,
Mar 2, 2011, 8:14:02 AM3/2/11
to nro...@googlegroups.com
Hi Adrian,
 
modern apps working async, but how can I start some task async at the first step of some wizard and do some other stuff instead of waiting and at the end I get the results. If the instance is gone many times, were should the async running task report his results?
 
I think, wizards always have some controller which stays the same during the whole workflow, which is modeled by that wizard.
 
With best regards
 
Gerhard
 
PS: Where is this discussion going on?


Von: nro...@googlegroups.com [mailto:nro...@googlegroups.com] Im Auftrag von Adrian Hara
Gesendet: Mittwoch, 02. März 2011 14:02

Adrian Hara

unread,
Mar 2, 2011, 8:15:23 AM3/2/11
to nro...@googlegroups.com

The discussion is here: http://nroute.codeplex.com/discussions/213732

 

As for the controller for a wizard, why don’t you use a service for that?

 

Cheers,

Adi

 

Freundliche Grüsse / Best regards

Adrian Hara
Cloud Developer
LinkedIn 


coresystems ag
Villa im Park | Dorfstrasse 69
5210 Windisch | Switzerland


Phone +41 56 500 22 22
Fax +41 56 444 20 50
Infoline +41 848 088 088
www.coresystems.ch
www.coresuite.com
follow us on
twitter

Visit us at CeBIT:
SAP Partner Booth: Hall 5, Booth A18
Cloud Computing: Hall 4, Booth A58
OS X Business Park: Hall 2, Booth A20
Microsoft Booth: Hall 4, Booth P47

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and / or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

Gerhard Kreuzer

unread,
Mar 2, 2011, 9:58:18 AM3/2/11
to nro...@googlegroups.com
Hi Adrian,
 
ok, thats an option, but whats the role that VMs should play in such an scenario? Which work should be done there?
 
With best regards
 
Gerhard


Von: nro...@googlegroups.com [mailto:nro...@googlegroups.com] Im Auftrag von Adrian Hara
Gesendet: Mittwoch, 02. März 2011 14:15

Adrian Hara

unread,
Mar 2, 2011, 10:04:17 AM3/2/11
to nro...@googlegroups.com

Well, I guess the vms would be in charge of the UI state for a particular view and the controller would deal with the “global” state.

Reply all
Reply to author
Forward
0 new messages