windows-runtime

WinRT Projected types documentation

瘦欲@ 提交于 2020-01-14 09:04:16
问题 There is something called projected types in WinRT. For example, in metadata, the IXamlType.UnderlyingType is defined as: TypeName UnderlyingType { get; } However when used in a C# app, it changes as follows: Type UnderlyingType { get; } My question is - is there any documentation regarding the rules, API, attributes used for such mappings? 回答1: That's correct, the language projection built into the CLR maps WinRT types to CLR types automatically. Documentation is hard to come by, especially

WinRT Projected types documentation

让人想犯罪 __ 提交于 2020-01-14 09:03:08
问题 There is something called projected types in WinRT. For example, in metadata, the IXamlType.UnderlyingType is defined as: TypeName UnderlyingType { get; } However when used in a C# app, it changes as follows: Type UnderlyingType { get; } My question is - is there any documentation regarding the rules, API, attributes used for such mappings? 回答1: That's correct, the language projection built into the CLR maps WinRT types to CLR types automatically. Documentation is hard to come by, especially

Delphi - Making asynchronous calls to WinRT API using TTask.Future

丶灬走出姿态 提交于 2020-01-14 04:23:10
问题 Related to this question, I am trying to implement a procedure that uses the WinRT API to set the desktop wallpaper. To mimic the await functionality in C#, I am using TTask.Future (link) as outlined here and here. My implementation looks like this: class procedure TUtilityWin.SetWallpaper(AFileName: String); var lStorageFile: IStorageFile; liao_storagefile: IAsyncOperation_1__IStorageFile; lFutureTask: IFuture<IAsyncOperation_1__IStorageFile>; begin //WinRT Implementation if TUserProfile

How to use midlrt.exe to compile .idl to .winmd?

爷,独闯天下 提交于 2020-01-14 04:12:26
问题 Background: I need to build a Windows Runtime Component as part of a system that's set up to use CMake to generate its build system. As a preparatory step I'm trying to build it on the command line. Starting with a bare-bones .idl file (MyType.idl) namespace NS { [default_interface] runtimeclass MyType { } } I'm trying to generate a matching .winmd file using the midlrt.exe tool. The following command line (split across several lines for readability) midlrt /metadata_dir "%WindowsSdkDir

The App hangs on a device while debugging async method

依然范特西╮ 提交于 2020-01-14 02:50:07
问题 I'm following the guide at MSDN about downloading the file. So I have made a very simple download: private async void performDownload_Click(object sender, RoutedEventArgs e) { CancellationTokenSource myCts = new CancellationTokenSource(); ulong bytesReceived = await DownloadWebFile("myFile.jpg", myCts.Token); var forBreakpoint = 5; // set breakpoint here - isn't being hit on a device // some further code } public async Task<ulong> DownloadWebFile(string fileName, CancellationToken ct) { Uri

WinRT Extract frames from video stream

 ̄綄美尐妖づ 提交于 2020-01-13 18:33:31
问题 I'm decoding barcodes using the built in camera, I do this with the capElement.Source.CapturePhotoToStreamAsync to capture photos from the preview. it works, but freezes the app for a brief moment, which feels very clumsy and buggy. So I'd like to this in background while at least leaving a responsive UI while processing the photos. So far I came up with this to capture the video stream: private async void ScanInBackground() { bool failedScan = true; var stream = new

How to P/Invoke to a native dll from Metro?

别来无恙 提交于 2020-01-13 09:36:26
问题 I've got a library consisting of two parts - One .net assembly that P/Invokes to a native 3rd party dll. In desktop mode this works just fine: However, when referencing the assembly from a Metro style app and running it, it throws a System.DllNotFoundException on the P/Invoke complaining that "Unable to load DLL 'library': The specified module could not be found." The native dll does not do anything special but only creates out-going TCP/IP connections to a server. The system cannot know this

Unable to access localized resources in .NET 4.5 PCL from Windows Phone 8.1

你。 提交于 2020-01-13 04:47:07
问题 I have troubles accessing localized string resources in Portable Class Library targeting .NET 4.5. I am allowing the user to select the language on first page and have localized experience on further pages. I am trying to achieve that just by getting resource with code MyTextBloxk.Text = PasswordResetMethod_Page.Title; PasswordResetMethod_Page is the auto-generated class from the .resx Everything works fine on the WP 8.1 emulator, but when I try to deploy it to the real device I get Error :

How to print Formatted Page which contain ListBox or GridView

别等时光非礼了梦想. 提交于 2020-01-13 03:44:25
问题 Printing Document using WinRT : 1) To Keep tracking if there are more data Or text data to print in a formatted page. This can be done using RichTextBlock and RichTextBlockOverflow like below: <RichTextBlock Foreground="Black" x:Name="textContent" FontSize="18" Grid.Row="1" Grid.ColumnSpan="2" OverflowContentTarget="{Binding ElementName=firstLinkedContainer}" IsTextSelectionEnabled="True" TextAlignment="Left" FontFamily="Segoe UI" VerticalAlignment="Top" HorizontalAlignment="Left"> <

ObservationCollection that implements ISupportIncrementalLoading within ViewModel inside PCL using MVVM architecture for WinRT & WP8/WinPRT support

邮差的信 提交于 2020-01-12 03:39:08
问题 I have my ViewModels inside a PCL, because I'm developing a Windows 8.1 and Windows Phone app in parallel. I have a list of things inside my ViewModel as an ObservableCollection. I have a GridView inside a Page inside a Windows 8.1 project. I wish to incrementally load items from my list of things in my ViewModel. Normally I would implement ISupportIncrementalLoading inside a custom subclass of ObservableCollection, however, given that my ViewModel is inside a PCL, ISupportIncrementalLoading