windows-runtime

How to enumerate through Colors in WinRT?

我怕爱的太早我们不能终老 提交于 2019-12-05 12:12:34
Enumerating through colors in non-WinRT is a common question with a simple answer. But, since the Colors 'ENUM' is actually just a class with static 'color' properties you can't use the standard approach in WinRT. How do you enumerate colors in WinRT? Like this: Enumerating through Colors in WinRT requires using System.Reflection so you can fetch the static properties sub-classed in the container class 'Colors'. Like this: Dictionary<string, Windows.UI.Color> Colors() { var _Colors = typeof(Windows.UI.Colors) // using System.Reflection; .GetRuntimeProperties() .Select(c => new { Color =

A method was called at an unexpected time

随声附和 提交于 2019-12-05 12:11:17
问题 I'm trying to iterate all files in a directory using GetFilesAsync, but every time I call the GetResults method, it throws an exception that says System.InvalidOperationException: A method was called at an unexpected time The code is simply var files = myStorageFolder.GetFilesAsync(); //runs fine var results = files.GetResults(); //throws the exception I'm new to Win 8 dev so I might be missing something obvious. Edit (solved) I'm running my console application, but now that the program runs

How do I parse a date in a Metro (C++/CX) app?

五迷三道 提交于 2019-12-05 11:46:00
问题 I have a C++/CX app that is processing some data from a file. It has a string in there representing the culture that was used to save the dates, and it has some dates. I need to convert them from strings to Platform::DateTime. I have heard that Windows::Globalization::DateTimeFormatting is the class to use, but I don't see how to use it for that. Does anyone have an example? 回答1: The C++/CX projection of WinRT differs from the Managed (C#/VB) projection in a number of ways, and one of the

New Live tiles don't work in Windows Phone Silverlight 8.1 apps?

北城以北 提交于 2019-12-05 11:41:07
So when I was watching this video from BUILD I thought it's gonna be easy... But I can't seem to get the tile of my WP Silverlight 8.1 app to change by doing the following. const string xml = "<tile>" + "<visual>" + "<binding template='TileSquareText01'>" + "<text id='1'>testing 123</text>" + "</binding> " + "</visual>" + "</tile>"; var xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xml); var tileNotification = new TileNotification(xmlDoc); TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification); Please note I've also created a Windows RunTime Windows Phone 8.1 with exactly

App Resuming event not firing when the app is resumed in WP 8.1 store app

本小妞迷上赌 提交于 2019-12-05 11:22:22
My WP 8.1 store app behaves very strangely. App Resuming event fires as expected when I quickly navigate away and then come back. But If I keep the app in background for some time and when comes back, the app fires the Constructor and OnNavigatedTo events instead of the Resuming event and has the black "Resuming..." screen for a couple of seconds(about 4 seconds).This is an app with a BackgroundAudio task. Even the sample BackgroundAudio app from MS behaves like this. Anyone knows what's wrong here? I'm in the process of building a WP 8.1 app which uses a background audio task as well.

WinRT - Display animated GIF in a control

倖福魔咒の 提交于 2019-12-05 10:25:26
I need to display an animated GIF in my metro app, but I can't find any control that allows it. (I tried Image , MediaElement and MediaPlayer from the Player Framework) Is it possible somehow to display an animated GIF? While I haven't checked if it works and it might not work for you due to airspace issues - you could try hosting your gif in a WebView control. It might be a lot easier than the otherwise better solutions proposed by Norbert and Carl. You can achieve this natively by using the BitmapDecoder class in the .NET Framework. I have an example on my blog, that shows how to implement

Unable to create a new mail with multiple recipients with mailto uri

萝らか妹 提交于 2019-12-05 10:14:44
I am using creating a Windows 8.1 Store App in WinRT . I am unable to create a new mail with multiple recipients with the mailto uri by separating each email with either comma or semi colon, both gives me the same error. Invalid URI: The hostname could not be parsed. the mailto strings looks like this "mailto:username@mail.com,username2@mail.com" "mailto:username@mail.com,username2@mail.com," "mailto:username@mail.com, username2@mail.com" "mailto:username@mail.com;username2@mail.com" "mailto:username@mail.com;username2@mail.com;" "mailto:username@mail.com; username2@mail.com" I have tried all

Where Is DrawingBrush In Windows Metro for XAML

流过昼夜 提交于 2019-12-05 09:51:38
Im writing a Windows Metro XAML based app in C#, and I want to draw grid lines with a brush on my custom grid control. In WPF I would create a DrawingBrush to do the job, but there seems to be no equivalent in Metro ??? Does anyone know if this feature exists under another name, or that you achieve the same result differently ? As an additional note, I do not want to draw lines etc directly on my grid (adding lines to my panel's children collection), It really needs to be done via the background property - i.e a brush. Thanks WinRT-XAML stack is closer to Silverlight - also in its limited

Metro App FileIO.WriteTextAsync Multiple Threads

馋奶兔 提交于 2019-12-05 09:31:25
I have a method which is called frequently from multiple threads. It involves writing to disk using await FileIO.WriteTextAsync . This works fine when it is called from a single thread, but once I start doing this in multiple threads, I get this error: The process cannot access the file because it is being used by another process. I know what the error means, but I'm not sure how to work around it. Normally, I would create a lock(object) statement, to ensure that the file is being accessed by only one thread at a time. However, this is an asynchronous method and as such I can't use the await

Implementing State handling in windows 8 using MVVM Light

限于喜欢 提交于 2019-12-05 08:27:51
How i can implement state handling (running / resume / Terminate states ) using mvvm light. The major issue i a facing is with Navigation. I am totally uncontrolled with the navigation stack. How i can effectively manage this with MVVM Light. You might be interested in the open source Okra App Framework that is freely available on CodePlex and NuGet (disclaimer: I am the lead developer on this project). This has been designed from the ground up for Windows 8 applications, in particular those that use the MVVM pattern (and you can still use the MVVM Light base classes to define your view-models