EzDevInfo.com

windows-runtime interview questions

Top windows-runtime frequently asked interview questions

Why is WinRT unmanaged? [closed]

Windows 8 introduces WinRT, which is like .NET but unmanaged. Why is it unmanaged? Is it a performance issue? Does it mean garbage collection is not suitable for lower level APIs?


Source: (StackOverflow)

How to install a Windows 8 App Without Submitting to Store [closed]

For a customer I need a to present our Windows 8 Metro App. When I deploy my solution or project, I get a exe but I can't install it. I get a MessageError, that I can only start the exe in a app container.

How can I create a version of my application to give it to my customer without loading it up to the Microsoft Store?


Source: (StackOverflow)

Advertisements

WinRT and WPF in Windows 8

As I understand, WinRT is a different version of WPF written without using the underlying Win32 APIs.

What's the relation of WinRT and WPF? Will WPF work under Metro in Windows 7 or will it launch the classic desktop?

That's not so clear from the Keynote. If someone has Windows 8 installed can confirm it's behaviour.

Thanks


Source: (StackOverflow)

Using WinRT from C?

Watching the //BUILD stuff, I saw that WinRT API's can be consumed by C code:

enter image description here

I am rather excited about a fresh C API available to Win32 developers.

Where can I find information on the C WinRT API? How is it better than the existing Win32 C API?


Source: (StackOverflow)

How to check if file exists in a Windows Store App?

Is there any other way of checking whether a file exists in a Windows Store app?

try
{
    var file = await ApplicationData.Current.LocalFolder.GetFileAsync("Test.xml");
    //no exception means file exists
}
catch (FileNotFoundException ex)
{ 
    //find out through exception 
}

Source: (StackOverflow)

How does Windows 8 Runtime (WinRT / windows store apps / Windows 10 Universal App) compare to Silverlight and WPF? [closed]

I am trying to get my head round the new Windows 8 Runtime that is used to create Metro style apps. I know you can use it with XAML and it is based on .NET so C# and VB.NET can be used to write the apps, but then it seems to have something to do with HTML, CSS, DOM, and JavaScript.

Can someone explain what it is in a few paragraphs, in terms that a .NET UI programmer can understand? (I am missing something “key” that is necessary to understand it)


We all know that WPF and Silverlight and Winforms, etc will keep working under windows 8 (and windows 10) on at least on Intel system, so please don't tell me that...


Source: (StackOverflow)

How can a Metro app in Windows 8 communicate with a backend desktop app on the same machine?

In a situation where you have the UI frontend built using the new Metro style of apps for windows 8, and would like it to communicate with a .NET application running on the desktop on the same local machine (e.g. a windows service app).

What forms of interprocess communication are available between the metro app and the desktop app?

Thanks to Pavel Minaev of the Visual Studio team, who has provided some initial info here in a comment, quoted:

According to Martyn Lovell, there isn't any deliberate mechanism for that, and some that could be used for it are intentionally restricted. Named pipes aren't there, for example, nor are memory mapped files. There are sockets (including server sockets), but when connecting to localhost, you can only connect to the same app. You could use normal files in one of the shared "known folders" (Documents, Pictures etc), but that is a fairly crude hack that necessitates polling and is visible to the user. -- Pavel Minaev commenting on this issue

So failing normal approaches I was thinking of using web services or reading/writing to a database in order to get some form of communication happening, both of which seem like overkill when the processes are running on the same machine.

Is what I'm attempting here making sense? I can see a need for a metro app to be the frontend UI for an existing service which is running on the desktop. Or is it better to just use WPF for the frontend UI running on the desktop (i.e. a non-metro app).


Source: (StackOverflow)

Run code on UI thread in WinRT

I want to know how I can run code on the UI thread in WinRT (Windows 8 Metro). The Invoke method does not exist.


Source: (StackOverflow)

Correct way to get the CoreDispatcher in a Windows Store app

I'm building a Windows Store app, and I have some code that needs to be posted to the UI thread.

For that, i'd like to retrieve the CoreDispatcher and use it to post the code.

It seems that there are a few ways to do so:

// First way
Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().CoreWindow.Dispatcher;

// Second way
Window.Current.Dispatcher;

I wonder which one is correct? or if both are equivalent?


Source: (StackOverflow)

Creating Windows Metro style apps with Java?

I know how to create small desktop applications in Java. I want to know, can I make Windows Metro style apps in Java? Because on the web only C++/C/C#/JavaScript etc. are mentioned. If yes can you please give me some reference for a quick start. If not which one will be easiest language to start?


Source: (StackOverflow)

Do Windows 8 Store Apps (Metro) run in Windows 7 or XP?

I want to know whether Metro Applications developed using Visual Studio 11 Developer Preview and .Net FrameWork 4.5 can run in Windows 7 or XP.

Not the normal Windows Form or WPF, I want to know about the all new Metro Apps.

