Issues related to developing Windows Phone apps using JavaScript

Source: Internet
Author: User

1. Compatibility issues when using ANGULARJS and WINJS1. Open SCP mode

2. Using gasket files provided by WINJS

jquery, Angularjs, and other technologies that cannot be used in winjs, such as innerHTML, innertext, and so on can work properly

<!--Safe Mode shim, in order to use angular and jquery--

<script src= "/js/winstore-jscompat.js" ></script>

This JS needs to be placed in the first load

GitHub Address:Https://github.com/MSOpenTech/winstore-jscompat


2. JavaScript Development Windows Phone program does not fully exit the issue

In WP system, the program will run in the background, the general development of the program with JS, press the return key, the program back to the backstage

The program stays in the background unless the user forces it to close.

I personally am not accustomed to such circumstances, prefer to quit after the program is completely closed, this kind of machine and save a bit of memory (programmers have wood??). )

Method one, cause the program to crash and exit1, throw new Error ();2, window. Msapp.terminateapp (New Error (1, ' exit '));

The second method will exit the program because of a crash, but will log the crash status to the Windows Store crash report, where the error message is customizable, need a value and a string ...

Method Two, JS call C # class library Call the C # Exit API1, create a class, the output type is a Windows runtime component, if you also want the current class for Windows apps, you can select a generic application

2, write the class code, the following is my instance code
Using system;using system.collections.generic;using system.linq;using system.text;using System.Threading.Tasks; Using windows.applicationmodel.core;//exit program to call namespace namespace helper{public    sealed class Core {public        static void Exitapp ()        {            coreapplication.exit ();}}    }
3. Add the established class as a reference to the JS project

4, use JS call C#api

HELPER.CORE.EXITAPP ();

Because the Exitapp here is a static method, it can be called directly, if not, the class needs to be instantiated.

C # Members should be capitalized when the first letter is called, the call should be changed to lowercase, followed by the hump name.

5, have you learned? No, it's okay, here's an example of what Microsoft is writing.

Http://msdn.microsoft.com/zh-cn/library/windows/apps/hh779077%28v=vs.110%29.aspx

Now we learn how to call C # with JS, but also can call VB and C + + code Oh, the development process is the same


Issues related to developing Windows Phone apps using JavaScript

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.