I am writing a desktop application in C# and would like to pass data from C# to an HTML 5 panel (javascript or jquery). I am using CefSharp which embeds Chromium into the application, it successfully loads data from a file with no web server, I have this up and running to display Processing sketches locally within the application (desktop).
The solution I am looking for can't use or require a web server, it has to operate locally. The HTML 5 (CefSharp) browser panel is hosted by the application and does not allow users to navigate to web pages. Its only purpose is to visualise and display data the software generates.
Ideally I would like to do something like the following:
Data in C# ----> (possibly) JSON object ----> object available in embedded browser
The browser has an instance of jQuery if that helps. I'd be grateful if you a small code sample can be provided, it has to operate without a web server and preferably without dumping the C# data to a file which is then loaded by the embedded browser. I want to pass data directly from C# to the embedded browser and have it available for processing.
Any ideas?
References:
https://github.com/chillitom/CefSharp
Related
I am trying to do C# web browser(navigate, favorites, display, GUI, history, sending the HTTP request, receiving http the response, bulk download) without using web browser class but I can't find anything related to that could anyone please help me with this concept code. I created the design in the C# windows application form.
Downloading files can be done with the WebClient class, but if you want an actual browser and the webbrowser object isn't good enough then I recommend using something like CefSharp.
Is there a simple way to use existing .NET features to add an HTTP server to an existing .NET WinForms application that would read pre-defined HTML pages and embed some of the application's data into the HTML, ideally with Razor? This server would be accessed by clients on the local network while the application is running.
For example, imagine some application that collects data from an external device. An HTML page would be created with special markup to display the data. Multiple clients (desktops, smartphones, etc) on the local network could then access this page using a web browser and view the data.
I have a simple windows store javascript app, and I am having problems with writing and playback Coded UI Tests. Аnd I had the idea: convert win store js app to website and test it in any of the plurality of web-frameworks.
Unfortunately, I could find information only how to convert the site into an win store app, and nothing on my idea.
How can I convert windows store javascript app into website?? I would be grateful for any information in this matter.
How can I convert windows store javascript app into website?? I would be grateful for any information in this matter.
It is not documented, but it's not difficult to convert a UWP(JS) app to a web app. You need to do the following work on your app:
Copy all the html,CSS and Javascript(including js libraries) and related assets files to your newly created Web App folder.
As there is no application lifecycle in an web app. You need to remove/modify the Lifecycle events in your project.
(ex: Windows.UI.WebUI.WebUIApplication.onactivated event or WinJS.Application.onactivated event if you are using WinJS).
Windows Runtime APIs are not available in web app. To avoid errors, it is necessary to remove or comment out the related codes that calls an WinRT API (mostly the APIs that start with Windows or MSApp).
(ex:Windows.Storage.StorageFile.getFileFromPathAsyncWindows.Storage.StorageFile.getFileFromPathAsync).
Remove ms-appx:///, ms-appdata:/// and ms-app-web:///, replace them with the normal relative path like ../../Assets/.
If you are using <x-ms-webview>, remove it or replace it with iframe.
I'm developing a project that based on database columns selection, will present those columns as charts in a browser web page.
i have been reading about WebApi (i've been told to use it with a windows form project) and for my problem i can't figure out which is the better (easy) aprouch.
The charts are created with javascript and in with the windows form i collect the database connection values (server, username,...) and the columns that will be selected for the charts.
My questions are:
do i call the webapi from javascript sending the column name and receving the values to use?
if so how can i send the column name from my windows form to javascript?
do i call it from my windows form and do all the work in the webapi and present it using the cshtml files that the webapi has?
if so how can i call the webapi from my windows form (present the cshtml file)?
how to send the data i need (columns names) to it? (i've seen also HttpClient)
Your web service (implemented by a Web API project) will return the data (e.g. comma-separated, JSON, or XML) to your local app (a web service per definition has no UI, otherwise it would be a website app). What your local app then does with the retrieved data, is a completely other thing.
And yes, it's of course possible to call a web service from JS. A web service URL is just a normal URL and can be handled like any other one. Google is your friend on that - you may use jQuery, it has some convenient shortcuts for this task.
So I have an MS Access program with VB Script loading data from Access Database. I would like to pass this information to my server. I would like the data to be transferred in XML.
On the Server side, I have a ASPX page setup to handle the incoming data. How do I get data from MS Access to that ASPX page?
You will probably want to use a Web service to pass the data around. MS Access isn't really designed to use things like SOAP/ASMX, JSON, etc. You can install the Web Service Reference tool (link below). Since you have an ASPX page, we can assume you're running IIS. So, you'll have to create a Web service that can consume the data you want to pass to it. Once the Web Service is created, find the new Web Service in Access (using the toolkit), and use the exposed methods as needed.
http://msdn.microsoft.com/en-us/library/aa140260%28v=office.10%29.aspx