What I am looking for is a way to write the UI once and get the same running both in browser and on desktop.
We would like to use C# and SQL Server / MySQL as DB. Can you suggest the best way to code in c# to make this work
We are thinking of writing forms in WPF and then writing a wrapper to show as an application and to show as a webpage too. is it practical as we do not have experience in working of WPF
I don't think writing a wrapper around WPF application will solve your problem. You can convert WPF application to Silverlight (Which is for web) , but there are limitations.
Here is a good question for that : Convert WPF Application to SilverLight
One better way of doing it is layered architecture. You can write a data access layer and a business layer, Then you can have separate UI layer for both Web applications and desktop applications. Make your solution as loosely coupled as possible and this will help in having separate applications for desktop and web.
It's not possible to reuse a WPF application as a Web application. A Web application has a totally different setup then WPF. Web uses stateless HTTP while WPF runs completely on a clients computer.
Your best bet is to make sure you can reuse as much of your code as possible. By using a layered architecture you can create two applications that only differ in the User Interface layer.
Then you can optimize for both platforms but have a single shared code base for all other aspects of your application.
we need the rich experience of desktop, and accessibility of web application too
I suggest that you take a look at Silverlight. It runs in the browser and deploys seamlessly like any web page. And you get a "richer" client experience compared to a true web application.
Related
I've written a c# .NET winforms application I'm quite happy with.
Now I came to the conclusion, that it would be great to control this app also over the internet.
My idea is to just include a webserver into the EXE that will show the GUI of the app in a webbrowser also.
what would be the easiest way to do so? This is a hobbiest project, so I don't want to pay for commercial solutions.
Thanks in advance!
Markus
Unfortunately or fortunately including a webserver in your EXE is definitely NOT the way to go here. In fact it won't and can't work that way.
What you need to do is separate out your business logic (the code that does the processing for your application) from your UI (the winforms control parts) in such a way that you can build a web front end that connects to your business logic. If done properly you can use the same business logic for both UI's. Your web front end will have to be hosted on a webserver somewhere but a winforms app can't be hosted in a web browser... it just doesn't work like that.
Read up on N-tier programming or the MVC pattern to get started down this direction.
I've written an application in C# that I would now like to host within an ASP.NET website (MVC 2).
The application can become quite resource intensive so I would like to set up the system in such a way that each user downloads the application and runs it locally, but still within the web page that I provide.
My first idea to solve this problem was to host the program within a silverlight application. However, the app I want to host was not compiled for Silverlight, and I would like to use MySQL in it, which also appears to not be possible directly (ie without a web service in between).
The bottom line is that don't have experience with these things directly yet, and I need to research the way to make any solution possible. So I would really appreciate some input to put me in the right direction, and not have to implement 3 wrong options before finding the right one. I would also really like to avoid JavaScript if at all possible.
Thanks in advance.
Update
I probably should have specified to begin with what the application is exactly.
The application as I want to host it on the website is a simple chat program. It needs an input box and text output. The old windows forms application won't have to run in ASP, but I want to use the class library behind it, which is a chatbot engine. That engine is the part that can be rather resource intensive.
So you wrote a "rich client" application and you want to serve it as a web/silverlight application. This is not possible without changing the architecture of your app, as you probably guess, expecially because you have to interface a database. If rewriting the application to support such architecture is not an option, the best in order to me is to use Remote Desktop, but you have to pay for licenses in order to support many connections.
If your application is not a web application then it will not run on the server. The only thing your server does is to provide a download location. For that, you wouldn't need a MVC site - static pages could fit. The programming model between normal applications running on the client and server applications running on IIS is completely different. So in short: you won't be able to host your client application in ASP.NET MVC. If this is a requirement you will end up rewriting the application.
If your application is ASP.NET WebForms and it becomes too resource hungry, then you probably won't solve it by just switching to MVC. You have different options then: more resources on the server side, analyzing what could be done to lower the resources required or moving away from a server based application. This is not a black/white decision, maybe a combination might fit.
I am going to start a new (Right-To-Left) WPF project and the Main reason is to provide a single UI for the application in Windows and Web.
What Should I consider?
Which WPF Controls should/shouln't (can/can't) I use?
Do I Have to Use Silverlight? (I'm not interest)
Should I use XBAP project orWindows Project with Page base modules?
TIA
Your choices are indeed XBAP (WPF Browser App) and SilverLight.
You can easily google to find lots of comparisons, here is a short and simple one.
You main decision factor is your target audience. Do you want to support the Apple platform and maybe even Linux? Then use SilverLight.
If you're sure you only have Windows clients (Web and Desktop) you could use the more powerful WPF. But do write the WBA first so you don't run into permission issues later.
Today we have a windows application that, using an OCX, creates a web page (visible by a WebBrowser control in a small .NET WinForm application) and communicates through COM to the main application/client. (not relevant but this is Pascal)
I'm currently responsible to re create this application in a web environment so we can have the same functionality shared through Web as the user can see the same in a Web Browser.
The Windows application has almost 4 years on it and I need to re create everything from scratch, and all the bugs/features find in the future in the Windows Application I have to re create them again in the Web...
Ohh well, you can see where this will end.
I was thinking... is there any way I can create a Wrapper, even using 3rd party commercial objects, to:
Communicate with the COM Object
Can expose the content of the OCX
(this in my most confortable language, ASP.NET C#, but other are welcome)
I was thinking out loud, can this be accomplish with a Java Applet? Silverlight 4?
Any ideas or any point to the right road will be appreciated.
You may want to consider using Silverlight 4. Although it's not fully baked (Microsoft announced it as Release Candidate status yesterday or today) it has COM support but will run in a web enabled way.
The fact that your previous application is Windows/OCX tells me that the chief weakness of this approach, which would be platform neutrality, is less of an issue.
I want to start silverlight development inside an application which developed by WPF.
Actually we want to add silverlight featuretoan existing WPF project. what should we consider and how todo this
I saw Getting started with Silverlight development and it was not my answer
I mark this as a Community Wiki.
Please clarify your intent. What do you mean by a Silverlight feature ?
Silverlight is a subset of WPF, but is intended for a Web application (i.e. running inside a Web browser, using the .NET framework provided by the browser plug-in), while WPF is meant for a desktop application (i.e. running outside of a browser, using the full .NET present on the disk).
(there is the notion of running WPF inside the browser, but that is still using the full .NET framework).
"Adding" Silverlight to WPF doesn't make much sense because you can accomplish whatever you need to do in regular WPF for the most part. If you already have a WPF application you are enforcing windows and the full .NET client run time so you are going to get any deployment benefits.
I assume what you may be considering (since you mentioned XBAP) is to re-write or recompile your current WPF XBAP application into a Silverlight application? This way you get cross platform web deployment with the full Client run time requirement.
If this is the case then you would not be "adding" to your existing solution. It would be more an exercise in porting the existing application over to Silverlight. With SL3 this is less painful then before (and if SL 4 is an option it will be an even better experience).
My first step would be to simply create a new Silverlight application and begin moving your code over and seeing how far you get.