forked from microsoft/WindowsAppSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0d6f3b
commit 74a5990
Showing
18 changed files
with
558 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) Microsoft Corporation and Contributors. | ||
// Licensed under the MIT License. | ||
|
||
// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT IT | ||
|
||
// INPUT FILE: dev\common\TerminalVelocityFeatures-Workloads.xml | ||
// OPTIONS: -Channel Experimental -Language C++ -Namespace Microsoft.Windows.System.Workloads -Path dev\common\TerminalVelocityFeatures-Workloads.xml -Output dev\common\TerminalVelocityFeatures-Workloads.h | ||
|
||
#if defined(__midlrt) | ||
namespace features | ||
{ | ||
feature_name Feature_Workloads = { DisabledByDefault, FALSE }; | ||
} | ||
#endif // defined(__midlrt) | ||
|
||
// Feature constants | ||
#define WINDOWSAPPRUNTIME_MICROSOFT_WINDOWS_SYSTEM_WORKLOADS_FEATURE_WORKLOADS_ENABLED 1 | ||
|
||
#if defined(__cplusplus) | ||
|
||
namespace Microsoft::Windows::System::Workloads | ||
{ | ||
|
||
__pragma(detect_mismatch("ODR_violation_WINDOWSAPPRUNTIME_MICROSOFT_WINDOWS_SYSTEM_WORKLOADS_FEATURE_WORKLOADS_ENABLED_mismatch", "AlwaysEnabled")) | ||
struct Feature_Workloads | ||
{ | ||
static constexpr bool IsEnabled() { return WINDOWSAPPRUNTIME_MICROSOFT_WINDOWS_SYSTEM_WORKLOADS_FEATURE_WORKLOADS_ENABLED == 1; } | ||
}; | ||
|
||
} // namespace Microsoft.Windows.System.Workloads | ||
|
||
#endif // defined(__cplusplus) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0"?> | ||
<features xmlns="http://microsoft.com/windowsappsdk/TerminalVelocity/20210729/TerminalVelocityFeatures.xsd"> | ||
|
||
<!-- Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the MIT License. See LICENSE in the project root for license information. | ||
--> | ||
|
||
<!-- See docs/TerminalVelocity.md for more info. --> | ||
|
||
<!-- Enabled variants --> | ||
<feature> | ||
<name>Feature_Workloads</name> | ||
<description>Workloads APIs</description> | ||
<state>AlwaysEnabled</state> | ||
<alwaysDisabledChannelTokens> | ||
<channelToken>Preview</channelToken> | ||
<channelToken>Stable</channelToken> | ||
</alwaysDisabledChannelTokens> | ||
</feature> | ||
</features> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) Microsoft Corporation and Contributors. | ||
// Licensed under the MIT License. | ||
|
||
#include "pch.h" | ||
|
||
#include "M.W.S.W.Workload.h" | ||
#include "Microsoft.Windows.System.Workloads.Workload.g.cpp" | ||
|
||
#include <wil/winrt.h> | ||
|
||
namespace winrt::Microsoft::Windows::System::Workloads::implementation | ||
{ | ||
Workload::Workload(hstring const& id, hstring const& displayName, hstring const& workloadHandlerActivatableClassId) : | ||
m_id(id), | ||
m_displayName(displayName), | ||
m_workloadHandlerActivatableClassId(m_workloadHandlerActivatableClassId) | ||
{ | ||
} | ||
hstring Workload::Id() | ||
{ | ||
return m_id; | ||
} | ||
hstring Workload::DisplayName() | ||
{ | ||
return m_displayName; | ||
} | ||
hstring Workload::WorkloadHandlerActivatableClassId() | ||
{ | ||
return m_workloadHandlerActivatableClassId; | ||
} | ||
winrt::Microsoft::Windows::System::Workloads::IWorkloadHandler Workload::WorkloadHandler() | ||
{ | ||
if (!m_workloadHandler) | ||
{ | ||
//TODO | ||
} | ||
return m_workloadHandler; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) Microsoft Corporation and Contributors. | ||
// Licensed under the MIT License. | ||
|
||
#pragma once | ||
|
||
#include "Microsoft.Windows.System.Workloads.Workload.g.h" | ||
|
||
namespace winrt::Microsoft::Windows::System::Workloads::implementation | ||
{ | ||
struct Workload : WorkloadT<Workload> | ||
{ | ||
Workload() = default; | ||
Workload(hstring const& id, hstring const& displayName, hstring const& workloadHandlerActivatableClassId); | ||
|
||
hstring Id(); | ||
hstring DisplayName(); | ||
hstring WorkloadHandlerActivatableClassId(); | ||
winrt::Microsoft::Windows::System::Workloads::IWorkloadHandler WorkloadHandler(); | ||
|
||
private: | ||
hstring m_id; | ||
hstring m_displayName; | ||
hstring m_workloadHandlerActivatableClassId; | ||
winrt::Microsoft::Windows::System::Workloads::IWorkloadHandler m_workloadHandler{}; | ||
}; | ||
} | ||
namespace winrt::Microsoft::Windows::System::Workloads::factory_implementation | ||
{ | ||
struct Workload : WorkloadT<Workload, implementation::Workload> | ||
{ | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright (c) Microsoft Corporation and Contributors. | ||
// Licensed under the MIT License. | ||
|
||
#include "pch.h" | ||
|
||
#include "M.W.S.W.WorkloadManager.h" | ||
#include "Microsoft.Windows.System.Workloads.WorkloadManager.g.cpp" | ||
|
||
namespace winrt::Microsoft::Windows::System::Workloads::implementation | ||
{ | ||
winrt::Microsoft::Windows::System::Workloads::WorkloadManager WorkloadManager::GetDefault() | ||
{ | ||
return winrt::make<winrt::Microsoft::Windows::System::Workloads::implementation::WorkloadManager>(); | ||
} | ||
winrt::Microsoft::Windows::System::Workloads::Workload WorkloadManager::GetWorkload(hstring const& workloadId) | ||
{ | ||
//TODO winrt::Windows::Foundation::Collections::IPropertySet properties; | ||
//TODO THROW_IF_FAILED(FrameworkUDk.PackageManagementWorkloads_GetWorkload(workloadId.c_str(), wil::out_param(properties))); | ||
//TODO | ||
//TODO auto id{ properties.Lookup(L"Id").as<winrt::Windows::Foundation::IPropertyValue>() }; | ||
//TODO THROW_HR_IF_NULL(E_UNEXPECTED, id); | ||
//TODO THROW_HR_IF(E_UNEXPECTED, id.Type() != winrt::Windows::Foundation::PropertyType::String); | ||
//TODO | ||
//TODO auto displayName{ properties.Lookup(L"DisplayName").as<winrt::Windows::Foundation::IPropertyValue>() }; | ||
//TODO THROW_HR_IF_NULL(E_UNEXPECTED, displayName); | ||
//TODO THROW_HR_IF(E_UNEXPECTED, displayName.Type() != winrt::Windows::Foundation::PropertyType::String); | ||
//TODO | ||
//TODO winrt::hstring action_remove_activatableClassId; | ||
//TODO { | ||
//TODO auto actions{ properties.Lookup(L"Actions").as<winrt::Windows::Foundation::IPropertyValue>() }; | ||
//TODO THROW_HR_IF_NULL(E_UNEXPECTED, actions); | ||
//TODO THROW_HR_IF(E_UNEXPECTED, actions.Type() != winrt::Windows::Foundation::PropertyType::Inspectable); | ||
//TODO auto actions_remove{ actions.Lookup(L"Actions").as<winrt::Windows::Foundation::IPropertyValue>() }; | ||
//TODO if (actions_remove) | ||
//TODO { | ||
//TODO THROW_HR_IF(E_UNEXPECTED, actions_remove.Type() != winrt::Windows::Foundation::PropertyType::Inspectable); | ||
//TODO action_remove_activatableClassId = properties.Lookup(L"@ActivatableClassId").as<winrt::Windows::Foundation::IPropertyValue>() }; | ||
//TODO THROW_HR_IF_NULL(E_UNEXPECTED, action_remove_activatableClassId); | ||
//TODO THROW_HR_IF(E_UNEXPECTED, action_remove_activatableClassId.Type() != winrt::Windows::Foundation::PropertyType::String); | ||
//TODO } | ||
//TODO } | ||
//TODO | ||
//TODO return winrt::make<winrt::Microsoft::Windows::System::Workloads::implementation::Workload>(id.GetString(), displayName.GetString(), action_remove_activatableClassId.GetString()); | ||
|
||
throw hresult_not_implemented(); | ||
} | ||
winrt::Windows::Foundation::Collections::IVector<hstring> WorkloadManager::FindIds() | ||
{ | ||
auto ids{ winrt::single_threaded_vector<hstring>() }; | ||
|
||
//TODO wil::unique_cotaskmem_ptr<PWSTR[]> workloadIds; | ||
//TODO uint32_t workloadIdsCount{}; | ||
//TODO THROW_IF_FAILED(FrameworkUDk.PackageManagementWorkloads_FindIds(&workloadIdsCount, wil::out_param(workloadIds))); | ||
//TODO for (uint32_t index=0; index < workloadIdsCount; ++index) | ||
//TODO { | ||
//TODO const winrt::hstring id{ workloadIds[index] }; | ||
//TODO ids.Append(id); | ||
//TODO } | ||
|
||
return ids; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) Microsoft Corporation and Contributors. | ||
// Licensed under the MIT License. | ||
|
||
#pragma once | ||
|
||
#include "Microsoft.Windows.System.Workloads.WorkloadManager.g.h" | ||
|
||
namespace winrt::Microsoft::Windows::System::Workloads::implementation | ||
{ | ||
struct WorkloadManager : WorkloadManagerT<WorkloadManager> | ||
{ | ||
WorkloadManager() = default; | ||
|
||
static winrt::Microsoft::Windows::System::Workloads::WorkloadManager GetDefault(); | ||
winrt::Microsoft::Windows::System::Workloads::Workload GetWorkload(hstring const& id); | ||
winrt::Windows::Foundation::Collections::IVector<hstring> FindIds(); | ||
}; | ||
} | ||
namespace winrt::Microsoft::Windows::System::Workloads::factory_implementation | ||
{ | ||
struct WorkloadManager : WorkloadManagerT<WorkloadManager, implementation::WorkloadManager> | ||
{ | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Microsoft Corporation and Contributors. | ||
// Licensed under the MIT License. | ||
|
||
#include "pch.h" | ||
|
||
#include "M.W.S.W.WorkloadProgress.h" | ||
#include "Microsoft.Windows.System.Workloads.WorkloadProgress.g.cpp" | ||
|
||
namespace winrt::Microsoft::Windows::System::Workloads::implementation | ||
{ | ||
winrt::Microsoft::Windows::System::Workloads::WorkloadProgressStatus WorkloadProgress::status() | ||
{ | ||
return m_status; | ||
} | ||
void WorkloadProgress::status(winrt::Microsoft::Windows::System::Workloads::WorkloadProgressStatus const& value) | ||
{ | ||
m_status = value; | ||
} | ||
double WorkloadProgress::percentage() | ||
{ | ||
return m_percentage; | ||
} | ||
void WorkloadProgress::percentage(double value) | ||
{ | ||
m_percentage = value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) Microsoft Corporation and Contributors. | ||
// Licensed under the MIT License. | ||
|
||
#pragma once | ||
|
||
#include "Microsoft.Windows.System.Workloads.WorkloadProgress.g.h" | ||
|
||
namespace winrt::Microsoft::Windows::System::Workloads::implementation | ||
{ | ||
struct WorkloadProgress : WorkloadProgressT<WorkloadProgress> | ||
{ | ||
WorkloadProgress() = default; | ||
|
||
winrt::Microsoft::Windows::System::Workloads::WorkloadProgressStatus status(); | ||
void status(winrt::Microsoft::Windows::System::Workloads::WorkloadProgressStatus const& value); | ||
double percentage(); | ||
void percentage(double value); | ||
|
||
private: | ||
winrt::Microsoft::Windows::System::Workloads::WorkloadProgressStatus m_status{}; | ||
double m_percentage{}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) Microsoft Corporation and Contributors. | ||
// Licensed under the MIT License. | ||
|
||
#include "pch.h" | ||
|
||
#include "M.W.S.W.WorkloadResult.h" | ||
#include "Microsoft.Windows.System.Workloads.WorkloadResult.g.cpp" | ||
|
||
namespace winrt::Microsoft::Windows::System::Workloads::implementation | ||
{ | ||
winrt::Microsoft::Windows::System::Workloads::WorkloadStatus WorkloadResult::Status() | ||
{ | ||
return m_status; | ||
} | ||
winrt::hresult WorkloadResult::ExtendedError() | ||
{ | ||
return m_extendedError; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation and Contributors. | ||
// Licensed under the MIT License. | ||
|
||
#pragma once | ||
|
||
#include "Microsoft.Windows.System.Workloads.WorkloadResult.g.h" | ||
|
||
namespace winrt::Microsoft::Windows::System::Workloads::implementation | ||
{ | ||
struct WorkloadResult : WorkloadResultT<WorkloadResult> | ||
{ | ||
WorkloadResult() = default; | ||
|
||
winrt::Microsoft::Windows::System::Workloads::WorkloadStatus Status(); | ||
winrt::hresult ExtendedError(); | ||
|
||
private: | ||
winrt::Microsoft::Windows::System::Workloads::WorkloadStatus m_status{}; | ||
winrt::hresult m_extendedError{}; | ||
}; | ||
} |
Oops, something went wrong.