Added App Installer activation sample

This commit is contained in:
Matteo Pagani 2020-09-14 17:47:24 +02:00
Родитель 987f2bc82a
Коммит e6fc99f930
16 изменённых файлов: 332 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '15.0'">
<VisualStudioVersion>15.0</VisualStudioVersion>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x86">
<Configuration>Debug</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x86">
<Configuration>Release</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|AnyCPU">
<Configuration>Debug</Configuration>
<Platform>AnyCPU</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|AnyCPU">
<Configuration>Release</Configuration>
<Platform>AnyCPU</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup>
<WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
</PropertyGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
<PropertyGroup>
<ProjectGuid>66e4cf9d-6dca-4e9e-9aa1-6cd4da96ae29</ProjectGuid>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<DefaultLanguage>en-US</DefaultLanguage>
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
<EntryPointProjectUniqueName>..\ContosoExpenses\ContosoExpenses.csproj</EntryPointProjectUniqueName>
</PropertyGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="Images\SplashScreen.scale-200.png" />
<Content Include="Images\LockScreenLogo.scale-200.png" />
<Content Include="Images\Square150x150Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Images\StoreLogo.png" />
<Content Include="Images\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ContosoExpenses\ContosoExpenses.csproj">
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
</ProjectReference>
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
</Project>

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.5 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.9 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.1 KiB

Просмотреть файл

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">
<Identity
Name="ContosoExpenses"
Publisher="CN=mpagani"
Version="1.0.0.0" />
<Properties>
<DisplayName>Contoso Expenses</DisplayName>
<PublisherDisplayName>Matteo Pagani</PublisherDisplayName>
<Logo>Images\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="Contoso Expenses"
Description="v"
BackgroundColor="transparent"
Square150x150Logo="Images\Square150x150Logo.png"
Square44x44Logo="Images\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" />
<uap:SplashScreen Image="Images\SplashScreen.png" />
</uap:VisualElements>
<Extensions>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="contoso-expenses"/>
</uap:Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>

Просмотреть файл

@ -0,0 +1,81 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30503.244
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ContosoExpenses", "ContosoExpenses\ContosoExpenses.csproj", "{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}"
EndProject
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "ContosoExpenses.Package", "ContosoExpenses.Package\ContosoExpenses.Package.wapproj", "{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Debug|ARM.ActiveCfg = Debug|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Debug|ARM.Build.0 = Debug|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Debug|ARM64.Build.0 = Debug|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Debug|x64.ActiveCfg = Debug|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Debug|x64.Build.0 = Debug|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Debug|x86.ActiveCfg = Debug|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Debug|x86.Build.0 = Debug|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Release|Any CPU.Build.0 = Release|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Release|ARM.ActiveCfg = Release|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Release|ARM.Build.0 = Release|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Release|ARM64.ActiveCfg = Release|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Release|ARM64.Build.0 = Release|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Release|x64.ActiveCfg = Release|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Release|x64.Build.0 = Release|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Release|x86.ActiveCfg = Release|Any CPU
{F9AD9ADF-4A38-453F-8D96-D96FAF93D0A4}.Release|x86.Build.0 = Release|Any CPU
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Debug|ARM.ActiveCfg = Debug|ARM
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Debug|ARM.Build.0 = Debug|ARM
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Debug|ARM.Deploy.0 = Debug|ARM
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Debug|ARM64.ActiveCfg = Debug|ARM64
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Debug|ARM64.Build.0 = Debug|ARM64
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Debug|ARM64.Deploy.0 = Debug|ARM64
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Debug|x64.ActiveCfg = Debug|x64
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Debug|x64.Build.0 = Debug|x64
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Debug|x64.Deploy.0 = Debug|x64
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Debug|x86.ActiveCfg = Debug|x86
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Debug|x86.Build.0 = Debug|x86
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Debug|x86.Deploy.0 = Debug|x86
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Release|Any CPU.Build.0 = Release|Any CPU
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Release|Any CPU.Deploy.0 = Release|Any CPU
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Release|ARM.ActiveCfg = Release|ARM
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Release|ARM.Build.0 = Release|ARM
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Release|ARM.Deploy.0 = Release|ARM
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Release|ARM64.ActiveCfg = Release|ARM64
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Release|ARM64.Build.0 = Release|ARM64
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Release|ARM64.Deploy.0 = Release|ARM64
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Release|x64.ActiveCfg = Release|x64
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Release|x64.Build.0 = Release|x64
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Release|x64.Deploy.0 = Release|x64
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Release|x86.ActiveCfg = Release|x86
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Release|x86.Build.0 = Release|x86
{66E4CF9D-6DCA-4E9E-9AA1-6CD4DA96AE29}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {15819761-17A7-4779-B81B-A9F04E4B35A8}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,9 @@
<Application x:Class="ContosoExpenses.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ContosoExpenses"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Windows;
namespace ContosoExpenses
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public static string Arguments { get; set; }
protected override void OnStartup(StartupEventArgs e)
{
string path = $"{Environment.GetFolderPath(Environment.SpecialFolder.Desktop)}//AppInstaller.txt";
if (e.Args.Length > 0)
{
UriBuilder builder = new UriBuilder(e.Args[0]);
var result = HttpUtility.ParseQueryString(builder.Query);
var value = result["source"];
Arguments = $"Source: {value}";
System.IO.File.WriteAllText(path, $"Source: {value}");
}
else
{
Arguments = "No arguments available";
System.IO.File.WriteAllText(path, "No arguments available");
}
}
}
}

Просмотреть файл

@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

Просмотреть файл

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>

Просмотреть файл

@ -0,0 +1,14 @@
<Window x:Class="ContosoExpenses.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ContosoExpenses"
mc:Ignorable="d"
Loaded="Window_Loaded"
Title="MainWindow" Height="450" Width="800">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="Welcome to the Contoso Expenses application!" FontSize="24" FontWeight="Bold" />
<TextBlock x:Name="txtActivationArguments" HorizontalAlignment="Center" FontSize="18" />
</StackPanel>
</Window>

Просмотреть файл

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace ContosoExpenses
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
txtActivationArguments.Text = App.Arguments;
}
}
}