windows-runtime

FileIO.ReadTextAsync occasionally hangs

流过昼夜 提交于 2019-12-20 03:31:54
问题 I'm just experimenting with WinRT and one demo app i'm creating is a basic "notepad" style app which loads/saves to local storage. Whilst I'm familiar with the proper async approach for building WinRT apps, my demo app is using a synchronous Load to keep things simple. The problem is that when a call is made to Load , it works 2 out of 3 times and the rest of the time the app hangs on the call var result = await FileIO.ReadTextAsync(storageFile); public class ContentStorage : IContentStorage

How to check if Windows device is phone or tablet/pc?

半世苍凉 提交于 2019-12-20 03:19:28
问题 How to check if Windows device is phone or tablet/PC? I need to know in order to use different sizes for xaml elements 回答1: I think you can try to use EasClientDeviceInformation class: EasClientDeviceInformation info = new EasClientDeviceInformation(); string system = info.OperatingSystem; on WP it should return WindowsPhone and Windows on desktop. 回答2: You shouldn't use different sized Xaml based on if it's a phone or a tablet. You should use different Xaml based on the size and resolution

How to pass an object to background project in Windows Phone?

北城以北 提交于 2019-12-20 03:14:53
问题 My problem is that I have an StorageFile object in foreground and want to play it in BackgroundMediaPlayer like this: mediaPlayer.SetFileSource(soundStorageFile); but it is not possible to use SetFileSource() in the foreground, you should call it in the background task, or initialize a third project in the background and call it from there. So how can I pass an object to the background project? (It's a Windows Phone Runtime app) 回答1: Communication between UI and BackgroundMediaPlayer can be

Is there a way to get push to scroll functionality in Windows 8 metro Apps?

泪湿孤枕 提交于 2019-12-20 03:02:32
问题 In the Windows 8 Consumer Preview, moving the mouse towards the left or right edge in the start screen causes the content to scroll. The standard controls (and currently released preview apps) does not seem to support this. Is there a way to make this work? 回答1: I asked this question at TechEd North America this year, after one of the sessions given by Paul Gusmorino, a lead program manager for the UI platform. His answer was that no, apps can't do push-against-the-edge-to-scroll. WinJS and

How to distribute processor-specific WindowsStore assemblies with nuget

泪湿孤枕 提交于 2019-12-20 02:54:18
问题 I've got an assembly which links to native Sqlite for Windows Store apps. Because Sqlite is native, then this assembly cannot use the AnyCPU profile - instead it has to supply separate AnyCPU/x86/x64 assemblies. I'd like to distribute this set of assemblies via nuget - so that when the package is imported then the nuget installer installs separate assemblies into each platform configuration within the csproj file. Has anyone done this before or have an example of it being done? Does anyone

undefined indexedDB on Windows Phone 8.1 javascript app

北城以北 提交于 2019-12-20 02:50:51
问题 I have the following code on a (HTML/javascript) Windows Store app var reqOpen = window.indexedDB.open(that.dbName, that.dbVersion); The thing is, when I wanted to use that exact code on a (HTML/javascript) Windows Phone 8.1 app I get undefined on window.indexedDB . I can't seem to find any samples or anything related to indexedDB on WinPhone. The only article that I found that mentions both Windows Store and Windows Phone apps is this one, but it is not clear if there's a difference for

Metro App How to disable Gridview scrolling

拈花ヽ惹草 提交于 2019-12-20 02:45:15
问题 Is it possible to disable scrolling in GridView ? 回答1: Try this inside of the GridView <GridView ScrollViewer.HorizontalScrollBarVisibility="Disabled"> 回答2: As an alternative you could use <GridView ScrollViewer.HorizontalScrollMode="Disabled" /> If you're setting this property dynamically, the Scrolling will be disabled but the ScrollPosition stays (on *ScrollBarVisibilty=Disabled the ScrollPosition gets set to 0) Dynamic Example: ScrollViewer.SetHorizontalScrollMode(YourGridView, ScrollMode

How do I interact with SQL in a Windows Store App

瘦欲@ 提交于 2019-12-20 02:41:28
问题 I've been asked to begin developing a Windows Store version of our company's LOB web application. What's the best way to go about interacting with out data store? My first inclination is to go the HTML/JavaScript(JQuery) route and use a web service to retrieve the data, but I'd like to attempt to use C#/XAML as I'm familiarizing myself with XAML and this would be the perfect opportunity to take a deep dive into XAML. Is Javascript the only way to communicate with out sql servers, or can I

WP8: can't consume a native component

末鹿安然 提交于 2019-12-20 02:27:56
问题 Windows Phone 8 C# project ( MyApp ), migrated from WP7.1. I've added a native Windows Runtime component library ( AppLib ) to the solution, created a reference. There's a public sealed ref class ( MyClass ) in it. There's a reference to it in the C# code (in OnLoaded of the main XAML page). The whole thing compiles - meaning the metadata of the component is being generated. When I'm trying to run, the project fails with the exception or type TypeLoadException with the following message:

Windows 8 Metro App - Render PNGs

纵然是瞬间 提交于 2019-12-20 02:27:10
问题 I am needing to render some custom PNGs in a Windows 8 app. Basically I need to create a custom live tile by putting some drawings made in my app on top of an image for a live tile, and the only way to do this is render a PNG to disk, see here. What library should I use to do this? My first thought was to use a Xaml UserControl and RenderTargetBitmap , but it is not available in a Metro app. 回答1: WinRT XAML Toolkit has some extension methods for WriteableBitmap that you could use too. You