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
27 changes: 11 additions & 16 deletions ProjectReunion.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dev", "dev", "{448ED2E5-0B37-4D97-9E6B-8C10A507976A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SampleWinRT", "SampleWinRT", "{428CCA9E-ADC5-4917-B51B-7D13E35950C5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{F3659DFF-232D-46E0-967E-61FCC9A1132F}"
ProjectSection(SolutionItems) = preProject
docs\contributor-guide.md = docs\contributor-guide.md
Expand All @@ -15,12 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{F3659DFF-2
docs\roadmap.md = docs\roadmap.md
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleWinRT", "dev\SampleWinRT\SampleWinRT.vcxitems", "{0DE4FEFE-5471-4B50-B74B-D817A02B7F0D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SampleFlatC", "SampleFlatC", "{8A5C2FE6-86D7-4AAA-BE2E-924B8E03B888}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleFlatC", "dev\SampleFlatC\SampleFlatC.vcxitems", "{CDCE22EC-F7BF-43D4-95D8-2E786229A4E5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8630F7AA-2969-4DC9-8700-9B468C1DC21D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppShared", "test\CppShared\CppShared.vcxitems", "{682DED8C-3A27-48CD-866D-E853EA2024DE}"
Expand All @@ -31,15 +23,19 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppTest_Win32", "test\CppTe
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppTest_UWP", "test\CppTest_UWP\CppTest_UWP.vcxproj", "{B1A6F5EC-5418-4354-BACF-F7D998EE960D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AppLifecycle", "AppLifecycle", "{3DE93B2F-F887-437D-B512-6B1024ABA290}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AppLifecycle", "dev\AppLifecycle\AppLifecycle.vcxitems", "{E3A522A3-6635-4A42-BDED-1AF46A15F63C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AppLifecycle", "test\AppLifecycle\AppLifecycle.vcxitems", "{80E07022-9E99-44FE-B875-901FB6C82F52}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
dev\SampleWinRT\SampleWinRT.vcxitems*{0de4fefe-5471-4b50-b74b-d817a02b7f0d}*SharedItemsImports = 9
test\CppShared\CppShared.vcxitems*{682ded8c-3a27-48cd-866d-e853ea2024de}*SharedItemsImports = 9
test\AppLifecycle\AppLifecycle.vcxitems*{80e07022-9e99-44fe-b875-901fb6c82f52}*SharedItemsImports = 9
test\CppShared\CppShared.vcxitems*{b1a6f5ec-5418-4354-bacf-f7d998ee960d}*SharedItemsImports = 4
dev\SampleFlatC\SampleFlatC.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
dev\SampleWinRT\SampleWinRT.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
test\CppShared\CppShared.vcxitems*{c62688a1-16a0-4729-b6ed-842f4faa29f3}*SharedItemsImports = 4
dev\SampleFlatC\SampleFlatC.vcxitems*{cdce22ec-f7bf-43d4-95d8-2e786229a4e5}*SharedItemsImports = 9
dev\AppLifecycle\AppLifecycle.vcxitems*{e3a522a3-6635-4a42-bded-1af46a15f63c}*SharedItemsImports = 9
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug_test|Any CPU = Debug_test|Any CPU
Expand Down Expand Up @@ -157,14 +153,13 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{428CCA9E-ADC5-4917-B51B-7D13E35950C5} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A}
{0DE4FEFE-5471-4B50-B74B-D817A02B7F0D} = {428CCA9E-ADC5-4917-B51B-7D13E35950C5}
{8A5C2FE6-86D7-4AAA-BE2E-924B8E03B888} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A}
{CDCE22EC-F7BF-43D4-95D8-2E786229A4E5} = {8A5C2FE6-86D7-4AAA-BE2E-924B8E03B888}
{682DED8C-3A27-48CD-866D-E853EA2024DE} = {8630F7AA-2969-4DC9-8700-9B468C1DC21D}
{B73AD907-6164-4294-88FB-F3C9C10DA1F1} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A}
{C62688A1-16A0-4729-B6ED-842F4FAA29F3} = {8630F7AA-2969-4DC9-8700-9B468C1DC21D}
{B1A6F5EC-5418-4354-BACF-F7D998EE960D} = {8630F7AA-2969-4DC9-8700-9B468C1DC21D}
{3DE93B2F-F887-437D-B512-6B1024ABA290} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A}
{E3A522A3-6635-4A42-BDED-1AF46A15F63C} = {3DE93B2F-F887-437D-B512-6B1024ABA290}
{80E07022-9E99-44FE-B875-901FB6C82F52} = {8630F7AA-2969-4DC9-8700-9B468C1DC21D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4B3D7591-CFEC-4762-9A07-ABE99938FB77}
Expand Down
1 change: 0 additions & 1 deletion build/CopyFilesToStagingDir.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ function PublishFile {

PublishFile -IfExists $FullBuildOutput\projectreunion_dll\Microsoft.ProjectReunion.dll $FullPublishDir\Microsoft.ProjectReunion\
PublishFile -IfExists $FullBuildOutput\projectreunion_dll\Microsoft.ProjectReunion.lib $FullPublishDir\Microsoft.ProjectReunion\
PublishFile -IfExists $FullBuildOutput\projectreunion_dll\SampleFlatC.h $FullPublishDir\Microsoft.ProjectReunion\
#PublishFile -IfExists $FullBuildOutput\projectreunion_dll\Microsoft.ProjectReunion.pri $FullPublishDir\Microsoft.ProjectReunion\
#UNDONE - xaml vcxproj re-runs an mdmerge into the sdk node, we are skipping this for now and leaving the winmd in its normal outdir
#PublishFile -IfExists $FullBuildOutput\projectreunion_dll\sdk\Microsoft.ProjectReunion.winmd $FullPublishDir\Microsoft.ProjectReunion\sdk\
Expand Down
1 change: 0 additions & 1 deletion build/NuSpecs/ProjectReunionFrameworkPackage.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<file target="lib\uap10.0" src="Intellisense\Microsoft.ProjectReunion.xml"/>
<!-- C++ projects need the flat C header declarations and implib -->
<file target="lib\native" src="$BUILDOUTPUT$\$BUILDFLAVOR$\$BUILDARCH$\Microsoft.ProjectReunion\Microsoft.ProjectReunion.lib" />
<file target="include" src="$BUILDOUTPUT$\$BUILDFLAVOR$\$BUILDARCH$\Microsoft.ProjectReunion\SampleFlatC.h" />

<!-- <file target="tools" src="$TOOLSDIR$\**\*.*"/> -->

Expand Down
37 changes: 37 additions & 0 deletions dev/AppLifecycle/ActivatedEventArgsBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#pragma once

namespace winrt::Microsoft::ProjectReunion::implementation
{
using namespace winrt::Windows::ApplicationModel::Activation;

class ActivatedEventArgsBase : public winrt::implements<ActivatedEventArgsBase,
IActivatedEventArgs>
{
public:
// IActivatedEventArgs
ActivationKind Kind()
{
return m_kind;
}

ApplicationExecutionState PreviousExecutionState()
{
return m_previousState;
}

SplashScreen SplashScreen()
{
return m_splashScreen;
}

protected:
ActivatedEventArgsBase() = default;

ActivationKind m_kind = ActivationKind::Launch;
ApplicationExecutionState m_previousState;
winrt::Windows::ApplicationModel::Activation::SplashScreen m_splashScreen{ nullptr };
};
}

76 changes: 76 additions & 0 deletions dev/AppLifecycle/ActivationRegistrationManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#include <pch.h>
#include <ActivationRegistrationManager.h>
#include <ActivationRegistrationManager.g.cpp>

#include "LaunchActivatedEventArgs.h"
#include "ProtocolActivatedEventArgs.h"
#include "Shared.h"

namespace winrt::Microsoft::ProjectReunion::implementation
{
void ActivationRegistrationManager::RegisterForFileTypeActivation(hstring const& groupName,
hstring const& logo, array_view<hstring const> supportedFileTypes,
array_view<hstring const> supportedVerbs)
{
throw hresult_not_implemented();
}

void ActivationRegistrationManager::RegisterForProtocolActivation(hstring const& scheme,
hstring const& displayName)
{
if (scheme.empty() || displayName.empty())
{
throw winrt::hresult_invalid_argument();
}

if (HasIdentity())
{
throw hresult_not_implemented();
}

RegisterProtocol(scheme.c_str(), displayName.c_str());
}

void ActivationRegistrationManager::RegisterForStartupActivation(hstring const& taskId,
bool isEnabled, hstring const& displayName)
{
throw hresult_not_implemented();
}

void ActivationRegistrationManager::RegisterForToastActivation(hstring const& displayName)
{
throw hresult_not_implemented();
}

void ActivationRegistrationManager::UnregisterForFileTypeActivation(hstring const& groupName)
{
throw hresult_not_implemented();
}

void ActivationRegistrationManager::UnregisterForProtocolActivation(hstring const& scheme)
{
if (scheme.empty())
{
throw winrt::hresult_invalid_argument();
}

if (HasIdentity())
{
throw hresult_not_implemented();
}

UnregisterProtocol(scheme.c_str());
}

void ActivationRegistrationManager::UnregisterForStartupActivation()
{
throw hresult_not_implemented();
}

void ActivationRegistrationManager::UnregisterForToastActivation()
{
throw hresult_not_implemented();
}
}
33 changes: 33 additions & 0 deletions dev/AppLifecycle/ActivationRegistrationManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#pragma once

#include <ActivationRegistrationManager.g.h>

namespace winrt::Microsoft::ProjectReunion::implementation
{
struct ActivationRegistrationManager
{
ActivationRegistrationManager() = default;

static void RegisterForFileTypeActivation(hstring const& groupName, hstring const& logo,
array_view<hstring const> supportedFileTypes, array_view<hstring const> supportedVerbs);
static void RegisterForProtocolActivation(hstring const& scheme, hstring const& displayName);
static void RegisterForStartupActivation(hstring const& taskId, bool isEnabled,
hstring const& displayName);
static void RegisterForToastActivation(hstring const& displayName);

static void UnregisterForFileTypeActivation(hstring const& groupName);
static void UnregisterForProtocolActivation(hstring const& scheme);
static void UnregisterForStartupActivation();
static void UnregisterForToastActivation();
};
}

namespace winrt::Microsoft::ProjectReunion::factory_implementation
{
struct ActivationRegistrationManager : ActivationRegistrationManagerT<ActivationRegistrationManager,
implementation::ActivationRegistrationManager>
{
};
}
62 changes: 62 additions & 0 deletions dev/AppLifecycle/AppLifecycle.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

#include <pch.h>
#include <AppLifecycle.h>
#include <AppLifecycle.g.cpp>

#include "LaunchActivatedEventArgs.h"
#include "ProtocolActivatedEventArgs.h"
#include "Shared.h"

namespace winrt::Microsoft::ProjectReunion::implementation
{
std::tuple<std::wstring, std::wstring> ParseCommandLine(std::wstring commandLine)
{
auto argsStart = commandLine.rfind(L"----") + 4;
if (argsStart == std::wstring::npos)
{
return {L"", L""};
}

// We explicitly use find_first_of here, so that the resulting data may contain : as a valid character.
auto argsEnd = commandLine.find_first_of(L":", argsStart);
if (argsEnd == std::wstring::npos)
{
return {L"", L""};
}

if (argsStart > argsEnd)
{
throw std::overflow_error("commandLine");
}

auto argsLength = argsEnd - argsStart;
auto dataStart = argsEnd + 1;

return {commandLine.substr(argsStart, argsLength), commandLine.substr(dataStart)};
}

Windows::ApplicationModel::Activation::IActivatedEventArgs AppLifecycle::GetActivatedEventArgs()
{
if (HasIdentity())
{
return Windows::ApplicationModel::AppInstance::GetActivatedEventArgs();
}
else
{
// Generate IActivatedEventArgs for non-Packaged applications.
std::wstring contractId;
std::wstring contractData;
auto commandLine = std::wstring(GetCommandLine());
std::tie(contractId, contractData) = ParseCommandLine(commandLine);

if (!contractId.empty() && contractId == c_protocolArgumentString)
{
return winrt::make<ProtocolActivatedEventArgs>(contractData);
}

return winrt::make<LaunchActivatedEventArgs>(commandLine);
}
}
}
22 changes: 22 additions & 0 deletions dev/AppLifecycle/AppLifecycle.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#pragma once

#include <AppLifecycle.g.h>

namespace winrt::Microsoft::ProjectReunion::implementation
{
struct AppLifecycle
{
AppLifecycle() = default;

static Windows::ApplicationModel::Activation::IActivatedEventArgs GetActivatedEventArgs();
};
}

namespace winrt::Microsoft::ProjectReunion::factory_implementation
{
struct AppLifecycle : AppLifecycleT<AppLifecycle, implementation::AppLifecycle>
{
};
}
23 changes: 23 additions & 0 deletions dev/AppLifecycle/AppLifecycle.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

namespace Microsoft.ProjectReunion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonwis , I was imagining that we would not have anything in "Microsoft.ProjectReuion" namespace. Is this OK?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now it is, but we should probably move this to Ms.AppModel.Something eventually

{
static runtimeclass AppLifecycle
{
static Windows.ApplicationModel.Activation.IActivatedEventArgs GetActivatedEventArgs();
}

static runtimeclass ActivationRegistrationManager
{
static void RegisterForFileTypeActivation(String groupName, String logo, String[] supportedFileTypes, String[] supportedVerbs);
static void RegisterForProtocolActivation(String scheme, String displayName);
static void RegisterForStartupActivation(String taskId, Boolean isEnabled, String displayName);
static void RegisterForToastActivation(String displayName);

static void UnregisterForFileTypeActivation(String groupName);
static void UnregisterForProtocolActivation(String scheme);
static void UnregisterForStartupActivation();
static void UnregisterForToastActivation();
};
}
29 changes: 29 additions & 0 deletions dev/AppLifecycle/AppLifecycle.vcxitems
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<ItemsProjectGuid>{E3A522A3-6635-4A42-BDED-1AF46A15F63C}</ItemsProjectGuid>
<ItemsProjectName>AppLifecycle</ItemsProjectName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectCapability Include="SourceItemsFromImports" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MSBuildThisFileDirectory)ActivationRegistrationManager.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)Shared.cpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)ActivatedEventArgsBase.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)ActivationRegistrationManager.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)Shared.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)LaunchActivatedEventArgs.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)ProtocolActivatedEventArgs.h" />
<Midl Include="$(MSBuildThisFileDirectory)AppLifecycle.idl" />
<ClInclude Include="$(MSBuildThisFileDirectory)AppLifecycle.h" />
<ClCompile Include="$(MSBuildThisFileDirectory)AppLifecycle.cpp" />
</ItemGroup>
</Project>
Loading