Regarding embedding a application with WPF webpage - c#

I created a application let say "Mydesktopapp"(which is mix of C# and c++ deliverables and few XML's file).
'Mydesktopapp' can be run by clicking a batch file. Hence once user click on batch file, application gets executed and does it functionality on a desktop system.
Now i want to provide this application to the user through a webpage(so that everybody don't need to explicitly copy Mydesktopapp and then run it, instead user should just open a webpage from anywhere...and should click a button on webpage and application should get downloaded and run.
To achieve this...i created a webpage with a button and published it. On button click i will run the batch file. but i don't know how to embed Mydesktopapp with webpage...so that it get published with it and get downloaded automatically when user open webpage.
I am new to WPF but yes..i don't want to create a WCF(or webservice etc ) instead i just want to enbed/attach this app with my webpage and get it downloaded automatically.
Please provide help.

Your solution is Silverlight or WPF browser application, since wpf is primarily a desktop application, I 'll recommend you to opt for silverlight for the web based solutions
From Microsoft's website
Silverlight is a powerful development tool for creating engaging, interactive user experiences for Web and mobile applications. Silverlight is a free plug-in, powered by the .NET framework and compatible with multiple browsers, devices and operating systems, bringing a new level of interactivity wherever the Web works.
more info on Silverlight at http://www.microsoft.com/silverlight/

Related

What is the best strategy to allow an application to be themed by an customer and published for download?

I'm building an application in WPF (C# 4.0) that can be downloaded online for free on the internet.
If the user wants to customize this app (custom icon, color scheme, etc.) UI, he will have the option to configure colors, upload resources like icons and logos, change texts, etc., all done through the website.
My question is: what would be the best strategy to allow users to do this kind of customization, having the server build and package the application and later publishing so the user can download it.
Currently I'm accomplishing this using build script written in powershell, that are invoked by the webserver (IIS) using a custom HTTP handler I wrote. The build result is later sent to the user by email, with a link to download the application.
Let them upload the artifacts et al and store them on the server (in a DB, or whatever).
Then when on system start, when the app initially launches, deploy them from the database in to the appropriate places within the application.
If they're changing CSS colors or whatever, then you can start with a CSS template that refers to the colors etc symbolically and regenerate the CSS.
This allows you to separate the changeable components, and also lets you even potentially upgrade the application while the existing changes remain in place.
Regenerate on restart lets you treat them all as if they're static resources, and odds are the start up time will be negligible.
You can also regenerate on demand.

calculating the page load time on fly across different browser(C# console application preferbly if not any technology)

Hey i need to have a console application (C#) which can take the screen shot of the page once it is loaded(in all the browser).How can i calculate the time taken for the page to load completely from my C# console applications.:)...the windows form control works with the ie8 only. Basically i need to be able to calculate the time taken for the page to load on fly from my console application and it should be applicable for the all the browsers.(i am able to find in the same in ie as webforms control by default uses ie8 for rendering the html file.
If it not possible with c# console application pls suggest any other way also.It can be in java also.
An eary reply is highly valued,
Thanks Sagar.
Without actually interfering with the browser through an exposed API or an extension/add-on to a browser which can communicate to your console application, IMO this can be very hard or impossible. So find out whether the browser of your choice exposes an API to let you acquire the details or whether an extension can communicate with your console application.

Running Windows Forms Through In the Browser

I wrote a client/server program using windows form application in visual studio. Now i want to put this program onto a web page, so on the client side they can just go onto any browser and and access the server.
Can i just embed the program i already hav onto a webpage or do i need to rewrite it using visual studio web application or maybe web services?? If so, will it be any different than a regular windows form application?
Sorry, you'll have to rewrite it. Your windows forms application runs on the client, but you want to run it through the browser, where it would have to run on the server.
If you've followed good design principles, the core functionality of your app will not be in the forms, but in classes (hopefully in a class library) that are not specifically tied to the UI. If that is the case, you'll just need to create a web front end (UI), and you can reuse the existing C# classes.
If, however, like many inexperienced developers, you've coupled the underlying logic tightly to the UI - a good example is putting code in the form's .cs file that's not really UI-centric - you're looking at a lot of refactoring, and THEN writing a web front end.
Perhaps you should have a look at ClickOnce deployment. I believe you can utilize it to download the WinForm app from a website.

Integrate C# Desktop Application With Browsers

I have developed an application(downloader) using C# now i want to integrate it to browser like i want to place a button in browsers if user press that button then my app should execute & start downloading the required file.
I'm largely guessing, but it sounds like you are talking about a "protocol handler", i.e. to handle hyperlinks to "yourapp:some-stuff-here". If so, try looking at Registering an Application to a URL Protocol on MSDN, which gives a C# example of this.
I don't think that what you want is possible, you can however place a link to the executable and tell your users to execute it via the Browser download options (The Dialog that pops up when you click on some download link that asks wether you want to open oder save the file).
It is not possible to immedatly run your GUI application on a browser button click.

interacting with the browser using C#

i wish to interact with my browser window may be IE great if it works on Firefox too, using C#.
I want to make a software which can fill the entries in a webform automatically. In old times there was gator now is roboform, where it can fill in the values automatically.
I actually have users who are comfortable working on an old windows forms application, so i want to make a solution where they can still enter the data in their windows application and it actually fills in the entries at the web form and acts as if the request had generated from the browser itself.
I know i can merge both the databases, since it is a legacy application re writing the database for windows app is a trouble..
Any suggestion?
WatiN is designed to make testing web applications easy from .NET, and it sounds like it could be handy for what you want to do:
Following is the Hello world example
of web test automation; searching
Google.
[Test] public void
SearchForWatiNOnGoogle() { using (IE
ie = new IE("http://www.google.com"))
{
ie.TextField(Find.ByName("q")).TypeText("WatiN");
ie.Button(Find.ByName("btnG")).Click();
Assert.IsTrue(ie.ContainsText("WatiN"));
} }
WatiN Feature List
Automates all major HTML elements
Find elements by multiple attributes
Supports AJAX website testing
Supports frames (cross domain) and iframes
Supports popup dialogs like alert, confirm, login etc..
Supports HTML dialogs (modal and modeless)
Works with Internet Explorer 6, 7, 8 and FireFox 2 and 3
It's billed as a testing application, but Selenium RC can be used to fill in forms and is fairly easy to setup. You could also check out WatiN. Don't know anything about what security issues you might see though.
You might also want to check out Selenium which is a web application testing framework that you can programmitically interact the web UI.
If you use fiddler you may be able to see what the browser sends back to the server, and so you could write C# code to generate the same kind of HTTP request.
If the interaction is very complex (it often is with modern webapps), you could instead automate the browser, as you suggested.
I've had some success automating IE by using the InternetExplorer.Application object. It basically launches a copy of IE and lets you control it from code. I wrote a script this way a few years ago to search for cheap train ticket reservations for me on the Virgin Trains website.
The problem was that with some IE installs, it would sometimes stop to give security warnings that I couldn't skip automatically. There didn't seem to be a pattern to this.
If your users are simply using the application via a WindForms application, then is there any particular reason why you have to manipulate the user interface of an existing web browser, such as Internet Explorer, rather than just making the necessary HTTP requests yourself in your WinForms application? You can use the WebRequest class by setting the Method property to "POST" and writing the field data to the Stream, which you can get using the httpRequest.GetRequestStream() method.

Categories