What new things needed to run Metro Apps in Windows XP or Windows 7


Source: (StackOverflow)

Setting Authorization Header of HttpClient

I have a HttpClient that I am using to use a REST API. However I am having trouble setting up the Authorization header. I need to set the header to the token I received from doing my OAuth request. I saw some code for .NET that suggests the following,

httpClient.DefaultRequestHeaders.Authorization = new Credential(OAuth.token);

However the Credential class does that not exist in WinRT. Anyone have any ideas how to set the Authorization header?


Source: (StackOverflow)

The given System.Uri cannot be converted into a Windows.Foundation.Uri

I'm trying to programmatically load a BitmapImage in a XAML Metro app. Here's my code:

var uri = new Uri("/Images/800x600/BackgroundTile.bmp", UriKind.RelativeOrAbsolute);
var imageSource = new BitmapImage(uri);

The second line crashes with a System.ArgumentException:

The given System.Uri cannot be converted into a Windows.Foundation.Uri. Please see http://go.microsoft.com/fwlink/?LinkID=215849 for details.

The link just goes to the MSDN home page, so it's no use.

I've also tried removing the leading /, in case WinRT has different expectations about relative URIs, but I still get the same exception.

Why am I getting this exception for what seems to be a perfectly valid URI?


Source: (StackOverflow)

How to launch my app via NFC tag?

I'm currently working on porting an app to UWP. The app has a page with a "Write to NFC" button. After the user taps it, it waits for an NFC tag and writes a LaunchApp:WriteTag binary message.

What worked fine under WP8.1, doesn't work at all under Windows 10 UWP:

var proximityDevice = Windows.Networking.Proximity.ProximityDevice.GetDefault();

if (proximityDevice != null)
{
    var launchArgs = "user=default";

    var appId = "App";
    var appName = Windows.ApplicationModel.Package.Current.Id.FamilyName + "!" + appId;

    var launchAppMessage = launchArgs + "\tWindows\t" + appName;

    var dataWriter = new Windows.Storage.Streams.DataWriter();
    dataWriter.UnicodeEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf16LE;
    dataWriter.WriteString(launchAppMessage);
    var launchAppPubId = proximityDevice.PublishBinaryMessage("LaunchApp:WriteTag", dataWriter.DetachBuffer());
}

Unfortunately this doesn't work. The NFC capability is enabled and the WP8.1 app works on the same phone, so this shouldn't be an issue.

I already tried multiple formats as the problem seems to be the launchAppMessage, where I didn't find a UWP doc for. There's a Windows 8+ MSDN article, which describes the string to be in the format:

myArgs\tWindows\tAppFamilyName!App

What I tried:

  1. myArgs is short enough - shouldn't be a problem.
  2. Windows or WindowsPhone doesn't make any difference. Both don't work.
  3. AppFamilyName is the correct app family name that's inside my app manifest. The app is associated to the store and it looks like this shouldn't be the problem as well.
  4. App is what's inside <Application id="App" ... /> in my app manifest. Trying MyAppNamespace.App didn't work as well and calling CurrentApp.AppId (what's used in WinRT apps) throws an exception.

By "not working" I mean that it writes to the tag, but the tag is not recognized by Windows 10 at all.

One more thing I found, is that for myArgs\tWindows\tAppFamilyName!App the app throws the following exception - without any further details:

System.ExecutionEngineException was unhandled
Message: An unhandled exception of type 'System.ExecutionEngineException' occurred in Unknown Module.

I really hope someone has an idea on how to solve this. Unfortunately there are no UWP samples for this yet and the docs are still the old ones... :/

PS: using a custom protocol together with WindowsUri:WriteTag works fine but I want only my app to open with the NFC tag. Also, the confirmation dialog then looks like "Do you want to open the app associated with mycustomprotocol?" - which looks not very user friendly. So that's no real solution for me, more a workaround I don't want to use.


Source: (StackOverflow)

How I can make use of Microsoft Rx Framework to implement Bing Map effectively in WinRT / Windows 8

In my e-commerce application I need to plot my nearby stores in Bing map, And my another requirement is during the time of zooming and paning the map I need to update my stores based on the map centre. So for implementing this I primarily choose the traditional way of coding. The steps are given below.

  1. Initial launch I will send the api request for location and will plot the stores on Map.

  2. In Maps ViewChanged event I will send the subsequent requests for the nearby stores based on the maps current store. So during this implementation, I am getting around 400 stores in single api request. And I will plot this on map. But when I zoom or pan the map it sends several requests simultaneously and try to update the pushpins on UI , eventually it will block the UI and Map behaves horribly in my app.

During the Google search I found many suggestions regarding using Microsoft Rx framework to implement similar functionality. But didn’t get any proper code samples to achieve my goal. Can anyone please help me or guide me to solve my issue. Remember I need to plot on an average of 400 stores in map on a single request.

Regards,

Stez.


Source: (StackOverflow)