Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to structure a 'flippable' app?

How feasible is it(and some guidance) to build a WPF(Silverlight) app in such a way that it can be flipped back and forth from Web to Desktop?

Maybe some context is in order.

I am a lone developer at a non-profit. I only develop in house apps that have very long life cycles with constant modifications and changes to business rules or requirements. For example, my first project here was converting an existing ASP.net(2.0) app to a winform app to allow disconnected use in the field.

Now if I had only known then what I know(or think I know) now I probably wouldn't need to ask this but, I digress.

I recently was introduced to Silverlight 3 and the world of XAML at Twin Cities Code Camp and one of the presenters was using some UI code interchangeably from Silverlight to WPF.

Now, right off the bat, I know that Silverlight is a Subset and is not completely interchangeable. Never the less, it got me thinking. If I used WPF and re-wrote our core app from winform would that, in fact, enable me to use XBAPs and allow my app, with few changes, to be Web based and/or Desktop with on identical UI and Business Layer?

  • What considerations would I need to make to allow that kind of flexibility?
  • Any guidance sources any one can offer?

As a side note, 75% of all our apps are in some way, shape, or form variations of CRUD apps with a Central SQL Server as the data store.

I found the following article that also helped get the wheels turning, HERE


Edit

I really appreciate the responses and I definetely will be looking deeper into Silverlight's Out Of Browser functionality.

What my original question was trying to ask was how I would go about making my UI as 'flippable' as possible. I understand that the Out Of Browser MAY allow a one stop shop app but that asside would using XAML, in a certain way, allow me to reuse an identical UI for Web and Desktop apps?

On a tangent; Can anyone offer anything on Silverlight and some type of Replication?

like image 386
Refracted Paladin Avatar asked Dec 18 '22 05:12

Refracted Paladin


2 Answers

It sounds like the best option for you would be to develop your applications in Silverlight and make use of the Out Of Browser (OOB) feature. The OOB feature allows you to install a Silverlight application on your desktop so that it can run in offline mode. You can make use of .NET RIA Services which includes the Business Application Template allowing you to very quickly create CRUD types of applications.

  • Brad Abrams blog series on RIA applications
  • Brad Abrams MIX Presentation on RIA applications

You will need to have a web services layer in front of your sql databases for this approach. However, that should be there regardless.

For data in offline mode you can use Isolated Storage (as Nate mentioned in the comments). Here are a few links on that topic:

  • Save and Load objects in Isolated Storage as Xml
  • Client side database via Linq and Isolated Storage

On my current project we cache the lookup tables as collections in Isolated storage for offline mode. When the user comes online we refresh that data. For transactional data (like an order) we don't cache them, but we allow the user to create new ones offline and then add them to the system when they come back online. It is working well for us right now.

like image 104
Bryant Avatar answered Dec 29 '22 20:12

Bryant


You should really take a look at out of browser silverlight apps. See this blog post: http://wildermuth.com/2009/03/18/Enabling_Out-of-Browser_Support_in_Silverlight_3

It seems like this might be exactly what you are looking for.

Note: That an out-of-browser Silverlight app is still fully sandboxed like an in-browser Silverlight application, unlike a WPF application which is full-trust and has complete access to the user's machine. Also, out-of-browser Silverlight apps do support "disconnected" use and provide APIs to determine network availability.

like image 44
KeithMahoney Avatar answered Dec 29 '22 22:12

KeithMahoney