Convert Windows store javascript app into website - c#

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.

Related

Loading Google Maps to C# Winform without web browser

Is there a way to integrate Google Maps into a C# WinForms application without embedding a browser into the application?
Thanks
Somewhere in 2016, Google declared that you must use a key to use their Google Maps API, that leaves you with 2 options.
To open Google Maps from the internet directly by URL (using a browser) or
Get a key, and run it using javascript, but you'd still need a browser to execute the javascript.
As far as I know, there are no current option to use Google's API offline from your own application, even the offline version of Google Maps itself will only be available for 30 days, due to the daily change in infrastructure in the world.

Building a remote command for Elpis in C# through HTTP API

I am helping to build Elpis, which is an open source pandora music player, built with C# and WPF.
Now what i want is to add an HTTP API so that the user may control the program through a browser, like play/pause, like/dislike the current song.
The point afterwards is to control the program through a mobile device accessing the HTTP API.
How exactly should i build the HTTP API so that it can control it?
Github for the project: https://github.com/adammhaile/Elpis
Without knowing why exactly you want the user to control a GUI application via the browser, it's hard to give you good advise.
Assuming you are running your GUI on Windows, take a look at OWIN and the project Katana. They allow you to easily host HTTP interfaces in your own application.
It may be overkill for your project but I would suggest using ASP.NET Web API so that you can build backend web services.
The easiest way to do what you want, assuming you really want to "control the GUI remotely" is to just install TeamViewer on your PC and on your mobile device. Then you could remote in and completely control your GUI.
But I what I think you're after is something more like Google Music. Where you can stream your music through the Internet and onto your mobile devices. If this is the case, I recommend you look at the ASP.NET Web API.
It's not hard to build a web server in C#. You can embed it into your application, and expose parts of your application to HTTP endpoints as an API. You can use the HttpListener class which is part of .NET, and do everything from the ground up yourself. Or you could use something like Nancy, which is a lightweight framework that provides a lot of useful scaffolding like URL routing.
Ended up using Kayak(https://github.com/kayak/kayak) for my self-hosted API.
The example of integration can be seen here:
https://github.com/adammhaile/Elpis/blob/master/Elpis/WebInterface.cs

Running web-application offline on android

A while ago I created an ASP.NET MVC Web Application for android devices. The application also used jQuery mobile to set up navigation etc.
At the moment, the application is simply being hosted and the androids webview accesses it that way.
The application works as expected, but I was wondering, is it possible to store the MVC web-app on the phone/integrate it into the apk?
I would like to be able to have it run the web-pages while the device is offline. I know it is possible to run simple HTML in the webview but I haven't been able to find anything about something like an ASP.NET MVC web-app. Is this done using phonegap?
Thanks.
I don't think you can do it directly with PhoneGap, from the PhoneGap FAQ
Q: Can you use PHP/ASP/JSF/Java/.NET with PhoneGap?
A: A PhoneGap application may only use HTML, CSS, and JavaScript.
However, you can make use of network protocols (XmlHTTPRequest, Web Sockets,
etc) to easily communicate with backend services written in any language.
This allows your PhoneGap app to remotely access existing business processes
while the device is connected to the Internet.
So if you are going the PhoneGap route, you'll have to write it in HTML/CSS/JavaScript. However if you more comfortable in .NET and C# then there is always Xamarin Android which has a free starter version that you can try out. Do realize though that if you go that route it will be a mobile app and not a wrapped ASP.NET app.
If I understand correctly I think what you want to do is serve your data via a web service (MVC4 web api is pretty simple to setup). Then you'd consume that data with your android app and you could more easily cache that data for offline use.

Run windows form app from asp.net page

I want to run a Windows form app from ASP.net page when clicked on a ASP button. Now I don't want to show the app on ASP.net page, as I said earlier, I want to start it.
I'm calling the Windows form app directly behind a button but it is not working and giving errors. when I searched for it, I saw that we cannot call/run windows form app from ASP.net page. So any one who can give a better idea to achieve this task?
How about Client/server technique? So that when I pass a message from client (ASP.net page) to server (Win Form App), the app should run.
Please help!
If you want to launch the WinForms app from a web page, the best approach is probably to use ClickOnce technology. It allows you to publish your application directly through a web page (no separate installer needed).
ClickOnce is a deployment technology that enables you to create self-updating Windows-based applications that can be installed and run with minimal user interaction. Visual Studio provides full support for publishing and updating applications deployed with ClickOnce technology if you have developed your projects with Visual Basic and Visual C#.
http://msdn.microsoft.com/en-us/library/t71a733d(v=vs.110).aspx
ClickOnce also works with C++ apps, but there are some additional steps
http://msdn.microsoft.com/en-us/library/ms235287.aspx
There's an excellent answer on Stack Overflow that reviews some things to be aware of. Suggest you read through that as well
https://stackoverflow.com/a/2365481/141172
If you want to launch your application (possibly including parameters) from a web page, one approach is to have the application register a protocol handler. A protocol handler allows an application to react to a URL with a new protocol that you define, e.g. myappname://TheFileToOpen
http://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx

Control website via desktop application

Is it possible for a desktop application to communicate with a javascript API that will affect the user's browser? For example, I would like to call a JS API of a web service even if the browser is not in focus. The user can select various functions from within the desktop application and it will take effect in the browser. thanks
You probably want to consider automating the browser from your application. As you are using .NET, WatiN is a good option to do that:
WatiN
To get something like that to work you would need to have your web app call for updates on a regular interval and then make the appropriate changes.
Your desktop app can make requests to whatever web interface you wish to access data. It really depends on how you build it out.
Is this an existing app? Are you building something new? More info would be nice to have to get more specific.

Categories