winjs

How to launch a URL in IE10 from within a Windows 8 WInJS application?

こ雲淡風輕ζ 提交于 2019-12-04 08:59:22
this might be a silly question but I have not been able to find an answer. I want to launch a specific URL with IE10 from within my Windows 8 javascript application, i.e. my application will be suspended and IE10 will launch. How do I do that with javascript? Thanks Themos var url = new Windows.Foundation.Uri("http://www.google.com") Windows.System.Launcher.launchUriAsync(url); 来源: https://stackoverflow.com/questions/10600359/how-to-launch-a-url-in-ie10-from-within-a-windows-8-winjs-application

Chaining Promises recursively

我们两清 提交于 2019-12-04 08:20:54
问题 I'm working on a simple Windows 8 app in which I need to fetch a set of data from a web site. I am using WinJS.xhr() to retrieve this data, which returns a Promise. I then pass a callback into this Promise's .then() method, which supplies my callback with the returned value from the asynchronous call. The .then() method returns another Promise, giving it the value that my callback returns. The basic structure of such a query would be as follows: WinJS.xhr({ url: "http://www.example.com/" })

How to create a Blob object from image url?

穿精又带淫゛_ 提交于 2019-12-04 06:44:10
问题 I am using Winjs(javascript for windows 8 app). what I want is to create a simple blob object from a specific url of my static image by giving the path. What is the solution? Any help will be appreciated. 回答1: 'MSApp.CreateFileFromStorageFile()` as used below will work. if you need to send the file using WinJS.xhr() you can set as data in xhrOptions. var uri = new Windows.Foundation.Uri('ms-appx:///images/IMG_0550.jpg'); var self = this; Windows.Storage.StorageFile

How to draw string to a bitmap image in WinRT

▼魔方 西西 提交于 2019-12-04 03:49:08
问题 How do you draw a string to an image in winRT ? In WinForms that could be done using drawstring() method inside the system.drawing namespace but i couldn't find its equivalent in WinRT API. 回答1: Direct2D is a replacement for GDI in WinRT. So you'll have to use C++/CX with DirectX for drawing text. I don't have any examples for you, but maybe this link (and the links included) can help you on your way. 回答2: In Windows 8.1 they finally support rendering of XAML controls to bitmap. Now you can

HTML5 Canvas performance very poor using rect()

你离开我真会死。 提交于 2019-12-04 03:39:07
问题 I'm writing a game, which displays the score at the top of the screen in the following fashion: canvasContext.fillStyle = "#FCEB77"; canvasContext.fillText(' Score: ' + Math.floor(score) + ' Lives: ' + Math.floor(lives) + ' other info: ' + Math.floor(otherInfo)); Which works fine. What I then wanted to do was to draw a box around that text; so I tried the following: canvasContext.rect(2, 1, 210, 30); canvasContext.rect(2, 1, 80, 30); canvasContext.rect(80, 1, 70, 30); canvasContext

Is there a correct/recommended way of detecting my UWP app I'm running on a Phone?

梦想的初衷 提交于 2019-12-04 03:38:56
Trying out Windows Universal apps with JavaScript I noticed the WinJS.Utilities.isPhone property is no longer available, which makes sense since there would be no reason to ask for that at runtime. I do want to know just for testing purposes if there is a proper way of detecting the device my app is running in. EDIT: My question is NOT about detecting a mobile browser. I'm talking about about a brand new Universal Windows App for Window 10 that can run on phones, desktops, tablets, Xbox, HoloLEns, IoT devices et all. WinJS had a property that would tell me whether I was running on the phone or

How to prevent/disable snapped view for Windows 8 Metro UI applications

这一生的挚爱 提交于 2019-12-03 21:50:18
I have an application that really makes no sense for snapped view, as the content generally represents A4 pages of information and data collection. Is there a way to disable snapped view for the application, or is the recommended approach to just show the application icon, while in snapped mode? You cannot disable snapped view. Simply just create a new page and navigate to that page if a snap event occurred. You can simply display an image. Window.Current.SizeChanged += (object sender, Windows.UI.Core.WindowSizeChangedEventArgs e) => { ApplicationViewState myViewState = ApplicationView.Value;

Remove X button in input - Metro

六月ゝ 毕业季﹏ 提交于 2019-12-03 21:45:51
I write a Metro program in Javascript. The problem is Windows8 automatically adds an X button to it. Now how to edit or remove that button? Below is my layout, the X button overlaps the email input. Details are here: http://msdn.microsoft.com/en-us/library/windows/apps/hh465498.aspx You need to use the -ms-clear pseudo element, and style it either as you need it, or display none it: input::-ms-clear { display: none; } Note that you likely want to not display none it, since this removes the easy-to-touch X that removes the current input. 来源: https://stackoverflow.com/questions/11805562/remove-x

Avoiding memory leaks winjs EventListeners

两盒软妹~` 提交于 2019-12-03 17:14:48
I want to know if I add an event listener to a button, do I have to remove it on unload ? Would pressing the 'back' button automatic removes everything current page elements in which I don't need to worry about memory leaks? (function () { "use strict"; ui.Pages.define("/pages/registraton/registraton.html",{ ready: function (element, options) { document.getElementById("submitRegister").addEventListener( "click", postRegistration , false); }, unload: function () { document.getElementById("submitRegister").removeEventListener( "click", postRegistration, false); } });... Thanks in advance. You

Open a PDF file from a WinJS Application

谁都会走 提交于 2019-12-03 07:56:14
I've got an application in which the user clicks a button, and should be presented a PDF that is stored in the application. They can view the PDF internally in the app, or launch the native windows PDF viewer, either way is fine. How can I provide a link / event handler for the button click to launch a view of a PDF file? Use the LaunchFileAsync function of the Launcher class, description: Starts the default app associated with the specified file, using the specified options. example code: Windows.System.Launcher.launchFileAsync(file, options).done( /* Your success and error handlers */ ); 来源: