windows-store-apps

When should you use Task.Run() rather than await?

五迷三道 提交于 2019-12-20 05:15:28
问题 I am storing the state of my data model. I clone the data model and then want to have it written to "disk" asynchronously. Should I be using Task.Run() which runs it on a background thread? Or should I just make it an async function and not await on it? (this will make it run on the UI thread) Similar stuff to this, but my question is a bit different: async Task.Run with MVVM And what is the criteria to decide which to choose? Thanks! 回答1: You should use Task.Run for CPU-based work that you

Filtering and Sorting of an ObservableCollection in ListView-Binding

故事扮演 提交于 2019-12-20 03:52:06
问题 In earlier Versions of .net you could use something like ICollectionView collectionView = CollectionViewSource.GetDefaultView(AllImages); To build up filter mechanisms for UI-Elements. But this doesn't seem to exist in WinRT anymore. I'm using a ListBox-Element to display an User-List. The User-Class contains the properties username (String), isOnline (Boolean), isFriend (Boolean) and unreadMails (Int). I need some kind of Filtering and sorting. Filter by: no Filter only isOnline == true

Where i can obtain client secret for my Universal app?

倖福魔咒の 提交于 2019-12-20 03:27:11
问题 I'm following this guide (http://msdn.microsoft.com/library/windows/apps/hh465407) to implement push notifications on my app, but it seems to be outdated since I can't find the client secret as shown in this image: . In developer dashboard (App identity tab) I've got only SID. I also checked Windows Live Services site but there are only passwords and private keys. There is no client secret: Where i can find that exact client secret shown in the msdn tutorial? 回答1: Azure also can't validate my

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

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

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

Windows.Web.Http.HttpClient Timeout Option

拜拜、爱过 提交于 2019-12-19 19:50:02
问题 Due to SSL certificate issue we are using "Windows.Web.Http.HttpClient" API in my app service layer. I referred below sample for my project. http://code.msdn.microsoft.com/windowsapps/HttpClient-sample-55700664 How can we implement the timeout option in "Windows.Web.Http.HttpClient" API 回答1: You can use a CancellationTokenSource with a timeout. HttpClient client = new HttpClient(); var cancellationTokenSource = new CancellationTokenSource(2000); //timeout try { var response = await client

Windows Store WebView rendered html size

谁说我不能喝 提交于 2019-12-19 11:58:22
问题 I have a strong need to calculate/get the rendered html size in WebView. Is there a way to achieve this? In Objective-C i could pass a HTML string to the WebView and available size, and it returned the desired Size. Is there something similar to this in Windows Store WebView? For example: WebView webView = new WebView(); webView.NavigateToString(html); webView.ContentLoaded+= webView_ContentLoaded(,); webView_ContentLoaded(,) { //Height=99999999 - does the trick, like available height is

C# Windows Store app returning null for UsbDevice

寵の児 提交于 2019-12-19 11:46:14
问题 Being new to Windows Store app development, I am working on an app that has to connect to several USB devices. I am using VS 2013 (community) with C#. For example, a list of attached webcams is obtained using: var devices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture); This indeed gives me a list of attached webcams. To access the first device, a UsbDevice object should be created using: DeviceInformation device = devices[0]; UsbDevice usbDevice = await UsbDevice.FromIdAsync