Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions WindowsAppRuntime.sln
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,16 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Windows.Media.Capture.Projection", "dev\Projections\CS\Microsoft.Windows.Media.Capture.Projection\Microsoft.Windows.Media.Capture.Projection.csproj", "{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ProjectReunion.InteractiveExperiences.TransportPackage.PackageReference", "eng\PackageReference\ProjectReunion.InteractiveExperiences\Microsoft.ProjectReunion.InteractiveExperiences.TransportPackage.PackageReference.csproj", "{EDD6D3BF-EBD9-4952-A9B7-76171031139B}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BackgroundTaskBuilder", "BackgroundTaskBuilder", "{F425452A-3597-4A7A-BA0A-0C3C76A9F5CD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BackgroundTaskBuilder", "dev\BackgroundTask\BackgroundTaskBuilder\BackgroundTaskBuilder.vcxitems", "{858FA9A9-F822-4B98-84A1-FE44E2C00A5D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowsAppRuntime_UniversalBGTaskDLL", "dev\WindowsAppRuntime_UniversalBGTaskDLL\WindowsAppRuntime_UniversalBGTaskDLL.vcxproj", "{0C4405E6-029E-4363-8273-A9E1FCF057DE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Windows.ApplicationModel.Background.Projection", "dev\Projections\CS\Microsoft.Windows.ApplicationModel.Background.Projection\Microsoft.Windows.ApplicationModel.Background.Projection.csproj", "{CF74972B-1B6F-4421-AC01-F101F7C94DAE}"
ProjectSection(ProjectDependencies) = postProject
{B73AD907-6164-4294-88FB-F3C9C10DA1F1} = {B73AD907-6164-4294-88FB-F3C9C10DA1F1}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -1888,6 +1898,36 @@ Global
{28DCF9CE-D9F4-4A7D-8AD1-F2EFC0D3B4DF}.Release|x64.Build.0 = Release|x64
{28DCF9CE-D9F4-4A7D-8AD1-F2EFC0D3B4DF}.Release|x86.ActiveCfg = Release|Win32
{28DCF9CE-D9F4-4A7D-8AD1-F2EFC0D3B4DF}.Release|x86.Build.0 = Release|Win32
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Debug|Any CPU.ActiveCfg = Debug|x64
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Debug|Any CPU.Build.0 = Debug|x64
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Debug|ARM64.ActiveCfg = Debug|ARM64
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Debug|ARM64.Build.0 = Debug|ARM64
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Debug|x64.ActiveCfg = Debug|x64
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Debug|x64.Build.0 = Debug|x64
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Debug|x86.ActiveCfg = Debug|Win32
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Debug|x86.Build.0 = Debug|Win32
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Release|Any CPU.ActiveCfg = Release|x64
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Release|Any CPU.Build.0 = Release|x64
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Release|ARM64.ActiveCfg = Release|ARM64
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Release|ARM64.Build.0 = Release|ARM64
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Release|x64.ActiveCfg = Release|x64
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Release|x64.Build.0 = Release|x64
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Release|x86.ActiveCfg = Release|Win32
{0C4405E6-029E-4363-8273-A9E1FCF057DE}.Release|x86.Build.0 = Release|Win32
{CF74972B-1B6F-4421-AC01-F101F7C94DAE}.Debug|Any CPU.ActiveCfg = Debug|x64
{CF74972B-1B6F-4421-AC01-F101F7C94DAE}.Debug|ARM64.ActiveCfg = Debug|ARM64
{CF74972B-1B6F-4421-AC01-F101F7C94DAE}.Debug|ARM64.Build.0 = Debug|ARM64
{CF74972B-1B6F-4421-AC01-F101F7C94DAE}.Debug|x64.ActiveCfg = Debug|x64
{CF74972B-1B6F-4421-AC01-F101F7C94DAE}.Debug|x64.Build.0 = Debug|x64
{CF74972B-1B6F-4421-AC01-F101F7C94DAE}.Debug|x86.ActiveCfg = Debug|Win32
{CF74972B-1B6F-4421-AC01-F101F7C94DAE}.Debug|x86.Build.0 = Debug|Win32
{CF74972B-1B6F-4421-AC01-F101F7C94DAE}.Release|Any CPU.ActiveCfg = Release|x64
{CF74972B-1B6F-4421-AC01-F101F7C94DAE}.Release|ARM64.ActiveCfg = Release|ARM64
{CF74972B-1B6F-4421-AC01-F101F7C94DAE}.Release|ARM64.Build.0 = Release|ARM64
{CF74972B-1B6F-4421-AC01-F101F7C94DAE}.Release|x64.ActiveCfg = Release|x64
{CF74972B-1B6F-4421-AC01-F101F7C94DAE}.Release|x64.Build.0 = Release|x64
{CF74972B-1B6F-4421-AC01-F101F7C94DAE}.Release|x86.ActiveCfg = Release|Win32
{CF74972B-1B6F-4421-AC01-F101F7C94DAE}.Release|x86.Build.0 = Release|Win32
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Debug|Any CPU.ActiveCfg = Debug|x64
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Debug|Any CPU.Build.0 = Debug|x64
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Debug|ARM64.ActiveCfg = Debug|arm64
Expand Down Expand Up @@ -2114,6 +2154,10 @@ Global
{7C240089-0F22-4247-9C91-51255C8DC18B} = {6213B1A3-E854-498F-AAFA-4CFC1E71023E}
{AC79B8FF-4C27-4326-AD20-BBC70059FF51} = {7C240089-0F22-4247-9C91-51255C8DC18B}
{28DCF9CE-D9F4-4A7D-8AD1-F2EFC0D3B4DF} = {6759ECC6-9381-4172-89E6-853F81A03D28}
{F425452A-3597-4A7A-BA0A-0C3C76A9F5CD} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A}
{858FA9A9-F822-4B98-84A1-FE44E2C00A5D} = {F425452A-3597-4A7A-BA0A-0C3C76A9F5CD}
{0C4405E6-029E-4363-8273-A9E1FCF057DE} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A}
{CF74972B-1B6F-4421-AC01-F101F7C94DAE} = {716C26A0-E6B0-4981-8412-D14A4D410531}
{1A6F936D-7350-4177-8195-146BDDFACF3B} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A}
{3E7FD510-8B66-40E7-A80B-780CB8972F83} = {1A6F936D-7350-4177-8195-146BDDFACF3B}
{1D24CC70-85B1-4864-B847-3328F40AF01E} = {716C26A0-E6B0-4981-8412-D14A4D410531}
Expand All @@ -2138,6 +2182,7 @@ Global
test\inc\inc.vcxitems*{5b2d17fe-c371-417f-860c-3d32397c2404}*SharedItemsImports = 4
test\inc\inc.vcxitems*{7c502995-59c3-483b-86ba-815985353633}*SharedItemsImports = 4
dev\ApplicationData\ApplicationData.vcxitems*{7cf52890-56fa-47e2-84fb-68ee274324b6}*SharedItemsImports = 9
dev\BackgroundTask\BackgroundTaskBuilder\BackgroundTaskBuilder.vcxitems*{858fa9a9-f822-4b98-84a1-fe44e2c00a5d}*SharedItemsImports = 9
dev\Common\Common.vcxitems*{8828053c-d6ec-4744-8624-f8c676c2d4df}*SharedItemsImports = 9
dev\Licensing\Licensing.vcxitems*{885a43fa-052d-4b0d-a2dc-13ee15796435}*SharedItemsImports = 9
dev\PackageManager\API\PackageManager.vcxitems*{8a9a0c85-65a8-4bca-a49e-45fc4fdbc7d2}*SharedItemsImports = 9
Expand All @@ -2146,6 +2191,7 @@ Global
dev\AppNotifications\AppNotifications.vcxitems*{b4824897-88e0-4927-8fb9-e60106f01ed9}*SharedItemsImports = 9
test\inc\inc.vcxitems*{b567fe2e-3a03-48d0-b2b5-760cdec35891}*SharedItemsImports = 9
dev\ApplicationData\ApplicationData.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
dev\BackgroundTask\BackgroundTaskBuilder\BackgroundTaskBuilder.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
dev\Common\Common.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
dev\DynamicDependency\API\DynamicDependency.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
dev\Licensing\Licensing.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
Expand Down
12 changes: 12 additions & 0 deletions build/CopyFilesToStagingDir.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ PublishFile $OverrideDir\PushNotifications-Override.json $FullPublishDir\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\Microsoft.WindowsAppRuntime.dll $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\Microsoft.WindowsAppRuntime.pdb $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\Microsoft.WindowsAppRuntime.lib $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_UniversalBGTaskDLL\Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.dll $FullPublishDir\Microsoft.Windows.ApplicationModel.Background.UniversalBGTask\
Comment thread
godlytalias marked this conversation as resolved.
PublishFile $FullBuildOutput\WindowsAppRuntime_UniversalBGTaskDLL\Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.pdb $FullPublishDir\Microsoft.Windows.ApplicationModel.Background.UniversalBGTask\
PublishFile $FullBuildOutput\WindowsAppRuntime_UniversalBGTaskDLL\Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.lib $FullPublishDir\Microsoft.Windows.ApplicationModel.Background.UniversalBGTask\
PublishFile $FullBuildOutput\WindowsAppRuntime_UniversalBGTaskDLL\Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.winmd $FullPublishDir\WindowsAppRuntime_UniversalBGTaskDLL\

PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.ApplicationModel.Background.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.ApplicationModel.DynamicDependency.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.ApplicationModel.WindowsAppRuntime.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.AppLifecycle.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
Expand Down Expand Up @@ -104,6 +110,8 @@ PublishFile $FullBuildOutput\DeploymentAgent\DeploymentAgent.pdb $symbolsOutputD
# Copy files to Full Nuget package (alphabetical by category)
#
# C#/WinRT Projections
PublishFile $FullBuildOutput\Microsoft.Windows.ApplicationModel.Background.Projection\Microsoft.Windows.ApplicationModel.Background.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.ApplicationModel.Background.Projection\Microsoft.Windows.ApplicationModel.Background.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.ApplicationModel.DynamicDependency.Projection\Microsoft.Windows.ApplicationModel.DynamicDependency.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.ApplicationModel.DynamicDependency.Projection\Microsoft.Windows.ApplicationModel.DynamicDependency.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.ApplicationModel.WindowsAppRuntime.Projection\Microsoft.Windows.ApplicationModel.WindowsAppRuntime.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
Expand Down Expand Up @@ -182,10 +190,13 @@ PublishFile $FullBuildOutput\DynamicDependencyLifetimeManager.ProxyStub\DynamicD
# Native (not managed, AppLocal / no MSIX)
PublishFile $FullBuildOutput\WindowsAppRuntime_BootstrapDLL\Microsoft.WindowsAppRuntime.Bootstrap.dll $NugetDir\runtimes\win-$Platform\native
PublishFile $FullBuildOutput\WindowsAppRuntime_BootstrapDLL\Microsoft.WindowsAppRuntime.Bootstrap.pdb $NugetDir\runtimes\win-$Platform\native
PublishFile $FullBuildOutput\WindowsAppRuntime_UniversalBGTaskDLL\Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.dll $NugetDir\runtimes\win-$Platform\native
PublishFile $FullBuildOutput\WindowsAppRuntime_UniversalBGTaskDLL\Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.pdb $NugetDir\runtimes\win-$Platform\native
#
# WinMD for UWP apps
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.ApplicationModel.DynamicDependency.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.ApplicationModel.WindowsAppRuntime.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.ApplicationModel.Background.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.AppLifecycle.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.AppNotifications.Builder.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.AppNotifications.winmd $NugetDir\lib\uap10.0
Expand All @@ -197,6 +208,7 @@ PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Secur
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Storage.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.System.Power.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.System.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_UniversalBGTaskDLL\Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.winmd $NugetDir\lib\uap10.0
#
# Bootstrap Auto-Initializer Files
PublishFile $FullBuildOutput\WindowsAppRuntime_BootstrapDLL\MddBootstrapAutoInitializer.cpp $NugetDir\include
Expand Down
9 changes: 9 additions & 0 deletions build/NuSpecs/AppxManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,20 @@
<ActivatableClass ActivatableClassId="Microsoft.Windows.Globalization.ApplicationLanguages" ThreadingModel="both" />
</InProcessServer>
</Extension>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.dll</Path>
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.Task" ThreadingModel="both" />
</InProcessServer>
</Extension>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>Microsoft.WindowsAppRuntime.dll</Path>
<!-- NOTE: Keep ActivationClass elements sorted by absolute ActivatableClassId (namespace.class) -->

<!-- Background Task -->
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.Background.BackgroundTaskBuilder" ThreadingModel="both" />

<!-- OAuth -->
<ActivatableClass ActivatableClassId="Microsoft.Security.Authentication.OAuth.OAuth2Manager" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Security.Authentication.OAuth.AuthRequestParams" ThreadingModel="both" />
Expand Down
10 changes: 10 additions & 0 deletions build/NuSpecs/WindowsAppSDK-Nuget-Native.WinRt.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
<Implementation Condition="'$(WindowsAppSDKFrameworkPackage)' != 'true'">$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.WindowsAppRuntime.dll</Implementation>
<IsWinMDFile>true</IsWinMDFile>
</Reference>
<Reference Include="Microsoft.Windows.ApplicationModel.Background.winmd">
<HintPath>$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.ApplicationModel.Background.winmd</HintPath>
<Implementation Condition="'$(WindowsAppSDKFrameworkPackage)' != 'true'">$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.WindowsAppRuntime.dll</Implementation>
<IsWinMDFile>true</IsWinMDFile>
</Reference>
<Reference Include="Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.winmd">
<HintPath>$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.winmd</HintPath>
<Implementation Condition="'$(WindowsAppSDKBackgroundTask)' == 'true'">$(MSBuildThisFileDirectory)..\..\runtimes\win-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.Windows.ApplicationModel.UniversalBGTask.dll</Implementation>
<IsWinMDFile>true</IsWinMDFile>
</Reference>
<Reference Include="Microsoft.Windows.AppLifecycle.winmd">
<HintPath>$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.AppLifecycle.winmd</HintPath>
<Implementation Condition="'$(WindowsAppSDKFrameworkPackage)' != 'true'">$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.WindowsAppRuntime.dll</Implementation>
Expand Down
15 changes: 15 additions & 0 deletions build/NuSpecs/WindowsAppSDK-Nuget-Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@
</Reference>
</ItemGroup>

<ItemGroup>
<Reference Include="$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.ApplicationModel.Background.winmd">
<Private>false</Private>
<Implementation>Microsoft.WindowsAppRuntime.dll</Implementation>
</Reference>
</ItemGroup>

<ItemGroup>
<Reference Include="$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.winmd">
<Private Condition="'$(WindowsAppSDKBackgroundTask)' == 'true'">true</Private>
<Private Condition="'$(WindowsAppSDKBackgroundTask)' != 'true'">false</Private>
<Implementation Condition="'$(WindowsAppSDKBackgroundTask)' == 'true'">$(MSBuildThisFileDirectory)..\..\runtimes\win-$(Platform)\native\Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.dll</Implementation>
</Reference>
</ItemGroup>

<ItemGroup>
<Reference Include="$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.AppLifecycle.winmd">
<Private>false</Private>
Expand Down
58 changes: 58 additions & 0 deletions dev/BackgroundTask/BackgroundTaskBuilder/BackgroundTaskBuilder.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#include "pch.h"
#include "BackgroundTaskBuilder.h"
#include "Microsoft.Windows.ApplicationModel.Background.BackgroundTaskBuilder.g.cpp"
#include <winrt/Windows.ApplicationModel.Activation.h>

namespace winrt
{
using namespace winrt::Windows::ApplicationModel::Background;
using namespace Windows::Storage;
}

namespace winrt::Microsoft::Windows::ApplicationModel::Background::implementation
{
void BackgroundTaskBuilder::SetTaskEntryPointClsid(winrt::guid clsId)
{
m_taskEntryPointClsid = clsId;
}

void BackgroundTaskBuilder::Name(winrt::hstring name)
{
m_name = name;
}

void BackgroundTaskBuilder::SetTrigger(winrt::IBackgroundTrigger trigger)
{
m_builder.SetTrigger(trigger);
}

void BackgroundTaskBuilder::AddCondition(winrt::IBackgroundCondition condition)
{
m_builder.AddCondition(condition);
}

winrt::BackgroundTaskRegistration BackgroundTaskBuilder::Register()
{
m_builder.Name(m_name);
m_builder.TaskEntryPoint(L"Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.Task");
winrt::BackgroundTaskRegistration taskRegistration = m_builder.Register();

winrt::ApplicationDataContainer localSettings = winrt::ApplicationData::Current().LocalSettings();
Comment thread
godlytalias marked this conversation as resolved.
auto values = localSettings.Values();
winrt::hstring lookupId = winrt::to_hstring(taskRegistration.TaskId());
IInspectable obj = winrt::box_value(m_taskEntryPointClsid);
values.Insert(lookupId, obj);

return taskRegistration;
}

winrt::BackgroundTaskRegistration BackgroundTaskBuilder::Register(winrt::hstring taskName)
{
Name(taskName);
return Register();
}

}
42 changes: 42 additions & 0 deletions dev/BackgroundTask/BackgroundTaskBuilder/BackgroundTaskBuilder.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#pragma once
#include <winrt/Windows.ApplicationModel.Background.h>
#include "Microsoft.Windows.ApplicationModel.Background.BackgroundTaskBuilder.g.h"

namespace winrt::Microsoft::Windows::ApplicationModel::Background::implementation
{
struct BackgroundTaskBuilder : BackgroundTaskBuilderT<BackgroundTaskBuilder>
{
BackgroundTaskBuilder() = default;
void SetTaskEntryPointClsid(winrt::guid clsId);

void SetTrigger(
winrt::Windows::ApplicationModel::Background::IBackgroundTrigger trigger
);

void AddCondition(
winrt::Windows::ApplicationModel::Background::IBackgroundCondition trigger
);


void Name(winrt::hstring Name);
winrt::hstring Name() { return m_name; }

winrt::Windows::ApplicationModel::Background::BackgroundTaskRegistration Register();
winrt::Windows::ApplicationModel::Background::BackgroundTaskRegistration Register(winrt::hstring taskName);

private:
winrt::guid m_taskEntryPointClsid;
winrt::Windows::ApplicationModel::Background::BackgroundTaskBuilder m_builder;
winrt::hstring m_name;
};
}

namespace winrt::Microsoft::Windows::ApplicationModel::Background::factory_implementation
{
struct BackgroundTaskBuilder : BackgroundTaskBuilderT<BackgroundTaskBuilder, implementation::BackgroundTaskBuilder>
{
};
}
Loading