diff --git a/.gitignore b/.gitignore index 28e10d7f..6ae2fdf8 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ build/ bld/ [Bb]in/ [Oo]bj/ +Generated Files/ # Visual Studio 2015 cache/options directory .vs/ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..90938aff --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "*.idl": "cpp" + } +} \ No newline at end of file diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactions/EventManager.cpp b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactions/EventManager.cpp index 5d42d22b..5ad99546 100644 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactions/EventManager.cpp +++ b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactions/EventManager.cpp @@ -27,7 +27,7 @@ using namespace Windows::UI::Xaml::Controls; using namespace Microsoft::Xaml::Interactions::Core; using namespace Windows::UI::Xaml::Controls::Primitives; -struct CompareString +struct CompareStringX { bool operator() (const wchar_t* lhs, const wchar_t* rhs) const { @@ -35,8 +35,8 @@ struct CompareString } }; -typedef std::map EventNameToRegisterHandlerMap; -typedef std::map EventNameToUnregisterHandlerMap; +typedef std::map EventNameToRegisterHandlerMap; +typedef std::map EventNameToUnregisterHandlerMap; namespace Global { diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactions/Microsoft.Xaml.Interactions.vcxproj b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactions/Microsoft.Xaml.Interactions.vcxproj index bbc9543a..530d0f19 100644 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactions/Microsoft.Xaml.Interactions.vcxproj +++ b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactions/Microsoft.Xaml.Interactions.vcxproj @@ -40,7 +40,7 @@ 14.0 true Windows Store - 10.0.10586.0 + 10.0 10.0.10240.0 10.0 true @@ -51,35 +51,35 @@ DynamicLibrary true - v141 + v142 DynamicLibrary true - v141 + v142 DynamicLibrary true - v141 + v142 DynamicLibrary false true - v141 + v142 DynamicLibrary false true - v141 + v142 DynamicLibrary false true - v141 + v142 diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/ActionCollection.cpp b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/ActionCollection.cpp index 2b4e2634..98346b04 100644 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/ActionCollection.cpp +++ b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/ActionCollection.cpp @@ -2,43 +2,45 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include "pch.h" #include "ActionCollection.h" -#include "IAction.h" -#include "ResourceHelper.h" -using namespace Platform; -using namespace Windows::UI::Xaml; +namespace winrt +{ using namespace Windows::Foundation::Collections; -using namespace Microsoft::Xaml::Interactivity; +using namespace Windows::UI::Xaml; +} // namespace winrt +namespace winrt::Microsoft::Xaml::Interactivity::implementation +{ ActionCollection::ActionCollection() { - this->VectorChanged += ref new VectorChangedEventHandler(this, &ActionCollection::OnVectorChanged); + _vectorChanged = VectorChanged(auto_revoke, {get_weak(), &ActionCollection::OnVectorChanged}); } -void ActionCollection::OnVectorChanged(IObservableVector^ sender, IVectorChangedEventArgs^ eventArgs) +void ActionCollection::OnVectorChanged(IObservableVector const &, IVectorChangedEventArgs const &event) { - CollectionChange collectionChange = eventArgs->CollectionChange; + auto collectionChange = event.CollectionChange(); - if (collectionChange == CollectionChange::Reset) - { - for (const auto& item : this) - { - ActionCollection::VerifyType(item); - } - } - else if (collectionChange == CollectionChange::ItemInserted || collectionChange == CollectionChange::ItemChanged) - { - auto changedItem = this->GetAt(eventArgs->Index); - ActionCollection::VerifyType(changedItem); - } + if (collectionChange == CollectionChange::Reset) + { + for (auto const &item : *this) + { + ActionCollection::VerifyType(item); + } + } + else if (collectionChange == CollectionChange::ItemInserted || collectionChange == CollectionChange::ItemChanged) + { + auto changedItem = GetAt(event.Index()); + ActionCollection::VerifyType(changedItem); + } } -void ActionCollection::VerifyType(DependencyObject^ item) +void ActionCollection::VerifyType(DependencyObject const &item) { - IAction^ action = dynamic_cast(item); - - if (action == nullptr) - { - throw ref new FailureException(ResourceHelper::GetString("NonActionAddedToActionCollectionExceptionMessage")); - } -} \ No newline at end of file + auto type = item.try_as(); + if (type == nullptr) + { + // ResourceHelper::GetString("NonActionAddedToActionCollectionExceptionMessage") + throw winrt::hresult_invalid_argument(L"NonActionAddedToActionCollectionExceptionMessage"); + } +} +} // namespace winrt::Microsoft::Xaml::Interactivity::implementation diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/ActionCollection.h b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/ActionCollection.h index 147ba148..5aa8d74d 100644 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/ActionCollection.h +++ b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/ActionCollection.h @@ -1,26 +1,33 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma once +#include "ActionCollection.g.h" -namespace Microsoft { namespace Xaml { namespace Interactivity +namespace winrt::Microsoft::Xaml::Interactivity::implementation { - /// - /// Represents a collection of IActions. - /// - public ref class ActionCollection sealed : ::Windows::UI::Xaml::DependencyObjectCollection - { - public: - /// - /// Initializes a new instance of the class. - /// - ActionCollection(); +/// +/// Represents a collection of IActions. +/// +struct ActionCollection : ActionCollectionT +{ + /// + /// Initializes a new instance of the class. + /// + ActionCollection(); - private: - void OnVectorChanged( - ::Windows::Foundation::Collections::IObservableVector<::Windows::UI::Xaml::DependencyObject^>^ sender, - ::Windows::Foundation::Collections::IVectorChangedEventArgs^ eventArgs); +private: + VectorChanged_revoker _vectorChanged; - static void VerifyType(::Windows::UI::Xaml::DependencyObject^ item); - }; + void OnVectorChanged( + Windows::Foundation::Collections::IObservableVector const &sender, + Windows::Foundation::Collections::IVectorChangedEventArgs const &event); -}}} \ No newline at end of file + static void VerifyType(Windows::UI::Xaml::DependencyObject const &item); +}; +} // namespace winrt::Microsoft::Xaml::Interactivity::implementation +namespace winrt::Microsoft::Xaml::Interactivity::factory_implementation +{ +struct ActionCollection : ActionCollectionT +{ +}; +} // namespace winrt::Microsoft::Xaml::Interactivity::factory_implementation diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/BehaviorCollection.cpp b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/BehaviorCollection.cpp index 11c2c01d..cc8c0516 100644 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/BehaviorCollection.cpp +++ b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/BehaviorCollection.cpp @@ -2,178 +2,187 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include "pch.h" #include "BehaviorCollection.h" -#include "IBehavior.h" -#include "ResourceHelper.h" -using namespace Platform; -using namespace Platform::Collections; -using namespace Windows::UI::Xaml; -using namespace Microsoft::Xaml::Interactivity; +namespace winrt +{ +using namespace Windows::ApplicationModel; using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +} // namespace winrt -BehaviorCollection::BehaviorCollection() +namespace winrt::Microsoft::Xaml::Interactivity::implementation +{ +BehaviorCollection::BehaviorCollection() : associatedObject(nullptr) { - this->associatedObject = nullptr; - this->VectorChanged += ref new VectorChangedEventHandler(this, &BehaviorCollection::OnVectorChanged); + _vectorChanged = VectorChanged(auto_revoke, {get_weak(), &BehaviorCollection::OnVectorChanged}); } BehaviorCollection::~BehaviorCollection() { - this->Detach(); + Detach(); } -void BehaviorCollection::OnVectorChanged(IObservableVector^ sender, IVectorChangedEventArgs^ eventArgs) +void BehaviorCollection::OnVectorChanged(IObservableVector const &sender, IVectorChangedEventArgs const &eventArgs) { - if (eventArgs->CollectionChange == CollectionChange::Reset) - { - for (auto& behavior : this->oldCollection) - { - if (behavior->AssociatedObject != nullptr) - { - behavior->Detach(); - } - } - - this->oldCollection.clear(); - this->oldCollection.reserve(this->Size); - - for (const auto& newItem : this) - { - this->oldCollection.push_back(this->VerifiedAttach(newItem)); - } + if (eventArgs.CollectionChange() == CollectionChange::Reset) + { + for (auto &behavior : this->oldCollection) + { + if (behavior.AssociatedObject() != nullptr) + { + behavior.Detach(); + } + } + + this->oldCollection.clear(); + this->oldCollection.reserve(this->Size()); + + for (const auto &newItem : *this) + { + this->oldCollection.push_back(VerifiedAttach(newItem)); + } #if _DEBUG - this->VerifyOldCollectionIntegrity(); + this->VerifyOldCollectionIntegrity(); #endif - return; - } - - unsigned int eventIndex = eventArgs->Index; - DependencyObject^ changedItem = this->GetAt(eventIndex); - - switch (eventArgs->CollectionChange) - { - case CollectionChange::ItemInserted: - { - this->oldCollection.insert(oldCollection.begin() + eventIndex, this->VerifiedAttach(changedItem)); - } - break; - - case CollectionChange::ItemChanged: - { - IBehavior^ oldItem = this->oldCollection[eventIndex]; - if (oldItem->AssociatedObject != nullptr) - { - oldItem->Detach(); - } - - this->oldCollection[eventIndex] = this->VerifiedAttach(changedItem); - } - break; - - case CollectionChange::ItemRemoved: - { - IBehavior^ oldItem = this->oldCollection[eventIndex]; - if (oldItem->AssociatedObject != nullptr) - { - oldItem->Detach(); - } - - this->oldCollection.erase(oldCollection.begin() + eventIndex); - } - break; - - default: - _ASSERT(false); - break; - } + return; + } + + unsigned int eventIndex = eventArgs.Index(); + auto changedItem = this->GetAt(eventIndex); + + switch (eventArgs.CollectionChange()) + { + case CollectionChange::ItemInserted: + { + this->oldCollection.insert(oldCollection.begin() + eventIndex, this->VerifiedAttach(changedItem)); + } + break; + + case CollectionChange::ItemChanged: + { + auto oldItem = this->oldCollection[eventIndex]; + if (oldItem.AssociatedObject() != nullptr) + { + oldItem.Detach(); + } + + this->oldCollection[eventIndex] = this->VerifiedAttach(changedItem); + } + break; + + case CollectionChange::ItemRemoved: + { + auto oldItem = this->oldCollection[eventIndex]; + if (oldItem.AssociatedObject() != nullptr) + { + oldItem.Detach(); + } + + this->oldCollection.erase(oldCollection.begin() + eventIndex); + } + break; + + default: + _ASSERT(false); + break; + } #if _DEBUG - this->VerifyOldCollectionIntegrity(); + this->VerifyOldCollectionIntegrity(); #endif } -void BehaviorCollection::Attach(DependencyObject^ associatedObject) +DependencyObject BehaviorCollection::AssociatedObject() { - if (associatedObject == this->AssociatedObject) - { - return; - } - - if (Windows::ApplicationModel::DesignMode::DesignModeEnabled) - { - return; - } - - if (this->AssociatedObject != nullptr) - { - throw ref new FailureException(ResourceHelper::GetString("CannotAttachBehaviorMultipleTimesExceptionMessage")); - } - - _ASSERT(associatedObject != nullptr); - this->associatedObject = associatedObject; - - for (DependencyObject^ item : this) - { - IBehavior^ behaviorItem = safe_cast(item); - behaviorItem->Attach(this->AssociatedObject); - } + return associatedObject.get(); } +void BehaviorCollection::Attach(DependencyObject const &associatedObject) +{ + if (associatedObject == AssociatedObject()) + { + return; + } + + if (DesignMode::DesignModeEnabled()) + { + return; + } + + if (AssociatedObject() != nullptr) + { + //ResourceHelper::GetString("CannotAttachBehaviorMultipleTimesExceptionMessage") + throw winrt::hresult_invalid_argument(L"CannotAttachBehaviorMultipleTimesExceptionMessage"); + } + + _ASSERT(associatedObject != nullptr); + this->associatedObject = associatedObject; + + for (auto const &item : *this) + { + auto behaviorItem = item.as(); + behaviorItem.Attach(associatedObject); + } +} void BehaviorCollection::Detach() { - for (auto& item : this->oldCollection) - { - if (item->AssociatedObject != nullptr) - { - item->Detach(); - } - } + for (auto& item : this->oldCollection) + { + if (item.AssociatedObject() != nullptr) + { + item.Detach(); + } + } - this->oldCollection.clear(); + this->oldCollection.clear(); - this->associatedObject = nullptr; + this->associatedObject = nullptr; } -IBehavior^ BehaviorCollection::VerifiedAttach(DependencyObject^ item) +IBehavior BehaviorCollection::VerifiedAttach(DependencyObject const& item) { - IBehavior^ behavior = dynamic_cast(item); - if (behavior == nullptr) - { - throw ref new FailureException(ResourceHelper::GetString("NonBehaviorAddedToBehaviorCollectionExceptionMessage")); - } - - auto found = std::find(begin(this->oldCollection), end(this->oldCollection), behavior); - if (found != this->oldCollection.end()) - { - throw ref new FailureException(ResourceHelper::GetString("DuplicateBehaviorInCollectionExceptionMessage")); - } - - if (this->AssociatedObject != nullptr) - { - behavior->Attach(this->AssociatedObject); - } - - return behavior; + auto behavior = item.as(); + if (behavior == nullptr) + { + // ResourceHelper::GetString("NonBehaviorAddedToBehaviorCollectionExceptionMessage") + throw winrt::hresult_invalid_argument(L"NonBehaviorAddedToBehaviorCollectionExceptionMessage"); + } + + auto found = std::find(begin(this->oldCollection), end(this->oldCollection), behavior); + if (found != this->oldCollection.end()) + { + // ResourceHelper::GetString("DuplicateBehaviorInCollectionExceptionMessage") + throw winrt::hresult_invalid_argument(L"DuplicateBehaviorInCollectionExceptionMessage"); + } + + if (this->AssociatedObject() != nullptr) + { + behavior.Attach(this->AssociatedObject()); + } + + return behavior; } #if _DEBUG void BehaviorCollection::VerifyOldCollectionIntegrity() { - bool isValid = (this->Size == this->oldCollection.size()); - if (isValid) - { - for (unsigned int i = 0; i < this->Size; i++) - { - if (safe_cast(this->GetAt(i)) != this->oldCollection[i]) - { - isValid = false; - break; - } - } - } - - _ASSERT(isValid); + bool isValid = (this->Size() == this->oldCollection.size()); + if (isValid) + { + for (unsigned int i = 0; i < this->Size(); i++) + { + if (GetAt(i).as() != this->oldCollection[i]) + { + isValid = false; + break; + } + } + } + + _ASSERT(isValid); } -#endif \ No newline at end of file +#endif + +} // namespace winrt::Microsoft::Xaml::Interactivity::implementation diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/BehaviorCollection.h b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/BehaviorCollection.h index bd20d8e9..ae4f84ad 100644 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/BehaviorCollection.h +++ b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/BehaviorCollection.h @@ -1,62 +1,60 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma once -#include "IBehavior.h" +#include "BehaviorCollection.g.h" -namespace Microsoft { namespace Xaml { namespace Interactivity +namespace winrt::Microsoft::Xaml::Interactivity::implementation { - /// - /// Represents a collection of IBehaviors with a shared . - /// - [::Windows::Foundation::Metadata::WebHostHidden] - public ref class BehaviorCollection sealed : ::Windows::UI::Xaml::DependencyObjectCollection - { - public: - /// - /// Initializes a new instance of the class. - /// - BehaviorCollection(); - - /// - /// Gets the to which the is attached. - /// - property ::Windows::UI::Xaml::DependencyObject^ AssociatedObject - { - ::Windows::UI::Xaml::DependencyObject^ get() - { - return this->associatedObject.Resolve(); - } - } - - /// - /// Attaches the collection of behaviors to the specified . - /// - /// The to which to attach. - /// The is already attached to a different . - void Attach(::Windows::UI::Xaml::DependencyObject^ associatedObject); - - /// - /// Detaches the collection of behaviors from the . - /// - void Detach(); - - private: - ~BehaviorCollection(); - - // After a VectorChanged event we need to compare the current state of the collection - // with the old collection so that we can call Detach on all removed items. - std::vector oldCollection; - ::Platform::WeakReference associatedObject; - - void OnVectorChanged( - ::Windows::Foundation::Collections::IObservableVector<::Windows::UI::Xaml::DependencyObject^>^ sender, - ::Windows::Foundation::Collections::IVectorChangedEventArgs^ eventArgs); - - IBehavior^ VerifiedAttach(::Windows::UI::Xaml::DependencyObject^ item); +/// +/// Represents a collection of IBehaviors with a shared . +/// +struct BehaviorCollection : BehaviorCollectionT +{ + /// + /// Initializes a new instance of the class. + /// + BehaviorCollection(); + ~BehaviorCollection(); + + /// + /// Gets the to which the is attached. + /// + Windows::UI::Xaml::DependencyObject AssociatedObject(); + + /// + /// Attaches the collection of behaviors to the specified . + /// + /// The to which to attach. + /// The is already attached to a different . + void Attach(Windows::UI::Xaml::DependencyObject const &associatedObject); + + /// + /// Detaches the collection of behaviors from the . + /// + void Detach(); + +private: + // After a VectorChanged event we need to compare the current state of the collection + // with the old collection so that we can call Detach on all removed items. + std::vector oldCollection; + winrt::weak_ref associatedObject; + + VectorChanged_revoker _vectorChanged; + + void OnVectorChanged( + Windows::Foundation::Collections::IObservableVector const &sender, + Windows::Foundation::Collections::IVectorChangedEventArgs const &event); + + Microsoft::Xaml::Interactivity::IBehavior VerifiedAttach(Windows::UI::Xaml::DependencyObject const& item); #if _DEBUG - void VerifyOldCollectionIntegrity(); + void VerifyOldCollectionIntegrity(); #endif - }; - -}}} \ No newline at end of file +}; +} // namespace winrt::Microsoft::Xaml::Interactivity::implementation +namespace winrt::Microsoft::Xaml::Interactivity::factory_implementation +{ +struct BehaviorCollection : BehaviorCollectionT +{ +}; +} // namespace winrt::Microsoft::Xaml::Interactivity::factory_implementation diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/IAction.h b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/IAction.h deleted file mode 100644 index 7804c93e..00000000 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/IAction.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -#pragma once - -#include "IBehavior.h" - -namespace Microsoft { namespace Xaml { namespace Interactivity -{ - /// - /// Interface implemented by all custom actions. - /// - [::Windows::Foundation::Metadata::WebHostHidden] - public interface class IAction - { - /// - /// Executes the action. - /// - /// The that is passed to the action by the behavior. Generally this is or a target object. - /// The value of this parameter is determined by the caller. - /// An example of parameter usage is EventTriggerBehavior, which passes the EventArgs as a parameter to its actions. - /// Returns the result of the action. - ::Platform::Object^ Execute(::Platform::Object^ sender, ::Platform::Object^ parameter); - }; - -}}} \ No newline at end of file diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/IBehavior.h b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/IBehavior.h deleted file mode 100644 index 0fc5ec92..00000000 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/IBehavior.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -#pragma once - -namespace Microsoft { namespace Xaml { namespace Interactivity -{ - /// - /// Interface implemented by all custom behaviors. - /// - [::Windows::Foundation::Metadata::WebHostHidden] - public interface class IBehavior - { - /// - /// Gets the to which the is attached. - /// - property ::Windows::UI::Xaml::DependencyObject^ AssociatedObject - { - ::Windows::UI::Xaml::DependencyObject^ get(); - } - - /// - /// Attaches to the specified object. - /// - /// The to which the will be attached. - void Attach(::Windows::UI::Xaml::DependencyObject^ associatedObject); - - /// - /// Detaches this instance from its associated object. - /// - void Detach(); - }; - -}}} \ No newline at end of file diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Interaction.cpp b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Interaction.cpp index 45886468..4c46c0ba 100644 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Interaction.cpp +++ b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Interaction.cpp @@ -1,93 +1,95 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. #include "pch.h" #include "Interaction.h" #include "BehaviorCollection.h" -#include "IAction.h" -using namespace Platform; -using namespace Platform::Collections; +namespace winrt +{ +using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; using namespace Windows::UI::Xaml; using namespace Microsoft::Xaml::Interactivity; +} // namespace winrt +namespace winrt::Microsoft::Xaml::Interactivity::implementation +{ namespace DependencyProperties { - static DependencyProperty^ Behaviors = DependencyProperty::RegisterAttached( - "Behaviors", - BehaviorCollection::typeid, - Interaction::typeid, - ref new PropertyMetadata(nullptr, ref new PropertyChangedCallback(&Interaction::OnBehaviorsChanged))); +static DependencyProperty Behaviors = DependencyProperty::RegisterAttached( + L"Behaviors", + xaml_typename(), + xaml_typename(), + PropertyMetadata(nullptr, {&Interaction::OnBehaviorsChanged})); } -void Interaction::OnBehaviorsChanged(DependencyObject^ sender, DependencyPropertyChangedEventArgs^ args) +void Interaction::OnBehaviorsChanged(DependencyObject const &sender, DependencyPropertyChangedEventArgs const &args) { - BehaviorCollection^ oldCollection = safe_cast(args->OldValue); - BehaviorCollection^ newCollection = safe_cast(args->NewValue); - - if (oldCollection == newCollection) - { - return; - } - - if (oldCollection != nullptr && oldCollection->AssociatedObject != nullptr) - { - oldCollection->Detach(); - } - - if (newCollection != nullptr && sender != nullptr) - { - newCollection->Attach(sender); - } + auto oldCollection = args.OldValue().as(); + auto newCollection = args.NewValue().as(); + + if (oldCollection == newCollection) + { + return; + } + + if (oldCollection != nullptr && oldCollection.AssociatedObject() != nullptr) + { + oldCollection.Detach(); + } + + if (newCollection != nullptr && sender != nullptr) + { + newCollection.Attach(sender); + } } -DependencyProperty^ Interaction::BehaviorsProperty::get() +DependencyProperty Interaction::BehaviorsProperty() { - return DependencyProperties::Behaviors; + return DependencyProperties::Behaviors; } -IIterable^ Interaction::ExecuteActions(Object^ sender, ActionCollection^ actions, Object^ parameter) +IIterable Interaction::ExecuteActions(IInspectable const &sender, ActionCollection const &actions, IInspectable const ¶meter) { - if (actions == nullptr || Windows::ApplicationModel::DesignMode::DesignModeEnabled) - { - return ref new Vector(); - } - - std::vector results; - for (auto& dependencyObject : actions) - { - IAction^ action = safe_cast(static_cast(dependencyObject)); - results.push_back(action->Execute(sender, parameter)); - } - - return ref new Vector(std::move(results)); + IVector results = winrt::single_threaded_vector(); + + if (actions == nullptr || Windows::ApplicationModel::DesignMode::DesignModeEnabled()) + { + return results; + } + + for (auto &dependencyObject : actions) + { + auto action = dependencyObject.as(); + results.Append(action.Execute(sender, parameter)); + } + + return results; } -BehaviorCollection^ Interaction::GetBehaviors(DependencyObject^ obj) +Microsoft::Xaml::Interactivity::BehaviorCollection Interaction::GetBehaviors(DependencyObject const &obj) { - if (obj == nullptr) - { - #pragma warning(suppress: 6298) - throw ref new InvalidArgumentException("obj"); - } - - BehaviorCollection^ behaviors = safe_cast(obj->GetValue(Interaction::BehaviorsProperty)); - if (behaviors == nullptr) - { - behaviors = ref new BehaviorCollection(); - Interaction::SetBehaviors(obj, behaviors); - } - - return behaviors; + if (obj == nullptr) + { + throw winrt::hresult_invalid_argument(L"obj"); + } + + auto behaviors = obj.GetValue(Interaction::BehaviorsProperty()).as(); + if (behaviors == nullptr) + { + behaviors = make(); + Interaction::SetBehaviors(obj, behaviors); + } + + return behaviors; } -void Interaction::SetBehaviors(DependencyObject^ obj, BehaviorCollection^ value) +void Interaction::SetBehaviors(DependencyObject const &obj, Microsoft::Xaml::Interactivity::BehaviorCollection const &value) { - if (obj == nullptr) - { - #pragma warning(suppress: 6298) - throw ref new InvalidArgumentException("obj"); - } + if (obj == nullptr) + { + throw winrt::hresult_invalid_argument(L"obj"); + } - obj->SetValue(Interaction::BehaviorsProperty, value); + obj.SetValue(Interaction::BehaviorsProperty(), value); } + +} // namespace winrt::Microsoft::Xaml::Interactivity::implementation diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Interaction.h b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Interaction.h index 465ed567..ecae5e11 100644 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Interaction.h +++ b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Interaction.h @@ -1,55 +1,47 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma once -#include "BehaviorCollection.h" -#include "ActionCollection.h" +#include "Interaction.g.h" -namespace Microsoft { namespace Xaml { namespace Interactivity +namespace winrt::Microsoft::Xaml::Interactivity::implementation { - /// - /// Defines a attached property and provides a method for executing an . - /// - [::Windows::UI::Xaml::Data::Bindable] - [::Windows::Foundation::Metadata::WebHostHidden] - public ref class Interaction sealed - { - private: - Interaction() {}; - - public: - /// - /// Gets or sets the associated with a specified object. - /// - static property ::Windows::UI::Xaml::DependencyProperty^ BehaviorsProperty - { - ::Windows::UI::Xaml::DependencyProperty^ get(); - } - - /// - /// Gets the associated with a specified object. - /// - /// The from which to retrieve the . - /// A containing the behaviors associated with the specified object. - static BehaviorCollection^ GetBehaviors(::Windows::UI::Xaml::DependencyObject^ obj); +/// +/// Defines a attached property and provides a method for executing an . +/// +struct Interaction : InteractionT +{ + /// + /// Gets or sets the associated with a specified object. + /// + static Windows::UI::Xaml::DependencyProperty BehaviorsProperty(); - /// - /// Sets the associated with a specified object. - /// - /// The on which to set the . - /// The associated with the object. - static void SetBehaviors(::Windows::UI::Xaml::DependencyObject^ obj, BehaviorCollection^ value); + /// + /// Gets the associated with a specified object. + /// + /// The from which to retrieve the . + /// A containing the behaviors associated with the specified object. + static Microsoft::Xaml::Interactivity::BehaviorCollection GetBehaviors(Windows::UI::Xaml::DependencyObject const &obj); - /// - /// Executes all actions in the and returns their results. - /// - /// The which will be passed on to the action. - /// The set of actions to execute. - /// The value of this parameter is determined by the calling behavior. - /// Returns the results of the actions. - static ::Windows::Foundation::Collections::IIterable<::Platform::Object^>^ ExecuteActions(::Platform::Object^ sender, ActionCollection^ actions, ::Platform::Object^ parameter); + /// + /// Sets the associated with a specified object. + /// + /// The on which to set the . + /// The associated with the object. + static void SetBehaviors(Windows::UI::Xaml::DependencyObject const &obj, Microsoft::Xaml::Interactivity::BehaviorCollection const &value); - internal: - static void OnBehaviorsChanged(::Windows::UI::Xaml::DependencyObject^ sender, ::Windows::UI::Xaml::DependencyPropertyChangedEventArgs^ args); - }; + /// + /// Executes all actions in the and returns their results. + /// + /// The which will be passed on to the action. + /// The set of actions to execute. + /// The value of this parameter is determined by the calling behavior. + /// Returns the results of the actions. + static Windows::Foundation::Collections::IIterable ExecuteActions(Windows::Foundation::IInspectable const &sender, Microsoft::Xaml::Interactivity::ActionCollection const &actions, Windows::Foundation::IInspectable const ¶meter); -}}} \ No newline at end of file + static void OnBehaviorsChanged(Windows::UI::Xaml::DependencyObject const& sender, Windows::UI::Xaml::DependencyPropertyChangedEventArgs const& args); +}; +} // namespace winrt::Microsoft::Xaml::Interactivity::implementation +namespace winrt::Microsoft::Xaml::Interactivity::factory_implementation +{ +struct Interaction : InteractionT +{ +}; +} // namespace winrt::Microsoft::Xaml::Interactivity::factory_implementation diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Microsoft.Xaml.Interactivity.idl b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Microsoft.Xaml.Interactivity.idl new file mode 100644 index 00000000..38b577b8 --- /dev/null +++ b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Microsoft.Xaml.Interactivity.idl @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +namespace Microsoft +{ + namespace Xaml + { + namespace Interactivity + { + [uuid(FF80E985-5A7F-3D59-B0FC-D0279FB0E071)] + [version(0x00000001)] + interface IAction : IInspectable + { + IInspectable Execute(IInspectable sender, IInspectable parameter); + } + + [uuid(B31BD8CC-BF08-3B71-B743-058E3DBCE955)] + [version(0x00000001)] + interface IBehavior : IInspectable + { + Windows.UI.Xaml.DependencyObject AssociatedObject{ get; }; + void Attach(Windows.UI.Xaml.DependencyObject associatedObject); + void Detach(); + } + + [default_interface] + runtimeclass ActionCollection : Windows.UI.Xaml.DependencyObjectCollection + { + ActionCollection(); + } + + [default_interface] + runtimeclass BehaviorCollection : Windows.UI.Xaml.DependencyObjectCollection + { + BehaviorCollection(); + Windows.UI.Xaml.DependencyObject AssociatedObject{ get; }; + void Attach(Windows.UI.Xaml.DependencyObject associatedObject); + void Detach(); + } + + [default_interface] + static runtimeclass Interaction + { + static Windows.UI.Xaml.DependencyProperty BehaviorsProperty{ get; }; + static Microsoft.Xaml.Interactivity.BehaviorCollection GetBehaviors(Windows.UI.Xaml.DependencyObject obj); + static void SetBehaviors(Windows.UI.Xaml.DependencyObject obj, Microsoft.Xaml.Interactivity.BehaviorCollection value); + static Windows.Foundation.Collections.IIterable ExecuteActions(IInspectable sender, Microsoft.Xaml.Interactivity.ActionCollection actions, IInspectable parameter); + } + + [default_interface] + static runtimeclass VisualStateUtilities + { + static Windows.UI.Xaml.Controls.Control FindNearestStatefulControl(Windows.UI.Xaml.FrameworkElement element); + static Boolean GoToState(Windows.UI.Xaml.Controls.Control ctrl, String stateName, Boolean useTransitions); + static Windows.Foundation.Collections.IVector GetVisualStateGroups(Windows.UI.Xaml.FrameworkElement element); + } + } + } +} diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Microsoft.Xaml.Interactivity.vcxproj b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Microsoft.Xaml.Interactivity.vcxproj index ece4c61f..fb8a7020 100644 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Microsoft.Xaml.Interactivity.vcxproj +++ b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Microsoft.Xaml.Interactivity.vcxproj @@ -1,5 +1,6 @@  + 4.0 @@ -40,7 +41,7 @@ 14.0 true Windows Store - 10.0.10586.0 + 10.0 10.0.10240.0 10.0 true @@ -51,35 +52,35 @@ DynamicLibrary true - v141 + v142 DynamicLibrary true - v141 + v142 DynamicLibrary true - v141 + v142 DynamicLibrary false true - v141 + v142 DynamicLibrary false true - v141 + v142 DynamicLibrary false true - v141 + v142 @@ -220,13 +221,10 @@ - - - @@ -279,6 +277,9 @@ 72 + + + @@ -287,6 +288,7 @@ + @@ -294,5 +296,7 @@ + + \ No newline at end of file diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Microsoft.Xaml.Interactivity.vcxproj.filters b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Microsoft.Xaml.Interactivity.vcxproj.filters index 9ac052dc..35379be6 100644 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Microsoft.Xaml.Interactivity.vcxproj.filters +++ b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/Microsoft.Xaml.Interactivity.vcxproj.filters @@ -21,11 +21,8 @@ - - - @@ -65,4 +62,7 @@ + + + \ No newline at end of file diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/VisualStateUtilities.cpp b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/VisualStateUtilities.cpp index 8252295c..587becd2 100644 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/VisualStateUtilities.cpp +++ b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/VisualStateUtilities.cpp @@ -1,117 +1,116 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -#pragma warning(disable: 6298) #include "pch.h" #include "VisualStateUtilities.h" -using namespace Platform; +namespace winrt +{ using namespace Windows::UI::Xaml; using namespace Windows::UI::Xaml::Controls; using namespace Windows::UI::Xaml::Media; using namespace Windows::Foundation::Collections; -using namespace Microsoft::Xaml::Interactivity; +} // namespace winrt -bool VisualStateUtilities::GoToState(Control^ control, String^ stateName, bool useTransitions) +namespace winrt::Microsoft::Xaml::Interactivity::implementation +{ +bool VisualStateUtilities::GoToState(Control const &control, hstring const &stateName, bool useTransitions) { - if (control == nullptr) - { - #pragma warning(suppress: 6298) - throw ref new InvalidArgumentException("control"); - } - - if (stateName == nullptr) - { - #pragma warning(suppress: 6298) - throw ref new InvalidArgumentException("stateName"); - } - - control->ApplyTemplate(); - return VisualStateManager::GoToState(control, stateName, useTransitions); + if (control == nullptr) + { + throw hresult_invalid_argument(L"control"); + } + + if (stateName.empty()) + { + throw hresult_invalid_argument(L"stateName"); + } + + control.ApplyTemplate(); + return VisualStateManager::GoToState(control, stateName, useTransitions); } -IVector^ VisualStateUtilities::GetVisualStateGroups(FrameworkElement^ element) +IVector VisualStateUtilities::GetVisualStateGroups(FrameworkElement const &element) { - if (element == nullptr) - { - #pragma warning(suppress: 6298) - throw ref new InvalidArgumentException("element"); - } - - IVector^ visualStateGroups = VisualStateManager::GetVisualStateGroups(element); - - if (visualStateGroups == nullptr || visualStateGroups->Size == 0) - { - int childrenCount = VisualTreeHelper::GetChildrenCount(element); - if (childrenCount > 0) - { - FrameworkElement^ childElement = dynamic_cast(VisualTreeHelper::GetChild(element, 0)); - if (childElement != nullptr) - { - visualStateGroups = VisualStateManager::GetVisualStateGroups(childElement); - } - } - } - - return visualStateGroups; + if (element == nullptr) + { + throw hresult_invalid_argument(L"element"); + } + + auto visualStateGroups = VisualStateManager::GetVisualStateGroups(element); + + if (visualStateGroups == nullptr || visualStateGroups.Size() == 0) + { + int childrenCount = VisualTreeHelper::GetChildrenCount(element); + if (childrenCount > 0) + { + auto childElement = VisualTreeHelper::GetChild(element, 0).try_as(); + if (childElement) + { + visualStateGroups = VisualStateManager::GetVisualStateGroups(childElement); + } + } + } + + return visualStateGroups; } -Control^ VisualStateUtilities::FindNearestStatefulControl(FrameworkElement^ element) +Control VisualStateUtilities::FindNearestStatefulControl(FrameworkElement const &element) { - if (element == nullptr) - { - #pragma warning(suppress: 6298) - throw ref new InvalidArgumentException("element"); - } - - // Try to find an element which is the immediate child of a UserControl, ControlTemplate or other such "boundary" element - FrameworkElement^ parent = dynamic_cast(element->Parent); - - // bubble up looking for a place to stop - while (!VisualStateUtilities::HasVisualStateGroupsDefined(element) && VisualStateUtilities::ShouldContinueTreeWalk(parent)) - { - element = parent; - parent = dynamic_cast(element->Parent); - } - - if (VisualStateUtilities::HasVisualStateGroupsDefined(element)) - { - // Once we've found such an element, use the VisualTreeHelper to get it's parent. For most elements the two are the - // same, but for children of a ControlElement this will give the control that contains the template. - Control^ templatedParent = dynamic_cast(VisualTreeHelper::GetParent(element)); - - if (templatedParent != nullptr) - { - return templatedParent; - } - else - { - return dynamic_cast(element); - } - } - - return nullptr; + if (element == nullptr) + { + throw hresult_invalid_argument(L"element"); + } + + FrameworkElement localElement = element; + // Try to find an element which is the immediate child of a UserControl, ControlTemplate or other such "boundary" element + auto parent = localElement.Parent().as(); + + // bubble up looking for a place to stop + while (!VisualStateUtilities::HasVisualStateGroupsDefined(localElement) && VisualStateUtilities::ShouldContinueTreeWalk(parent)) + { + localElement = parent; + parent = localElement.Parent().as(); + } + + if (VisualStateUtilities::HasVisualStateGroupsDefined(localElement)) + { + // Once we've found such an element, use the VisualTreeHelper to get it's parent. For most elements the two are the + // same, but for children of a ControlElement this will give the control that contains the template. + auto templatedParent = VisualTreeHelper::GetParent(localElement).try_as(); + + if (templatedParent) + { + return templatedParent; + } + else + { + return localElement.as(); + } + } + + return nullptr; } -bool VisualStateUtilities::HasVisualStateGroupsDefined(FrameworkElement^ frameworkElement) +bool VisualStateUtilities::HasVisualStateGroupsDefined(FrameworkElement const &frameworkElement) { - return frameworkElement != nullptr && VisualStateManager::GetVisualStateGroups(frameworkElement)->Size != 0; + return frameworkElement != nullptr && VisualStateManager::GetVisualStateGroups(frameworkElement).Size() != 0; } -bool VisualStateUtilities::ShouldContinueTreeWalk(FrameworkElement^ element) +bool VisualStateUtilities::ShouldContinueTreeWalk(FrameworkElement const &element) { - if (element == nullptr || dynamic_cast(element) != nullptr) - { - return false; - } - else if (element->Parent == nullptr) - { - // Stop if parent's parent is null AND parent isn't the template root of a ControlTemplate or DataTemplate - FrameworkElement^ templatedParent = dynamic_cast(VisualTreeHelper::GetParent(element)); - if (templatedParent == nullptr || (!(dynamic_cast(element) != nullptr) && !(dynamic_cast(element) != nullptr))) - { - return false; - } - } - - return true; + if (element == nullptr || element.try_as() != nullptr) + { + return false; + } + else if (element.Parent() == nullptr) + { + // Stop if parent's parent is null AND parent isn't the template root of a ControlTemplate or DataTemplate + auto templatedParent = VisualTreeHelper::GetParent(element).try_as(); + if (templatedParent == nullptr || (!(element.try_as() != nullptr) && !(element.try_as() != nullptr))) + { + return false; + } + } + + return true; } + +} // namespace winrt::Microsoft::Xaml::Interactivity::implementation diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/VisualStateUtilities.h b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/VisualStateUtilities.h index 8cb32fa3..2524c40a 100644 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/VisualStateUtilities.h +++ b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/VisualStateUtilities.h @@ -1,48 +1,49 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma once +#include "VisualStateUtilities.g.h" -namespace Microsoft { namespace Xaml { namespace Interactivity +namespace winrt::Microsoft::Xaml::Interactivity::implementation { - /// - /// Provides various standard operations for working with . - /// - [::Windows::Foundation::Metadata::WebHostHiddenAttribute] - public ref class VisualStateUtilities sealed - { - private: - VisualStateUtilities(); - - public: - /// - /// Find the nearest parent which contains visual states. - /// - /// The from which to find the nearest stateful control. - /// The nearest that contains visual states; else null. - /// is null. - static ::Windows::UI::Xaml::Controls::Control^ FindNearestStatefulControl(::Windows::UI::Xaml::FrameworkElement^ element); - - /// - /// Transitions the control between two states. - /// - /// The to transition between states. - /// The state to transition to. - /// True to use a to transition between states; otherwise, false. - /// True if the is successfully transitioned to the new state; otherwise, false. - /// or is null. - static bool GoToState(::Windows::UI::Xaml::Controls::Control^ control, ::Platform::String^ stateName, bool useTransitions); +/// +/// Provides various standard operations for working with . +/// +struct VisualStateUtilities : VisualStateUtilitiesT +{ + /// + /// Find the nearest parent which contains visual states. + /// + /// The from which to find the nearest stateful control. + /// The nearest that contains visual states; else null. + /// is null. + static Windows::UI::Xaml::Controls::Control FindNearestStatefulControl(Windows::UI::Xaml::FrameworkElement const &element); - /// - /// Gets the value of the VisualStateManager.VisualStateGroups attached property. - /// - /// The from which to get the VisualStateManager.VisualStateGroups. - /// The list of VisualStateGroups in the given element. - /// is null. - static ::Windows::Foundation::Collections::IVector<::Windows::UI::Xaml::VisualStateGroup^>^ GetVisualStateGroups(::Windows::UI::Xaml::FrameworkElement^ element); + /// + /// Transitions the control between two states. + /// + /// The to transition between states. + /// The state to transition to. + /// True to use a to transition between states; otherwise, false. + /// True if the is successfully transitioned to the new state; otherwise, false. + /// or is null. + static bool GoToState(Windows::UI::Xaml::Controls::Control const &control, hstring const &stateName, bool useTransitions); - private: - static bool HasVisualStateGroupsDefined(::Windows::UI::Xaml::FrameworkElement^ element); - static bool ShouldContinueTreeWalk(::Windows::UI::Xaml::FrameworkElement^ element); - }; + /// + /// Gets the value of the VisualStateManager.VisualStateGroups attached property. + /// + /// The from which to get the VisualStateManager.VisualStateGroups. + /// The list of VisualStateGroups in the given element. + /// is null. + static Windows::Foundation::Collections::IVector GetVisualStateGroups(Windows::UI::Xaml::FrameworkElement const &element); -}}} \ No newline at end of file +private: + static bool HasVisualStateGroupsDefined(Windows::UI::Xaml::FrameworkElement const &element); + static bool ShouldContinueTreeWalk(Windows::UI::Xaml::FrameworkElement const &element); +}; +} // namespace winrt::Microsoft::Xaml::Interactivity::implementation +namespace winrt::Microsoft::Xaml::Interactivity::factory_implementation +{ +struct VisualStateUtilities : VisualStateUtilitiesT +{ +}; +} // namespace winrt::Microsoft::Xaml::Interactivity::factory_implementation diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/packages.config b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/packages.config index b1b8f09e..85e9d465 100644 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/packages.config +++ b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/pch.h b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/pch.h index aeef7725..daf35be1 100644 --- a/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/pch.h +++ b/src/BehaviorsSDKNative/Microsoft.Xaml.Interactivity/pch.h @@ -6,5 +6,15 @@ // #pragma once -#include -#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include \ No newline at end of file diff --git a/src/BehaviorsSDKNative/NativeUnitTests/NativeUnitTests.csproj b/src/BehaviorsSDKNative/NativeUnitTests/NativeUnitTests.csproj index 5643cde3..8921c461 100644 --- a/src/BehaviorsSDKNative/NativeUnitTests/NativeUnitTests.csproj +++ b/src/BehaviorsSDKNative/NativeUnitTests/NativeUnitTests.csproj @@ -11,13 +11,14 @@ NativeUnitTests en-US UAP - 10.0.10586.0 + 10.0.18362.0 10.0.10240.0 14 512 false {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14.0 + win10-arm;win10-arm-aot;win10-x86;win10-x86-aot;win10-x64;win10-x64-aot true @@ -90,7 +91,6 @@ - @@ -135,6 +135,11 @@ + + + 5.0.0 + + 14.0 diff --git a/src/BehaviorsSDKNative/NativeUnitTests/project.json b/src/BehaviorsSDKNative/NativeUnitTests/project.json deleted file mode 100644 index c5949392..00000000 --- a/src/BehaviorsSDKNative/NativeUnitTests/project.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "dependencies": { - "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0" - }, - "frameworks": { - "uap10.0": {} - }, - "runtimes": { - "win10-arm": {}, - "win10-arm-aot": {}, - "win10-x86": {}, - "win10-x86-aot": {}, - "win10-x64": {}, - "win10-x64-aot": {} - } -} \ No newline at end of file