How to: Multi screen/regions Silverlight application? - mvvm

I have to create now a multi-screen Silverlight 4 RIA application with MVVM.
Each of these screens has to be devided in multiple regions (for example master-detail scenario whereas each of them is a different section and one has control on the other).
Can you give me some ideas what should be the right way to implement such an application?
Is Prism the right choice? I started reading the Prism manual and liked very much the idea of having regions and screens switched and controls in a very flexible manner, but, as said above, I find it too overkill to split it all over many assemblies.
If Prism IS the right choice, then I would appreciate any kind of guidance or reference to guidance on this particular scenario (multiple screens & regions and OTOH not getting my solution spotted with a gazillion projects.

I believe that PRISM is the correct choice for building an application with multiple regions and views. You could argue that that is almost the definition of a composite application.
But I would also remember that you don't have to use all the components PRISM has, you can pick and choose. I would recommend that you consider each aspect of PRISM and test/prototype to ensure you are happy with the facilties offered. In a large application I have built I use PRISM but after some prototype investigations I only used EventAggregator and the Modularity capabilities.
I chose not to use the region support as I found working with ItemControl and ContentControl components in Silverlight gave me the ability to inject views and partial views into my interface.
I found experience from ASP.NET MVC proved useful in considering how to coordinate/break up my UI into partial views.
Hope that helps. The Stocktrader application is a great example to learn from (included with the PRISM distributable).

Related

MVVM fresh vs MVVM light xamarin forms

I struggle to understand difference between mvvm fresh & mvvm light, Or I can say I am just jumping into it. So anybody just shed a light on it to be comfort to use it with xamarin.forms application.
I have used FreshMVVM in couple of mobile apps for both Small and Tablet devices. FreshMvvm is very light yet still gives you all the features you need and it is specifically designed to work on Xamarin Forms. It adds extra parts to existing Xamarin Forms capabilities like :
ViewModel Navigation
IOC
Automatic Wiring of ViewModels and Page events like (Appearing, Disappearing etc.)
It gives you the functionalities like Init and ReverseInit
It has built in Dialog service (alerts)
It supports Simple navigation, MasterDetail navigation and Tabbed Navigation
The Naming Conventions used are simple
It is very light and easy to implement
They have a very nice reference and detailed information in their project site.
https://github.com/rid00z/FreshMvvm
Update : What about MvvmLight?
All of these frameworks provides common features. Because the goal of all of them is same - providing cross platform tools that would support all of the above features I listed for FreshMvvm. The only differences however may be some of them might have some more features included and the way of implementing their Base Classes.
Recommendation for you : You should learn FreshMvvm (more light and easy to learn) and MvvmCross. These 2 are the current popular ones for Xamarin and Xamarin Forms platform.

Using OpenUI5 view layer similar to Twitter Bootstrap on top of other web application frameworks

Hello UI5 enthusiasts,
I was wondering if it is possible to extract the OpenUI5 view layer in a way similar to Twitters Bootstrap.
The reason is that I work at an SAP partner that creates software outside of the SAP stack. We would like to add the UI5 look and feel to our own web applications though, which are build on Angular and Twitter Bootstrap.
The goal would be to let our customers become attuned to the Fiori look and feel and increase the familiarity of our SAP products. Which could eventually lead to more sales on that side.
But for that we would prefer a light-weight solution. I'm not aware of using the openui5 stack like that, because it needs to load the core and manages the application in its own way.
For that it would be great to have the view components isolated to use them on their own.
Is it possible to do that or would it be an option for the UI5 product team to create a Bootstrap like solution as described above?
Kind regards,
Michael
from OpenUI5 side, we have some concerns around this approach as there is quite some overlap between Angular and UI5, especially with regards to data binding and MVC. When using the UI5 controls outside the UI5 context, you cannot leverage the main assets that the UI5 data binding adds (some of them are described here https://openui5.hana.ondemand.com/#docs/guide/91f0ca956f4d1014b6dd926db0e91070.html and others like error handling will come soon with 1.28). Still, I'm not saying the combination of UI5 controls with Angular is not possible at all, maybe someone is trying as it is open source but there is an investment needed to close gaps that OpenUI5 already has solved in an excellent manner. On the other hand, it is quite easy to use bootstrap inside UI5 (not Angular). Might that be an option?
What you can examine as well is http://ui5strap.com/. I personally did not yet find the time to assess the approach but it might be worth for you to have a look.
Best regards
Stefan

Model-View-Presenter with Google Web Toolkit (GWT)

I am thinking about developing a new application using web toolkit. I decided that the best option is going to be to use the Model-View-Presenter Design Pattern. After doing plenty of research, I found two different ways of implementing the skeleton code. (I am still trying to learn MVP and how to best utilize the disjunction between the model and the view)
Here are the two links discussing GWT MVP
https://developers.google.com/web-toolkit/doc/latest/DevGuideMvpActivitiesAndPlaces
https://developers.google.com/web-toolkit/articles/mvp-architecture
I read through and understand all the information in the second link, how you associate presenters with views, and how you have your custom events and such. I really like this because this means that several developers will be able to work on the project I have in mind.
However, the first link, also points out some interesting stuff, mostly using XML and #UiBinder and other things. I feel that those will not be necessary for this particular application but I want to make sure I have not overlooked anything.
Basically - How good of a programming practice is the style the style in the second link (the one with presenters for each view)
Thank you
You should be not be comparing MVPActivitiesAndPlaces and MVP . If browser history management is not your concern use only MVP.
Activities And Places are not mandatory for MVP. They only allow you clean browser history management which integrates nicely with MVP architecture.
UiBinder is not mandatory for MVP. They can be used with MVP.
The MVP design paradigm mostly is driven with Unit testing as main driver and to keep out slow running GWTTestCase out as much as possible.
At the heart of this pattern is the separation of functionality into
components that logically make sense, but in the case of GWT there is
a clear focus on making the view as simple as possible in order to
minimize our reliance on GWTTestCase and reduce the overall time spent
running tests.

MVVM in Windows Phone 7

Any good sample WP7 application using MVVM model in the optimal way?
I'm creating my first WP7 app, and I'm using MVVM as far as I can tell, but I'm not sure I'm doing it the right way. I have one view model per page, instead of one main view model that branches to each page, I'm not sure which is the correct way to do, so I'm hoping there's a sample app out there that I can check out.
Thanks!
Edit: I'm also having another problem on saving the ViewModels in the application state, because I think they have to be serializable (haven't worked much into this), the thing is that when I start a task and come back to the app, the latter has already been deactivated by calling the former, so I have to serialize its state when deactivated and [re]serialize it when [re]activated. This is how I save the state when deactivated:
object[] viewModels = new object[3];
viewModels[0] = App.ViewModelPage1;
viewModels[1] = App.ViewModelPage2;
viewModels[2] = App.ViewModePage3;
PhoneApplicationService.Current.State.Add("LastState", viewModels);
Again, this is probably not efficient way to do it, so I'm hoping I can see a sample app that handles this well too.
Thanks!
Have you looked at using the MVVM Light toolkit?
Serialization best practices will vary based on the volume of data in the model, the number of models being used and whether it's necessary to always load all of the models.
You might want to check out Caliburn Micro. It is used to implement a number of user experience patterns but it supports WP7 and has sample code.
Here's some MVVM samples and guidance you can check out.
C#er : IMage: Model-View-ViewModel (MVVM) Explained
.NET by Example: Using MVVM Light to drive a Windows Phone 7 / Silverlight 4 map viewer
The simplest way to do design-time ViewModels with MVVM and Blend.
Also an overview here of MVVM frameworks you may find worth a look.
JAPF » Blog Archive » Discover and compare existing MVVM frameworks
Light weight seems to be good and MVVM Light is popular. Laurent demos MVVM in the Mix 10 video EX14 if you want to check that out too.
This months MSDN magazine has an article on creating a WP7 Sudoko app using MVVM.
http://msdn.microsoft.com/en-us/magazine/gg490347.aspx
HTH
Here is my article which describes the approach to build WP7 applications using advantages of separation of concerns:
a framework for building of WP7 application

How do I organize this ASP.NET MVC2 project?

I'm tasked with creating a portal-like application that will host a number of small apps. This is my first venture into MVC, and I'm having difficulty determining how best to organize the project to handle the logical routing.
The routing pattern is:
{app}/{activity}/{controller}/{action}
Examples:
OrderingSystem/Ordering/CurrentOrders/View
Admin/Security/Users/Edit
EducationSystem/EducationPlans/CurrentPlan/View
Areas seem like a logical choice for the {app} level of routing, but from the look of things, they can't be nested. Do I just let my area controllers be a disorderly mixture of {activities} + {controllers}?
If that's the answer, how do I handle the routing? I'd prefer not to have my routing table mappings be too finely grained, but if the activity concept is going to share space with the controller concept I don't see how this is avoidable.
Alternatively, do I need to consider hosting these apps separately? That's certainly a viable option for this project, but it seems like an awful lot of trouble just to handle an extra layer of logical separation.
Anything in MVCContrib or other third party libraries that could help?
I figured this one out on my own, so I thought I'd share the solution with the community.
The short answer is, nested areas are supported/supportable by the ASP.NET MVC 2 framework, but not by the tools provided with Visual Studio 2010. As long as you are conforming to the file structure conventions and creating a AreaRegistration-derived class to handle the routing, MVC 2 will be perfectly happy to serve your views to the world. The catch is - you'll have to manually create all the infrastructure.
Give me some time, and I'll post some example code.