Winform application for tablet? - winforms

I have a customer who wants an application for his travels where he can update an online DB, he doesn't want to buy a laptop, he wants a tablet or something similar. I have no knowledge nor desire in creating special apps for mobile devices, I want to create a winform just like I always did when it was targeted for pc. Tablet pcs (which from what I understood is just a regular pc?) are still very expensive in my country.
Is there a simple adjustment to make winform app run on a tablet with android or I have to build a special app for it? Any other solution? (I began in writing a web page for it, but it's much easier using winforms)

Native WinForms applications will not run directly on Android (or any non-Windows platform). You may want to begin by looking into MonoDroid for porting .NET code Android (and Mono in general for porting .NET code to non-Windows platforms).
A successful port across platforms will require that the application be structured in a very de-coupled manner. Core business logic in the abstract part of the application should be easily ported, but concrete implementations (specifically views and data/service access) will require some re-implementation for the different concrete platforms. So the overall architecture needs to be very de-coupled and pluggable.
Is a Windows tablet an option? Using various new technologies at Microsoft (Windows 8, Metro UI, etc.) you could build an application that would target multiple Microsoft-based platforms. This could easily satisfy the requirement of being "a tablet" (if the requirement isn't more specifically "an Android tablet"). However, it won't be the old WinForms style of applications.
In general you'll find that the industry has been steadily moving away from WinForms for, well, this exact reason. It doesn't port to other platforms, and there's a wide variety of platforms in demand today.

Forget convertion i was in a similar position years ago and i did something easier faster and i think smarter.
just make a winform with nice big controls take care of docking scaling anchors etc so that it will look nice and can be used with small smart devices.
Make sure you pass some start program parameters in your app and when a special parameter is passed instead of opening the main typically desktop form of your app open that new one in fullscreen.
Now the tricky parts isnelsewhere. I hade setup a tiny windows 2008 r2 server that allows remote apps to be run on it.
Create a user account that you will allow access to that server and only that app of yours with the specific parameter we talked about. (Ex myapp.exe -remote)
The what ever device he will get you can download the free app like 2x rdp or microsoft rdp in android. Make a new connection to your server (you can use any free ddns you like if you dont have a static ip) and connect with that windows server account you did before.
This account if has been properly setuped will only run your app and will only show that new mini winform you did..
The end user will do a simle click and from his internet connection will do a simple remote desktop that is linited to your app only. (Router configuration is needed once)
That way you will keep maintain just one source code and he will have low bandwidth cost and can continue his work without data loose in case of disconnection.
I use that for years in mobiles tablets and pos systems. Its fast its stable its secure its easy to maintain (nothing on the client side) and you don't waste months of learning wpf or doing xamarin converting.

Related

Web performance isn't up to snuff... what's the new "Microsoft Way"?

Looking for opinions. I'm working on a mid-sized 3-tier ASP.NET project (.NET 2.0 and Visual Studio 2005) with an Oracle on Unix back-end, some beefy MS web servers, and IE browser clients. Performance is pretty bad, and users feel the UI looks outdated as well. We may have an opportunity soon to redesign and rewrite the entire application from the ground up, and I'm wondering what the current or recommended MS platform is.
I was involved with WPF and Silverlight on a different contract when MS downgraded support for Silverlight in favor of "HTML5" for Windows 8 and Windows Phone a few years back. I'm not trying to start a flame war between how long Silverlight or even WPF will be around, but I'm looking for some modern alternatives as of today, April 2013. The one requirement we can't get around is that we can't install something on each and every user PC throughout the client organization.
My own background is in WinForms and C# more so than any of the above, but everywhere I turn it seems developing any new LOB apps in WinForms isn't done much anymore.
Whatever happened to the Application Server platform and apps run thru Remote Desktop? Does it still make sense to develop desktop apps and deploy to app servers and just put a shortcut on each user's desktop, or even map a drive letter like we used to do back in the day?
Your $0.02 would be appreciated!
I would definitely consider doing it as an internal web site.
The UI would be HTML5 using the "single page application" (SPA) for each function you need. Each function would be on a page that is loaded when the user needs it. The javascript/ajax code in the browser would interact with the web server which feeds back the raw data needed to be displayed.
Using Active Directory, you can have full security and customization per person.
If you need lots of interactivity, then you'd also want to consider including SignalR in the mix. (That is one of the "new" MS tools!)
If you can't install anything in the end users' PCs then go ASP.Net. Anything else will require installation.
You can make a web application more appealing to the users by having a good designer and a LOT of javascript. Not remotely comparable to the power and beauty of WPF, but that's your best bet.
WPF is part of the .Net framework and will not run without it installed.
Silverlight could also be an option, but it still requires an installation (although minimal, 4 MB, less-than-2 minute install), but an install anyways.
WinRT only works in Windows 8. It's not supported in lower versions (Vista, XP, 7). So I don't think it's an option as of now (unless all your users have Windows 8, of course).
And no, winforms is not an option. It's also part of the .Net framework, and even if you could get it installed, it doesn't make any sense having to deal with the limitations of it, having many much much better technologies at your disposal.

Is it possible to create a desktop application using Silverlight?

I have been using WPF for a while, and I keep on realizing again and again that Microsoft invests its efforst in Silverlight, not in WPF (RIA Services, default theme, controls and more).
I thought it might be a good idea to migrate to Silverlight (i.e. creating standalone desktop apps with Silverlight 4.0), the question is whether this is possible or not.
BTW, I think LightSwitch applications are generated with Silverlight as standalone desktop apps.
From MSDN:
Silverlight 3 applications are no longer restricted to running in a browser. They can be run in a browser or it they can be detached from the browser and run from the desktop. These out-of-browser applications allow you to bring the richness of Silverlight 3 applications directly to the desktop without the restriction of running within a browser.
Link: Building An Out-of-Browser Client With Silverlight 3
It is possible to create standalone desktop apps(Out of browser apps) with silverlight version 3.0 or higher and it works great. Now it is also possible to install the out of browser app even without opening a browser as shown at this blog post .Silverlight is awesome and silverlight apps even run on MACs and Linux(limited support)
However, it is not true that Microsoft is only investing in silverlight. Microsoft is investing in WPF too. Though it is possible to create out of browser applications with silverlight, they have lot of limitations when compared to a full blown WPF applications.Dont forget that silverlight is just a subset of WPF, for example, silverlight doesnt have ADO.NET, Hardware device access etc. So if your application is merely a business application and you dont have to access hardware devices or database directly then silverlight might be an option, however if your application accessing client machines hardware resources directly then you are better off with WPF.
My suggestion is, If you know before hand that it is going to be a desktop application then go with WPF(or may be even XBAP). In my experience, useful applications grow with time, new features are always requested time to time. If in future,a feature is requested that cannot be accomplished with silverlight and can only be accomplished with WPF, then you will be in a big trouble because you need to rewrite your app in WPF and it will be hard for you to convince your CFO to allocate more fund just to implement one feature. Silverlight is not designed to develop desktop applications, its main goal is multi-platform support.
Silverlight 3 supports Out-of-Browser functionality.
Quote from Wikipedia silverlight page :
Silverlight 3 supports Out-of-Browser experiences, i.e., Silverlight applications can be installed to the system for offline access (provided the application manifest is designed to allow local installation) where they run outside the browser.
Also here is a quick howto
Out of browser applications have the same security restrictions as in browser applications.
With Silverlight 4 you can create full trust applications which have full access to the computer.
More on Network Security Access Restrictions in Silverlight
If you mean Out of Browser apps, certainly. The Seesmic Desktop 2 app is an excellent example of one of these apps, with it's own updating mechanism. Seems a no brainer to use the XAP/MEF plug-in Model and Silverlight in this manner.
Seesmic Desktop 2
We're developing an OOB app along the same lines, one internet download and you're done. You're not going to get exactly the same APIs as you get in WPF, though.
As others have pointed out, Silverlight apps can be installed to run 'out-of-browser', but even with elevated trust they still have significant restrictions on what they can do and certainly don't have "full access to the computer".
Creating an app from scratch, you may want to consider parallel Silverlight & WPF builds. The code can more-or-less be shared by adding the .cs files from one project (e.g. WPF) to the other (Silverlight) using "Add As Link". The XAML files cannot be linked this way and need to be duplicated, but that may not involve much more than copying & pasting, depending on your structure. There're good examples of this on the web.
Developing both types in parallel would likely involve a lot less effort than having to abruptly switch types at some point and discovering incompatibilities/limitations too late.

Out of browser silverlight application vs a traditional desktop application [duplicate]

This question already has answers here:
Why change from WPF to Silverlight 4?
(8 answers)
Closed 3 years ago.
If I understand correctly, Microsoft Silverlight is a lightweight .NET implementation meant to run on the client side, inside a browser. So now I hear about "out of browser" silverlight applications and I'm confused.
What is the advantage of an "out of browser" silverlight application, compared to a traditional .NET desktop application?
An out-of-browser install of a Silverlight application still runs in a security sandbox where as a traditional .NET desktop application won't.
The objective of an OOB is to give the user the ability to lift a web-based application out of its browser container and make it easier to access. Its still a web based application. Its worth bearing in mind that this works on a Mac where as a traditional .NET desktop app won't.
This area has become muddier with SL4 OOB that can now ask the user for elevated trust. Now the sandbox is more relaxed and there are greater opportunities to work with the native OS. However there are still many restrictions in place primarily to support multi-platforms. It would not be desirable if it became a defacto that trusted OOBs tend only to work on Windows. It remains to be seen whether that can be avoided.
So if you're thinking of a full-fledge Windows desktop app then you're probably better off using WPF. On the other hand if you don't need full access to the OS, you can deliver via a web page and/or you want to be able run on both Windows and Macs (and possibly other platforms) then perhaps Silverlight 4 OOB+Elevated Trust may be what you need.
Silverlight 3 out-of-browser apps allow any Silverlight app to have a desktop shortcut, and don't require the browser to be opened to run the app (so technically you could now run the app even if you're offline, since you don't have to fetch the SL app via the web).
With SL 4, you can now have elevated privileges, allowing the SL app to access local resources (such as the network stack and file system).
There's also a simple API call for an out-of-browser SL app to check for updates on startup, and download an update from the server. This could be seen as similar to click-once deployment, but it happens automatically and quickly, so it's more efficient and straightforward than click-once.
Compared to a traditional .NET app (in this case let's compare with WPF, since that's effectively the WinForms replacement), there's very little in the way of installation. No setup program, just the xap file, easily hosted on the web and very quickly installable. SL uses a reduced .NET framework, which might seem like a negative. However, the typical pattern for an SL app is to put most of the heavy-lifting in a service tier. Then, in the service tier you have the full .NET framework and can do pretty much whatever you want (such as accessing databases with ADO.NET).
Libraries are another thing to consider between the two applications. For example, Silverlight 4 natively has built in support for talking to a web-camera and microphone out of the box while WPF and the full .net Framework have a very large third party community of libraries to draw upon which you might need source code for if you wish to rebuild them under Silverlight.
Another factor is limitations in the sandbox, for example, you wouldn't be able to write an application that could connect to any server using any socket in Silverlight 4.

Silverlight OOB vs WPF ClickOnce

Silverlight Out of Browser technology and WPF ClickOnce on the surface have similarities. Easy and simple deployment, the ability to specify the level of trust access to the underlying host, etc.
What are the key issues I need to consider when choosing one over the other?
To put a finer point on it, I'll be deploying LOB apps on a corporate network running only windows computers.
The big one is cross platform compatibility. If you need you app to run on a mac as well as windows (not sure if Silverlight is supported in Linux yet) then use Silverligt. If you want to make an assumption that all your users will be in a windows machine then go WPF.
Obviously WPF has a much richer toolkit than silverlight so it may well be that silverlight just isn't an option. If I was just building for windows though I know my job would be easier in WPF.
Given that you are targetting a private infrastructure running Windows, two points worth thinking about
Wpf has a richer control tree, whereas Silverlight is a reduced set for compact size
Wpf requires .Net framework installed locally, whereas Silverlight has its own platform independent browser-based runtime
While your target platform will likely have the latest .Net framework installed, rendering this last point moot, keep in mind any updates to the framework [ie .Net4.0 and any future updates] may require a restart of the machine - which is a major pain point for businesses that demand constant-on stateful desktops [ie anything in finance, like banks and trading].
As with all problems, your requirements, not the technology, should inform your solution. :)
You mentioned trust access to the host which I think rules out Silverlight unless you want to run SL4 (beta).
We recently went through a lot of discussion about file system access. Silverlight 3 runs in a partial trust sandbox more or less. You can't maintain a pointer to files in the files system outside of your application's isolated storage. This was an issue for us as we wanted the user to be able to use the application to reference odds and ends on your file system. That said you can allow the users to load and save files from anywhere on the system but you just get/or push the file stream and (to the best of my knowledge) don't have access to the folder or file path information.
Silverlight 4 (in beta) has support for your application running in full trust mode. I haven't played with this yet however and can't speak to how well it works.
In talking with a lot of people who work with both Silverlight and WPF, even those who are excited about Silverlight and push for it strongly, I hear a lot of the say fairly emphatically that if you are going to be developing exclusively for a full-trust Windows environment, WPF is hands-down the obvious choice.
That's not to say that Silverlight is an inferior product or that there aren't times will Silverlight will be the clear winner. But when you say "I'll be deploying LOB apps on a corporate network running only windows computers," it sounds like WPF is the clear winnder.
You could decide to go down the Silverlight route in anticipation of all of the great new OOB feature os SL4. I've even heard rumors that SL and WPF will eventually merge, so it may not even really matter, right? Well, I think what you'll find if you go with Silverlight is that some of the advanced features that you thought were there weren't there in the way you expected. For example, SL4 will be able to run in "Elevated Trust" (not full trust) and you might find this limiting at a frustrating point in the project where a lot of your code base is already in Silverlight.
Certainly keep your eyes on Silverlight, but for your current business case, WPF will likely be the best fit.

WPF vs Silverlight 3.0

Silverlight 3.0 beta has just been announced at Microsofts Mix Conference in Las Vegas.
Two features of the new beta are 3D-graphics and the ability to run applications outside of the browser, which to me seemed to be two of the major features that WPF (Windows Presentation Foundation) previously offered over silverlight.
I am currently evaluating WPF and Silverlight for possible use in our companies future development activity, and this announcement has left me confused as to the intended direction of these two UI technologies and why I would choose one over the other.
Has anyone implemented a new application using WPF recently, and if so, what drove you to that decision? Given the announced changes to silverlight, Would your decision have changed had you made it now, and if not, why?
Any advice would be appreciated.
The biggest difference I find is the asynchronous model you have to adopt
in your Silverlight application.
It does seems like an advantage (and it can be), but it does make
life very difficult sometimes.
There are also some limitations that can be a real challenge like the absence
of print support.
I would recommend Silverlight over WPF when:
- There is no need for best possible performance (graphics included)
- Can get around the absence of print support (it will come, we just don't know when)
- Camera/Microphone support is not needed
- Can tolerate the assync app/development model
- Can tolerate limitations on WCF (no support for WS-Security at this point)
- There is no need to store huge amount of data on the client.
- There is no need to direct integration with client side applications like Office.
- Has a server to host your application
I would say the main difference is that WPF requires the client to have the .Net 3.0+ framework. Silverlight only requires the runtime. Now that being said, WPF is geared more for controlled environments such as an intranet. Silverlight is meant for the public web. Another difference is that Silverlight is cross platform (Windows, Mac, Linux in the future & Cross browser). WPF is meant for Windows only.
The .Net framework can be a huge download for some users. Silverlight is only 4-5MBs. This is a big difference to run your app on the web, but not a big issue if its an internal application at your company.
Silverlight is Sandboxed which is meant for web use. So if your app requires more permissions you will need WPF.
There are also some differences between Silverlight code and WPF. But from what I've heard, the ultimate goal is to get a Silverlight to run inside of WPF with minimal code changes. But they aren't there just yet.
I have just worked on a WPF project that in hindsight we feel we might have chosen SilverLight for. It is probably more important to know the differences and select the one that is most appropriate for what you're doing.
Here's my starter for ten on some of the important differences - there were originally some differences in the available controls, but that has largely been smoothed out now.
Silverlight
Runs entirely on the client with AJAX
calls to the server for data
Can run on any server, including Windows and Linux / Apache
Uses COMPACT .NET framework
WPF
Runs on the client... usually calls services for data
Runs on Windows XP / Vista with .NET 3.5
Utilises the entire .NET framework
Silverlight is basically a stripped down version of WPF in order to make the runtime libary download as small as possible.
As a result, WPF simply has a lot more functionality available in it and tasks that are simple in WPF often become not so simple in Silverlight.
If running as a web app is not a requirement then the decision is a no-brainer - WPF all the way.
Has anyone implemented a new application using WPF recently, and if so, what drove you to that decision: Well since WPF was desktop only (or browser based using XBAPS - but that was more a deployment system than a real system) that was a good reason to it.
"Would your decision have changed had you made it now, and if not, why?" - No Silverlight, even on the desktop in v3, is still highly sandboxed and so certain functions are going to be hard/impossible to do due to the sandbox. Also the ability to use DirectX parts in WPF will still give another optimisation area which Silverlight and it's 3d won't be able to use.
It's worth noting that Silverlight's 3D is not the full 3D support of WPF, but only projection of 2D into 3D - i.e. take the 2D plane and allow rotation in X, Y & Z directions. WPF has full 3D modelling with materials, view ports, lighting and camera positional support etc.
I'm well along in the development of our first WPF app for release. Silverlight 3 looks great, but for this application I would still have chosen WPF. The application centers around presenting and manipulating very large sets of images hosted on a central server on our clients' networks. Additionally, the software update/change rate will be minimal. Mass import of new images from a local drive, no Internet connectivity requirements, performance concerns, etc. make this a project well suited for WPF.
One of our upcoming projects, however, will require many remote users to access a single data store on our network. The data they work with requires significant validation and error handling, so running that code locally is ideal. They will need the ability to work both on and offline and remain in synch (probably with SQL Data Services). SLOOB (Silverlight Out Of the Browser) will most likely be our choice for that one so they can have all the Silverlight advantages but use it like a regularly installed application, even without an Internet connection.
Both formats have their place: the trick will be to avoid using Silverlight for everything - we have more tools than just 1 hammer. :-)
Another difference is that with SL you only have one 'window', you can't have dialogs (they can be simulated but their size is limited to the main window) and you can't add multi monitor support.
If you have to interact with existing business applications (e.g. open a document in the archive viewer) you need to use WPF.
I recently have built several internal tool using wpf, and I chose it simply because It was easier for me coming from win32 work. I don't really think that the differences are major, and really... everything i have seen/heard indicates that porting between wpf and silverlight is quite easy.
Storage: You only have 25MB of isolated storage out-of-browser. If I remember correctly from some mix09 video, this limit is lower if your app is in-browser.
http://bliny.net/blog/post/Out-of-Browser-with-Silverlight-3.aspx
No FlowDocument: So there are limitations there too.

Resources