Search code examples
c#xamluwplauncher

How to detect if a desktop app is installed from a UWP app


I'm basically asking the same question as this person on MSDN: How to detect if application is installed on the device

However, I am new to Development and the answer was pointed back to Docs.microsoft.com which I was glad, but I guess I got lost in how to pull it off.

I'm assuming this code needs to reside on App.xaml.cs, and that it actually sets a property that I can use to turn on or off the visibility of my View's button.

public static IAsyncOperation<LaunchQuerySupportStatus> 
    QueryUriSupportAsync(Windows.Foundation.Uri,Windows.System.LaunchQuerySupportType,System.String)

What I want to do, is Mark the visibility of one of my Views within the app, to NOT be shown if Microsoft Dyanmics AX is installed.

Here is Code in XAML for button.

<Controls:HamburgerButtonInfo ClearHistory="True" PageType="views:DevicePage">
<StackPanel Orientation="Horizontal">
    <SymbolIcon Width="48"
                Height="48"
                Symbol="Keyboard" />
    <TextBlock Margin="12,0,0,0"
               VerticalAlignment="Center"
               Text="Manage Device" />
</StackPanel>

BTW, I'm using Template10 as a framework. So i'm assuming that since all of my Views are displayed within the Shell.xaml I would put a Condition on the above button as Visibility=Visible.


Solution

  • The short answer to the question as articulated is: no, a UWP cannot detect what Win32 apps are installed on the system.

    Slightly longer answer: if what you really want to know is whether an app is installed that supports a specific protocol or supports a specific file type, you can find that out using QueryUriSupportAsync or QueryFileSupportAsync. These APIs also consider installed Win32 apps.

    Thanks, Stefan Wick - Windows Developer Platform