microsoft-metro

Correct way to use databases in Windows 8 and Windows Phone 8

五迷三道 提交于 2019-12-07 07:57:00
问题 I am currently working on a Windows 8 app which needs to store some tables. Currently, I am using XML files with XDocument classes to solve the purpose. It employs save and load methods using GetFileAsync and CreateFileAsync etc. Moreover, there save and load methods are called by different events. However, whenever there are repeated calls, an exception is thrown telling me that file access is denied. Expected behavior - more details here! While there are dirty methods to avoid this (like

WinRT - Display animated GIF in a control

喜夏-厌秋 提交于 2019-12-07 07:32:44
问题 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? 回答1: 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. 回答2: You can achieve this natively by

LINQ Where clause with four &&

*爱你&永不变心* 提交于 2019-12-07 07:11:44
问题 I'm trying to create an LINQ Query with 4 arguments in the Where clause. It's a Windows 8 App project and I'm using an SQLite Database. (SQLite implementation ) Here's the code snippet: public List<FinancialListBoxExpenseItem> retrieveExpenseItems(int month, int year, bool isPaid, StaticResources.FrequencyEnum frequencyEnum) { List<FinancialListBoxExpenseItem> tmpList = null; connection.RunInTransaction(() => { var items = from s in connection.Table<FinancialListBoxExpenseItem>() where (s

Assigning an async result to a data binding property

天大地大妈咪最大 提交于 2019-12-07 05:43:56
问题 Below is a sample implementation that uses metro API and data binding (using MVVM) to populate list of folders in a drop down list. The View model‘s constructor uses SetFolders method (private async), which calls an awaitable method fileService.GetFoldersAsync() to get list of folders. The folders list is then gets assigned to the property called “FoldersList”. XAML uses this property to populate a drop down list using the data binding. I wonder is there a better way to set the FoldersList

Get localized friendly names for all winrt/metro apps installed from WPF application

六月ゝ 毕业季﹏ 提交于 2019-12-07 04:38:17
问题 My WPF application needs to list the localized names of all Metro/WinRT applications installed for the user. I created a repo to store a working sample for the code presented: https://github.com/luisrigoni/metro-apps-list 1) Using PackageManager.FindPackagesForUser() method var userSecurityId = WindowsIdentity.GetCurrent().User.Value; var packages = packageManager.FindPackagesForUser(userSecurityId); foreach (var package in packages) Debug.WriteLine(package.Id.Name); } // output: // Microsoft

Dependency Injection framework for Windows 8 metro apps

大兔子大兔子 提交于 2019-12-07 03:14:46
问题 i can't seem to find a dependency injection framework for windows 8 metro apps. Is there a framework for win8 metro apps? Ninject is not yet support for win8 metro. So does anybody have a suggestion? (Castle, Spring, ...) 回答1: Here is the source for Ninject WinRT: https://github.com/remogloor/ninject It just not yet released. 回答2: You could try Unity 3.0 for .NET4.5 Preview. 回答3: I've been using the Beta version of Autofac Portable Library (which is supported in Metro apps) and it is working

Finding memory leaks in a managed Win8 metro app?

馋奶兔 提交于 2019-12-07 02:41:13
问题 I'm currently working on a metro game for Windows 8 using C# and SharpDX. The project is going well, but recently there's been a need to start tracking down memory leaks and I'm not really sure where to begin. The built in memory profiler in Visual Studio 11 doesn't work for metro apps yet, WinDBG can't seem to connect to metro apps (unless I'm using it incorrectly), and I'm having a hard time finding any information about looking at managed allocations in .NET 4.5 for metro. Does anyone have

Locked screen in windows 8 WinRT

你说的曾经没有我的故事 提交于 2019-12-07 02:21:48
问题 When my app is running in Windows 8 WINRT can I prevent the OS to go to locked screen/sleep mode? 回答1: You can use the DisplayRequest class to indicate that you are busy playing back something that requires the display to stay active and un-dimmed. A good how-to article with sample code is available here. Don't use it frivolously, it is quite detrimental to power consumption. Good odds that the Store will reject your app if you use it for no obvious benefit to the user. 回答2: You cannot

WebAuthenticationBroker.AuthenticateAsync throws exception

北城余情 提交于 2019-12-07 02:09:09
问题 My code uses : WebAuthenticationResult WebAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync( WebAuthenticationOptions.None, StartUri, EndUri); just like the Microsoft Web authentication broker sample It used to work on my desktop and on my tablet (Surface) but now it is not working on my desktop. It throws exception The process terminated unexpectedly. (Exception from HRESULT: 0x8007042B) It is working on the tablet and on different windows-8 desktop. Any suggestion what

How to place an XAML usercontrol in a grid

☆樱花仙子☆ 提交于 2019-12-07 01:59:47
问题 I have the following main.xaml and usercontrol. I need to place several times the user control on the 2nd row, 2nd column of the grid, By using visual studio it wont allow to drag and drop the user control, so I suppose I have to do it by code, I just dont know how MainPage.xaml <Grid HorizontalAlignment="Left" Height="768" VerticalAlignment="Top" Width="1366" x:Name="grid" Background="Black"> <Grid.RowDefinitions> <RowDefinition Height="150"/> <RowDefinition/> </Grid.RowDefinitions> <Grid