windows-runtime

Does WinRT access the NT kernel directly (when it needs OS support) or does it go through Win32?

时光毁灭记忆、已成空白 提交于 2019-12-05 16:44:35
问题 How is WinRT implemented beneath the hood? Uses NT directly kernel directly or is it implemented on top of Win32/64? 回答1: Both - some parts of the Windows runtime are new top-to-bottom (and thus interact directly with kernel services), other parts of the Windows runtime (WinRT) use existing services in Windows. 来源: https://stackoverflow.com/questions/8254988/does-winrt-access-the-nt-kernel-directly-when-it-needs-os-support-or-does-it-g

How to detect unplugged headphone jack in WinRT?

£可爱£侵袭症+ 提交于 2019-12-05 16:21:49
Is there a way to get notified whenever a headphone jack is unplugged in a WinRT app? I want to be able to pause MediaElement playback when it happens to prevent the sound from leaking out through loudspeakers. Jack detection notification is exposed through IMMNotificationClient::OnDeviceStateChanged. Just tried it on win8 desktop, OnDeviceStateChanged gets called with DEVICE_STATE_UNPLUGGED and DEVICE_STATE_ACTIVE when (un)plugging a device. Sadly that part of wasapi is documented as desktop only so i guess there's no way to do it in WinRT. Try the following: Windows::Devices::Enumeration:

Single Row Horizontally Scrolling/Swipeable GridView

眉间皱痕 提交于 2019-12-05 15:33:16
I wanted a single-row GridView that can be scrolled horizontally both with mouse and touch swipe. The GridView is to present images through binding so that a single image will be selected from an array of images. Everything works fine (binding, image selection, etc.) except that the horizontal scroll doesn't work. The XAML code is shown below. What am I missing? <GridView x:Name="IconGridView" Grid.Row="0" Margin="8,12" DataContext="{x:Bind IconManagerObj}" DoubleTapped="{x:Bind IconGridView_DoubleTapped}" IsItemClickEnabled="True" IsSwipeEnabled="True" ItemsSource="{Binding Path=IconImageInfo

How to Interop with Windows Runtime in .NET 4.5

狂风中的少年 提交于 2019-12-05 15:28:48
I see this namespace: System.Runtime.InteropServices.WindowsRuntime Which provides interop between .NET and WindowsRuntime. For instance, you can invoke a method in WindowsRuntime when you create a Metro application, as Metro uses WindowsRuntime, like Windows.System.UserProfile.UserInformation But when you create a normal .NET console application or WPF application, you can no longer directly reach WindowsRuntime namespaces such as Windows.System I wonder if it were possible to invoke WindowsRuntime methods by using interop in the above-mentioned namespace. A lot of thanks in advance! A .NET

Best Way to Scroll to End of ScrollViewer

此生再无相见时 提交于 2019-12-05 15:04:08
问题 Currently, the only way I have gotten my code to auto scroll to the end when I add a new item is the following: XAML: <ScrollViewer x:Name="chatViewScroller" HorizontalAlignment="Left" Height="201" Margin="0,32,0,0" VerticalAlignment="Top" Width="475" Background="#7FFFFFFF"> <StackPanel x:Name="chatViewContent" /> </ScrollViewer> Code: chatViewContent.Children.Add( new TextBlock() { Text = text, FontSize = 18, TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap, Margin = new Thickness(10, 3, 10,

How do I detect multitouch actions in a Windows 8 metro app?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 15:02:48
I am working on a metro app right now and I'm looking to enable multitouch. I've browsed around google, but I can't seem to find any API to support it. Can someone point me in the right direction to support multitouch actions in a Windows 8 Metro app? What exactly are you trying to do? There are Touch, Pointer (an abstraction around touch/mouse/stylus), and Manipulation events on every UI element In JavaScript you can use the event.pointerId to detected multiple touch inputs. This identifier gives every new input an id. When you want to get multiplie touches for a move with the finger, you can

F# type providers with Portable Library

情到浓时终转凉″ 提交于 2019-12-05 14:42:18
I'm building a Windows 8 application and am finding myself wanting to include a list of ISO-4217 codes, which I have in up-to-date form in XML. Naturally, there are a couple of these codes for all countries. I figured a Type Provider would be an excellent fit. However, since they emit code, I can't use them with Portable Libraries. How do I compile the type provider so that it doesn't use emit, in order to use the XML I've got ? Tomas Petricek I don't have experience with creating a Type Provider that is useable from Portable Libraries, but you seem to be assuming that type providers emit code

Multiple MessageDialog app crash

元气小坏坏 提交于 2019-12-05 12:39:44
I use MessageDialogues at several places over my app. Problem is, whenever is any MessageDialog (or system alert, such as capability warning) active and another my MessageDialog is called, application crashes without exception or with UnathorizedAccessException . This is, how I call MessageDialog: CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { MessageDialog msg2 = new MessageDialog(_resourceLoader.GetString("MsgGPSUnavailable")); msg2.ShowAsync(); }); I thought I should wait for closure of the dialog, but by using Dispatcher I queue this dialog

How to keep the custom Settings Charm flyout open programmatically?

半腔热情 提交于 2019-12-05 12:36:05
I have created a custom AlarmSettingsPane in the settings charm which allows the user to give the time and also choose the audio file for alarm tone. So i implemented the file picker in the settings charm.When i click the file picker button it takes me to a new full screen where i get to pick my files, but when i select a file and open it, am directed to my home screen but the settings charm flyout gets closed. How can i preserve the state of the AlarmSettingsPane flyout and prevent it from closing programmatically? Like the settings flyout should contain the same imfo about the alarm as it

ScrollViewer in Windows 8: always show vertical scrollbar

北慕城南 提交于 2019-12-05 12:33:16
How always show vertical scrollbar in the scrollviewer? It disappear in few seconds, but I want to make scroll visible all the time when scrolling is available Thanks for any help I think there might be a bug in the control in Windows 8 Consumer Preview, since the following should normally work: <ScrollViewer Style="{StaticResource VerticalScrollViewerStyle}" VerticalScrollBarVisibility="Visible" Template="{StaticResource ScrollViewerControlTemplate1}"> As a workaround you can modify the template of the ScrollViewer: <ScrollViewer Style="{StaticResource VerticalScrollViewerStyle}" Template="