// Copyright (c) The NodeRT Contributors
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the ""License""); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED ON AN  *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing permissions
// and limitations under the License.

// TODO: Verify that this is is still needed..
#define NTDDI_VERSION 0x06010000

#include <v8.h>
#include "nan.h"
#include <string>
#include <ppltasks.h>
#include "CollectionsConverter.h"
#include "CollectionsWrap.h"
#include "node-async.h"
#include "NodeRtUtils.h"
#include "OpaqueWrapper.h"
#include "WrapperBase.h"

#using <Windows.WinMD>

// this undefs fixes the issues of compiling Windows.Data.Json, Windows.Storag.FileProperties, and Windows.Stroage.Search
// Some of the node header files brings windows definitions with the same names as some of the WinRT methods
#undef DocumentProperties
#undef GetObject
#undef CreateEvent
#undef FindText
#undef SendMessage

const char* REGISTRATION_TOKEN_MAP_PROPERTY_NAME = "__registrationTokenMap__";

using v8::Array;
using v8::String;
using v8::Value;
using v8::Boolean;
using v8::Integer;
using v8::FunctionTemplate;
using v8::Object;
using v8::Local;
using v8::Function;
using v8::Date;
using v8::Number;
using v8::PropertyAttribute;
using v8::Primitive;
using Nan::HandleScope;
using Nan::Persistent;
using Nan::Undefined;
using Nan::True;
using Nan::False;
using Nan::Null;
using Nan::MaybeLocal;
using Nan::EscapableHandleScope;
using Nan::HandleScope;
using Nan::TryCatch;
using namespace concurrency;

namespace NodeRT { namespace Windows { namespace ApplicationModel { namespace Background { 
  v8::Local<v8::Value> WrapAlarmApplicationManager(::Windows::ApplicationModel::Background::AlarmApplicationManager^ wintRtInstance);
  ::Windows::ApplicationModel::Background::AlarmApplicationManager^ UnwrapAlarmApplicationManager(Local<Value> value);
  
  v8::Local<v8::Value> WrapPhoneTrigger(::Windows::ApplicationModel::Background::PhoneTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::PhoneTrigger^ UnwrapPhoneTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapCommunicationBlockingAppSetAsActiveTrigger(::Windows::ApplicationModel::Background::CommunicationBlockingAppSetAsActiveTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::CommunicationBlockingAppSetAsActiveTrigger^ UnwrapCommunicationBlockingAppSetAsActiveTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapSmartCardTrigger(::Windows::ApplicationModel::Background::SmartCardTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::SmartCardTrigger^ UnwrapSmartCardTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapApplicationTrigger(::Windows::ApplicationModel::Background::ApplicationTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::ApplicationTrigger^ UnwrapApplicationTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapApplicationTriggerDetails(::Windows::ApplicationModel::Background::ApplicationTriggerDetails^ wintRtInstance);
  ::Windows::ApplicationModel::Background::ApplicationTriggerDetails^ UnwrapApplicationTriggerDetails(Local<Value> value);
  
  v8::Local<v8::Value> WrapMediaProcessingTrigger(::Windows::ApplicationModel::Background::MediaProcessingTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::MediaProcessingTrigger^ UnwrapMediaProcessingTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapContentPrefetchTrigger(::Windows::ApplicationModel::Background::ContentPrefetchTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::ContentPrefetchTrigger^ UnwrapContentPrefetchTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapSecondaryAuthenticationFactorAuthenticationTrigger(::Windows::ApplicationModel::Background::SecondaryAuthenticationFactorAuthenticationTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::SecondaryAuthenticationFactorAuthenticationTrigger^ UnwrapSecondaryAuthenticationFactorAuthenticationTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapSystemTrigger(::Windows::ApplicationModel::Background::SystemTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::SystemTrigger^ UnwrapSystemTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapSystemCondition(::Windows::ApplicationModel::Background::SystemCondition^ wintRtInstance);
  ::Windows::ApplicationModel::Background::SystemCondition^ UnwrapSystemCondition(Local<Value> value);
  
  v8::Local<v8::Value> WrapNetworkOperatorNotificationTrigger(::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger^ UnwrapNetworkOperatorNotificationTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapDeviceManufacturerNotificationTrigger(::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^ UnwrapDeviceManufacturerNotificationTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapCachedFileUpdaterTriggerDetails(::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^ wintRtInstance);
  ::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^ UnwrapCachedFileUpdaterTriggerDetails(Local<Value> value);
  
  v8::Local<v8::Value> WrapCachedFileUpdaterTrigger(::Windows::ApplicationModel::Background::CachedFileUpdaterTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::CachedFileUpdaterTrigger^ UnwrapCachedFileUpdaterTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapTimeTrigger(::Windows::ApplicationModel::Background::TimeTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::TimeTrigger^ UnwrapTimeTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapMaintenanceTrigger(::Windows::ApplicationModel::Background::MaintenanceTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::MaintenanceTrigger^ UnwrapMaintenanceTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapAppointmentStoreNotificationTrigger(::Windows::ApplicationModel::Background::AppointmentStoreNotificationTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::AppointmentStoreNotificationTrigger^ UnwrapAppointmentStoreNotificationTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapBackgroundExecutionManager(::Windows::ApplicationModel::Background::BackgroundExecutionManager^ wintRtInstance);
  ::Windows::ApplicationModel::Background::BackgroundExecutionManager^ UnwrapBackgroundExecutionManager(Local<Value> value);
  
  v8::Local<v8::Value> WrapIBackgroundTaskInstance(::Windows::ApplicationModel::Background::IBackgroundTaskInstance^ wintRtInstance);
  ::Windows::ApplicationModel::Background::IBackgroundTaskInstance^ UnwrapIBackgroundTaskInstance(Local<Value> value);
  
  v8::Local<v8::Value> WrapBackgroundTaskRegistration(::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ wintRtInstance);
  ::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ UnwrapBackgroundTaskRegistration(Local<Value> value);
  
  v8::Local<v8::Value> WrapBackgroundTaskDeferral(::Windows::ApplicationModel::Background::BackgroundTaskDeferral^ wintRtInstance);
  ::Windows::ApplicationModel::Background::BackgroundTaskDeferral^ UnwrapBackgroundTaskDeferral(Local<Value> value);
  
  v8::Local<v8::Value> WrapBackgroundTaskProgressEventArgs(::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^ wintRtInstance);
  ::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^ UnwrapBackgroundTaskProgressEventArgs(Local<Value> value);
  
  v8::Local<v8::Value> WrapBackgroundTaskCompletedEventArgs(::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^ wintRtInstance);
  ::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^ UnwrapBackgroundTaskCompletedEventArgs(Local<Value> value);
  
  v8::Local<v8::Value> WrapIBackgroundTaskInstance2(::Windows::ApplicationModel::Background::IBackgroundTaskInstance2^ wintRtInstance);
  ::Windows::ApplicationModel::Background::IBackgroundTaskInstance2^ UnwrapIBackgroundTaskInstance2(Local<Value> value);
  
  v8::Local<v8::Value> WrapIBackgroundTaskInstance4(::Windows::ApplicationModel::Background::IBackgroundTaskInstance4^ wintRtInstance);
  ::Windows::ApplicationModel::Background::IBackgroundTaskInstance4^ UnwrapIBackgroundTaskInstance4(Local<Value> value);
  
  v8::Local<v8::Value> WrapIBackgroundTask(::Windows::ApplicationModel::Background::IBackgroundTask^ wintRtInstance);
  ::Windows::ApplicationModel::Background::IBackgroundTask^ UnwrapIBackgroundTask(Local<Value> value);
  
  v8::Local<v8::Value> WrapIBackgroundTaskRegistration(::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^ wintRtInstance);
  ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^ UnwrapIBackgroundTaskRegistration(Local<Value> value);
  
  v8::Local<v8::Value> WrapIBackgroundTaskRegistration2(::Windows::ApplicationModel::Background::IBackgroundTaskRegistration2^ wintRtInstance);
  ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration2^ UnwrapIBackgroundTaskRegistration2(Local<Value> value);
  
  v8::Local<v8::Value> WrapIBackgroundTrigger(::Windows::ApplicationModel::Background::IBackgroundTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::IBackgroundTrigger^ UnwrapIBackgroundTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapIBackgroundTaskRegistration3(::Windows::ApplicationModel::Background::IBackgroundTaskRegistration3^ wintRtInstance);
  ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration3^ UnwrapIBackgroundTaskRegistration3(Local<Value> value);
  
  v8::Local<v8::Value> WrapBackgroundTaskRegistrationGroup(::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ wintRtInstance);
  ::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ UnwrapBackgroundTaskRegistrationGroup(Local<Value> value);
  
  v8::Local<v8::Value> WrapIBackgroundCondition(::Windows::ApplicationModel::Background::IBackgroundCondition^ wintRtInstance);
  ::Windows::ApplicationModel::Background::IBackgroundCondition^ UnwrapIBackgroundCondition(Local<Value> value);
  
  v8::Local<v8::Value> WrapBackgroundTaskBuilder(::Windows::ApplicationModel::Background::BackgroundTaskBuilder^ wintRtInstance);
  ::Windows::ApplicationModel::Background::BackgroundTaskBuilder^ UnwrapBackgroundTaskBuilder(Local<Value> value);
  
  v8::Local<v8::Value> WrapBackgroundWorkCost(::Windows::ApplicationModel::Background::BackgroundWorkCost^ wintRtInstance);
  ::Windows::ApplicationModel::Background::BackgroundWorkCost^ UnwrapBackgroundWorkCost(Local<Value> value);
  
  v8::Local<v8::Value> WrapChatMessageNotificationTrigger(::Windows::ApplicationModel::Background::ChatMessageNotificationTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::ChatMessageNotificationTrigger^ UnwrapChatMessageNotificationTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapChatMessageReceivedNotificationTrigger(::Windows::ApplicationModel::Background::ChatMessageReceivedNotificationTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::ChatMessageReceivedNotificationTrigger^ UnwrapChatMessageReceivedNotificationTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapRcsEndUserMessageAvailableTrigger(::Windows::ApplicationModel::Background::RcsEndUserMessageAvailableTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::RcsEndUserMessageAvailableTrigger^ UnwrapRcsEndUserMessageAvailableTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapContactStoreNotificationTrigger(::Windows::ApplicationModel::Background::ContactStoreNotificationTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::ContactStoreNotificationTrigger^ UnwrapContactStoreNotificationTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapEmailStoreNotificationTrigger(::Windows::ApplicationModel::Background::EmailStoreNotificationTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::EmailStoreNotificationTrigger^ UnwrapEmailStoreNotificationTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapMobileBroadbandRegistrationStateChangeTrigger(::Windows::ApplicationModel::Background::MobileBroadbandRegistrationStateChangeTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::MobileBroadbandRegistrationStateChangeTrigger^ UnwrapMobileBroadbandRegistrationStateChangeTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapMobileBroadbandRadioStateChangeTrigger(::Windows::ApplicationModel::Background::MobileBroadbandRadioStateChangeTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::MobileBroadbandRadioStateChangeTrigger^ UnwrapMobileBroadbandRadioStateChangeTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapMobileBroadbandPinLockStateChangeTrigger(::Windows::ApplicationModel::Background::MobileBroadbandPinLockStateChangeTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::MobileBroadbandPinLockStateChangeTrigger^ UnwrapMobileBroadbandPinLockStateChangeTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapMobileBroadbandDeviceServiceNotificationTrigger(::Windows::ApplicationModel::Background::MobileBroadbandDeviceServiceNotificationTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::MobileBroadbandDeviceServiceNotificationTrigger^ UnwrapMobileBroadbandDeviceServiceNotificationTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapSmsMessageReceivedTrigger(::Windows::ApplicationModel::Background::SmsMessageReceivedTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::SmsMessageReceivedTrigger^ UnwrapSmsMessageReceivedTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapStorageLibraryContentChangedTrigger(::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^ UnwrapStorageLibraryContentChangedTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapDeviceUseTrigger(::Windows::ApplicationModel::Background::DeviceUseTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::DeviceUseTrigger^ UnwrapDeviceUseTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapDeviceServicingTrigger(::Windows::ApplicationModel::Background::DeviceServicingTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::DeviceServicingTrigger^ UnwrapDeviceServicingTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapRfcommConnectionTrigger(::Windows::ApplicationModel::Background::RfcommConnectionTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::RfcommConnectionTrigger^ UnwrapRfcommConnectionTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapDeviceConnectionChangeTrigger(::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^ UnwrapDeviceConnectionChangeTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapGattCharacteristicNotificationTrigger(::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^ UnwrapGattCharacteristicNotificationTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapGattServiceProviderTrigger(::Windows::ApplicationModel::Background::GattServiceProviderTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::GattServiceProviderTrigger^ UnwrapGattServiceProviderTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapGattServiceProviderTriggerResult(::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^ wintRtInstance);
  ::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^ UnwrapGattServiceProviderTriggerResult(Local<Value> value);
  
  v8::Local<v8::Value> WrapBluetoothLEAdvertisementWatcherTrigger(::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^ UnwrapBluetoothLEAdvertisementWatcherTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapBluetoothLEAdvertisementPublisherTrigger(::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger^ UnwrapBluetoothLEAdvertisementPublisherTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapDeviceWatcherTrigger(::Windows::ApplicationModel::Background::DeviceWatcherTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::DeviceWatcherTrigger^ UnwrapDeviceWatcherTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapLocationTrigger(::Windows::ApplicationModel::Background::LocationTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::LocationTrigger^ UnwrapLocationTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapActivitySensorTrigger(::Windows::ApplicationModel::Background::ActivitySensorTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::ActivitySensorTrigger^ UnwrapActivitySensorTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapSensorDataThresholdTrigger(::Windows::ApplicationModel::Background::SensorDataThresholdTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::SensorDataThresholdTrigger^ UnwrapSensorDataThresholdTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapNetworkOperatorHotspotAuthenticationTrigger(::Windows::ApplicationModel::Background::NetworkOperatorHotspotAuthenticationTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::NetworkOperatorHotspotAuthenticationTrigger^ UnwrapNetworkOperatorHotspotAuthenticationTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapSocketActivityTrigger(::Windows::ApplicationModel::Background::SocketActivityTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::SocketActivityTrigger^ UnwrapSocketActivityTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapPushNotificationTrigger(::Windows::ApplicationModel::Background::PushNotificationTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::PushNotificationTrigger^ UnwrapPushNotificationTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapToastNotificationHistoryChangedTrigger(::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger^ UnwrapToastNotificationHistoryChangedTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapToastNotificationActionTrigger(::Windows::ApplicationModel::Background::ToastNotificationActionTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::ToastNotificationActionTrigger^ UnwrapToastNotificationActionTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapUserNotificationChangedTrigger(::Windows::ApplicationModel::Background::UserNotificationChangedTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::UserNotificationChangedTrigger^ UnwrapUserNotificationChangedTrigger(Local<Value> value);
  
  v8::Local<v8::Value> WrapAppBroadcastTriggerProviderInfo(::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^ wintRtInstance);
  ::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^ UnwrapAppBroadcastTriggerProviderInfo(Local<Value> value);
  
  v8::Local<v8::Value> WrapAppBroadcastTrigger(::Windows::ApplicationModel::Background::AppBroadcastTrigger^ wintRtInstance);
  ::Windows::ApplicationModel::Background::AppBroadcastTrigger^ UnwrapAppBroadcastTrigger(Local<Value> value);
  



  static void InitAlarmAccessStatusEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("AlarmAccessStatus").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("unspecified").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::AlarmAccessStatus::Unspecified)));
    Nan::Set(enumObject, Nan::New<String>("allowedWithWakeupCapability").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::AlarmAccessStatus::AllowedWithWakeupCapability)));
    Nan::Set(enumObject, Nan::New<String>("allowedWithoutWakeupCapability").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::AlarmAccessStatus::AllowedWithoutWakeupCapability)));
    Nan::Set(enumObject, Nan::New<String>("denied").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::AlarmAccessStatus::Denied)));
  }

  static void InitApplicationTriggerResultEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("ApplicationTriggerResult").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("allowed").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::ApplicationTriggerResult::Allowed)));
    Nan::Set(enumObject, Nan::New<String>("currentlyRunning").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::ApplicationTriggerResult::CurrentlyRunning)));
    Nan::Set(enumObject, Nan::New<String>("disabledByPolicy").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::ApplicationTriggerResult::DisabledByPolicy)));
    Nan::Set(enumObject, Nan::New<String>("unknownError").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::ApplicationTriggerResult::UnknownError)));
  }

  static void InitMediaProcessingTriggerResultEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("MediaProcessingTriggerResult").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("allowed").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::MediaProcessingTriggerResult::Allowed)));
    Nan::Set(enumObject, Nan::New<String>("currentlyRunning").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::MediaProcessingTriggerResult::CurrentlyRunning)));
    Nan::Set(enumObject, Nan::New<String>("disabledByPolicy").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::MediaProcessingTriggerResult::DisabledByPolicy)));
    Nan::Set(enumObject, Nan::New<String>("unknownError").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::MediaProcessingTriggerResult::UnknownError)));
  }

  static void InitSystemTriggerTypeEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("SystemTriggerType").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("invalid").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::Invalid)));
    Nan::Set(enumObject, Nan::New<String>("smsReceived").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::SmsReceived)));
    Nan::Set(enumObject, Nan::New<String>("userPresent").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::UserPresent)));
    Nan::Set(enumObject, Nan::New<String>("userAway").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::UserAway)));
    Nan::Set(enumObject, Nan::New<String>("networkStateChange").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::NetworkStateChange)));
    Nan::Set(enumObject, Nan::New<String>("controlChannelReset").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::ControlChannelReset)));
    Nan::Set(enumObject, Nan::New<String>("internetAvailable").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::InternetAvailable)));
    Nan::Set(enumObject, Nan::New<String>("sessionConnected").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::SessionConnected)));
    Nan::Set(enumObject, Nan::New<String>("servicingComplete").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::ServicingComplete)));
    Nan::Set(enumObject, Nan::New<String>("lockScreenApplicationAdded").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::LockScreenApplicationAdded)));
    Nan::Set(enumObject, Nan::New<String>("lockScreenApplicationRemoved").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::LockScreenApplicationRemoved)));
    Nan::Set(enumObject, Nan::New<String>("timeZoneChange").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::TimeZoneChange)));
    Nan::Set(enumObject, Nan::New<String>("onlineIdConnectedStateChange").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::OnlineIdConnectedStateChange)));
    Nan::Set(enumObject, Nan::New<String>("backgroundWorkCostChange").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::BackgroundWorkCostChange)));
    Nan::Set(enumObject, Nan::New<String>("powerStateChange").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::PowerStateChange)));
    Nan::Set(enumObject, Nan::New<String>("defaultSignInAccountChange").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemTriggerType::DefaultSignInAccountChange)));
  }

  static void InitSystemConditionTypeEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("SystemConditionType").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("invalid").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemConditionType::Invalid)));
    Nan::Set(enumObject, Nan::New<String>("userPresent").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemConditionType::UserPresent)));
    Nan::Set(enumObject, Nan::New<String>("userNotPresent").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemConditionType::UserNotPresent)));
    Nan::Set(enumObject, Nan::New<String>("internetAvailable").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemConditionType::InternetAvailable)));
    Nan::Set(enumObject, Nan::New<String>("internetNotAvailable").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemConditionType::InternetNotAvailable)));
    Nan::Set(enumObject, Nan::New<String>("sessionConnected").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemConditionType::SessionConnected)));
    Nan::Set(enumObject, Nan::New<String>("sessionDisconnected").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemConditionType::SessionDisconnected)));
    Nan::Set(enumObject, Nan::New<String>("freeNetworkAvailable").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemConditionType::FreeNetworkAvailable)));
    Nan::Set(enumObject, Nan::New<String>("backgroundWorkCostNotHigh").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::SystemConditionType::BackgroundWorkCostNotHigh)));
  }

  static void InitBackgroundAccessStatusEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("BackgroundAccessStatus").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("unspecified").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundAccessStatus::Unspecified)));
    Nan::Set(enumObject, Nan::New<String>("allowedWithAlwaysOnRealTimeConnectivity").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundAccessStatus::AllowedWithAlwaysOnRealTimeConnectivity)));
    Nan::Set(enumObject, Nan::New<String>("allowedMayUseActiveRealTimeConnectivity").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundAccessStatus::AllowedMayUseActiveRealTimeConnectivity)));
    Nan::Set(enumObject, Nan::New<String>("denied").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundAccessStatus::Denied)));
    Nan::Set(enumObject, Nan::New<String>("alwaysAllowed").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundAccessStatus::AlwaysAllowed)));
    Nan::Set(enumObject, Nan::New<String>("allowedSubjectToSystemPolicy").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundAccessStatus::AllowedSubjectToSystemPolicy)));
    Nan::Set(enumObject, Nan::New<String>("deniedBySystemPolicy").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundAccessStatus::DeniedBySystemPolicy)));
    Nan::Set(enumObject, Nan::New<String>("deniedByUser").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundAccessStatus::DeniedByUser)));
  }

  static void InitBackgroundTaskCancellationReasonEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("BackgroundTaskCancellationReason").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("abort").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundTaskCancellationReason::Abort)));
    Nan::Set(enumObject, Nan::New<String>("terminating").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundTaskCancellationReason::Terminating)));
    Nan::Set(enumObject, Nan::New<String>("loggingOff").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundTaskCancellationReason::LoggingOff)));
    Nan::Set(enumObject, Nan::New<String>("servicingUpdate").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundTaskCancellationReason::ServicingUpdate)));
    Nan::Set(enumObject, Nan::New<String>("idleTask").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundTaskCancellationReason::IdleTask)));
    Nan::Set(enumObject, Nan::New<String>("uninstall").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundTaskCancellationReason::Uninstall)));
    Nan::Set(enumObject, Nan::New<String>("conditionLoss").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundTaskCancellationReason::ConditionLoss)));
    Nan::Set(enumObject, Nan::New<String>("systemPolicy").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundTaskCancellationReason::SystemPolicy)));
    Nan::Set(enumObject, Nan::New<String>("quietHoursEntered").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundTaskCancellationReason::QuietHoursEntered)));
    Nan::Set(enumObject, Nan::New<String>("executionTimeExceeded").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundTaskCancellationReason::ExecutionTimeExceeded)));
    Nan::Set(enumObject, Nan::New<String>("resourceRevocation").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundTaskCancellationReason::ResourceRevocation)));
    Nan::Set(enumObject, Nan::New<String>("energySaver").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundTaskCancellationReason::EnergySaver)));
  }

  static void InitBackgroundWorkCostValueEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("BackgroundWorkCostValue").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("low").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundWorkCostValue::Low)));
    Nan::Set(enumObject, Nan::New<String>("medium").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundWorkCostValue::Medium)));
    Nan::Set(enumObject, Nan::New<String>("high").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundWorkCostValue::High)));
  }

  static void InitBackgroundTaskThrottleCounterEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("BackgroundTaskThrottleCounter").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("all").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundTaskThrottleCounter::All)));
    Nan::Set(enumObject, Nan::New<String>("cpu").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundTaskThrottleCounter::Cpu)));
    Nan::Set(enumObject, Nan::New<String>("network").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::BackgroundTaskThrottleCounter::Network)));
  }

  static void InitDeviceTriggerResultEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("DeviceTriggerResult").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("allowed").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::DeviceTriggerResult::Allowed)));
    Nan::Set(enumObject, Nan::New<String>("deniedByUser").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::DeviceTriggerResult::DeniedByUser)));
    Nan::Set(enumObject, Nan::New<String>("deniedBySystem").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::DeviceTriggerResult::DeniedBySystem)));
    Nan::Set(enumObject, Nan::New<String>("lowBattery").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::DeviceTriggerResult::LowBattery)));
  }

  static void InitLocationTriggerTypeEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("LocationTriggerType").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("geofence").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::ApplicationModel::Background::LocationTriggerType::Geofence)));
  }

  static bool IsBackgroundAlarmApplicationContractJsObject(Local<Value> value) {
    if (!value->IsObject()) {
      return false;
    }

    Local<String> symbol;
    Local<Object> obj = Nan::To<Object>(value).ToLocalChecked();

    return true;
  }

  ::Windows::ApplicationModel::Background::BackgroundAlarmApplicationContract BackgroundAlarmApplicationContractFromJsObject(Local<Value> value) {
    HandleScope scope;
    ::Windows::ApplicationModel::Background::BackgroundAlarmApplicationContract returnValue;

    if (!value->IsObject()) {
      Nan::ThrowError(Nan::TypeError(NodeRT::Utils::NewString(L"Unexpected type, expected an object")));
      return returnValue;
    }

    Local<Object> obj = Nan::To<Object>(value).ToLocalChecked();
    Local<String> symbol;

    return returnValue;
  }

  Local<Value> BackgroundAlarmApplicationContractToJsObject(::Windows::ApplicationModel::Background::BackgroundAlarmApplicationContract value) {
    EscapableHandleScope scope;

    Local<Object> obj = Nan::New<Object>();


    return scope.Escape(obj);
  }


  class AlarmApplicationManager : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("AlarmApplicationManager").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);

        Local<Function> func;
        Local<FunctionTemplate> funcTemplate;





        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);

        Nan::SetMethod(constructor, "getAccessStatus", GetAccessStatus);
        func = Nan::GetFunction(Nan::New<FunctionTemplate>(RequestAccessAsync)).ToLocalChecked();
        Nan::Set(constructor, Nan::New<String>("requestAccessAsync").ToLocalChecked(), func);


        Nan::Set(exports, Nan::New<String>("AlarmApplicationManager").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      AlarmApplicationManager(::Windows::ApplicationModel::Background::AlarmApplicationManager^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::AlarmApplicationManager^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AlarmApplicationManager^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::AlarmApplicationManager^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      AlarmApplicationManager *wrapperInstance = new AlarmApplicationManager(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AlarmApplicationManager^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::AlarmApplicationManager^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::AlarmApplicationManager^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapAlarmApplicationManager(winRtInstance));
    }




    static void RequestAccessAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      ::Windows::Foundation::IAsyncOperation<::Windows::ApplicationModel::Background::AlarmAccessStatus>^ op;


      if (info.Length() == 1)
      {
        try
        {
          op = ::Windows::ApplicationModel::Background::AlarmApplicationManager::RequestAccessAsync();
        } catch (Platform::Exception ^exception) {
            NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
            return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<::Windows::ApplicationModel::Background::AlarmAccessStatus> t)
      {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = Nan::New<Integer>(static_cast<int>(result));
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        }
        catch (Platform::Exception^ exception)
        {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {

            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }


    static void GetAccessStatus(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 0)
      {
        try
        {
          ::Windows::ApplicationModel::Background::AlarmAccessStatus result;
          result = ::Windows::ApplicationModel::Background::AlarmApplicationManager::GetAccessStatus();
          info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    private:
      ::Windows::ApplicationModel::Background::AlarmApplicationManager^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapAlarmApplicationManager(::Windows::ApplicationModel::Background::AlarmApplicationManager^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::AlarmApplicationManager^ UnwrapAlarmApplicationManager(Local<Value> value);
  };

  Persistent<FunctionTemplate> AlarmApplicationManager::s_constructorTemplate;

  v8::Local<v8::Value> WrapAlarmApplicationManager(::Windows::ApplicationModel::Background::AlarmApplicationManager^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(AlarmApplicationManager::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::AlarmApplicationManager^ UnwrapAlarmApplicationManager(Local<Value> value) {
     return AlarmApplicationManager::Unwrap<AlarmApplicationManager>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitAlarmApplicationManager(Local<Object> exports) {
    AlarmApplicationManager::Init(exports);
  }

  class PhoneTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("PhoneTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("oneShot").ToLocalChecked(), OneShotGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("triggerType").ToLocalChecked(), TriggerTypeGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("PhoneTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      PhoneTrigger(::Windows::ApplicationModel::Background::PhoneTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::PhoneTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::PhoneTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::PhoneTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 2
        && info[0]->IsInt32()
        && info[1]->IsBoolean())
      {
        try {
          ::Windows::ApplicationModel::Calls::Background::PhoneTriggerType arg0 = static_cast<::Windows::ApplicationModel::Calls::Background::PhoneTriggerType>(Nan::To<int32_t>(info[0]).FromMaybe(0));
          bool arg1 = Nan::To<bool>(info[1]).FromMaybe(false);
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::PhoneTrigger(arg0,arg1);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      PhoneTrigger *wrapperInstance = new PhoneTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::PhoneTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::PhoneTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::PhoneTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapPhoneTrigger(winRtInstance));
    }





    static void OneShotGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::PhoneTrigger^>(info.This())) {
        return;
      }

      PhoneTrigger *wrapper = PhoneTrigger::Unwrap<PhoneTrigger>(info.This());

      try  {
        bool result = wrapper->_instance->OneShot;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void TriggerTypeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::PhoneTrigger^>(info.This())) {
        return;
      }

      PhoneTrigger *wrapper = PhoneTrigger::Unwrap<PhoneTrigger>(info.This());

      try  {
        ::Windows::ApplicationModel::Calls::Background::PhoneTriggerType result = wrapper->_instance->TriggerType;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::PhoneTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapPhoneTrigger(::Windows::ApplicationModel::Background::PhoneTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::PhoneTrigger^ UnwrapPhoneTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> PhoneTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapPhoneTrigger(::Windows::ApplicationModel::Background::PhoneTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(PhoneTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::PhoneTrigger^ UnwrapPhoneTrigger(Local<Value> value) {
     return PhoneTrigger::Unwrap<PhoneTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitPhoneTrigger(Local<Object> exports) {
    PhoneTrigger::Init(exports);
  }

  class CommunicationBlockingAppSetAsActiveTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("CommunicationBlockingAppSetAsActiveTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("CommunicationBlockingAppSetAsActiveTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      CommunicationBlockingAppSetAsActiveTrigger(::Windows::ApplicationModel::Background::CommunicationBlockingAppSetAsActiveTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::CommunicationBlockingAppSetAsActiveTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::CommunicationBlockingAppSetAsActiveTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::CommunicationBlockingAppSetAsActiveTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::CommunicationBlockingAppSetAsActiveTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      CommunicationBlockingAppSetAsActiveTrigger *wrapperInstance = new CommunicationBlockingAppSetAsActiveTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::CommunicationBlockingAppSetAsActiveTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::CommunicationBlockingAppSetAsActiveTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::CommunicationBlockingAppSetAsActiveTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapCommunicationBlockingAppSetAsActiveTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::CommunicationBlockingAppSetAsActiveTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapCommunicationBlockingAppSetAsActiveTrigger(::Windows::ApplicationModel::Background::CommunicationBlockingAppSetAsActiveTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::CommunicationBlockingAppSetAsActiveTrigger^ UnwrapCommunicationBlockingAppSetAsActiveTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> CommunicationBlockingAppSetAsActiveTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapCommunicationBlockingAppSetAsActiveTrigger(::Windows::ApplicationModel::Background::CommunicationBlockingAppSetAsActiveTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(CommunicationBlockingAppSetAsActiveTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::CommunicationBlockingAppSetAsActiveTrigger^ UnwrapCommunicationBlockingAppSetAsActiveTrigger(Local<Value> value) {
     return CommunicationBlockingAppSetAsActiveTrigger::Unwrap<CommunicationBlockingAppSetAsActiveTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitCommunicationBlockingAppSetAsActiveTrigger(Local<Object> exports) {
    CommunicationBlockingAppSetAsActiveTrigger::Init(exports);
  }

  class SmartCardTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("SmartCardTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("triggerType").ToLocalChecked(), TriggerTypeGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("SmartCardTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      SmartCardTrigger(::Windows::ApplicationModel::Background::SmartCardTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::SmartCardTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SmartCardTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::SmartCardTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsInt32())
      {
        try {
          ::Windows::Devices::SmartCards::SmartCardTriggerType arg0 = static_cast<::Windows::Devices::SmartCards::SmartCardTriggerType>(Nan::To<int32_t>(info[0]).FromMaybe(0));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::SmartCardTrigger(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      SmartCardTrigger *wrapperInstance = new SmartCardTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SmartCardTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::SmartCardTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::SmartCardTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapSmartCardTrigger(winRtInstance));
    }





    static void TriggerTypeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SmartCardTrigger^>(info.This())) {
        return;
      }

      SmartCardTrigger *wrapper = SmartCardTrigger::Unwrap<SmartCardTrigger>(info.This());

      try  {
        ::Windows::Devices::SmartCards::SmartCardTriggerType result = wrapper->_instance->TriggerType;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::SmartCardTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapSmartCardTrigger(::Windows::ApplicationModel::Background::SmartCardTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::SmartCardTrigger^ UnwrapSmartCardTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> SmartCardTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapSmartCardTrigger(::Windows::ApplicationModel::Background::SmartCardTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(SmartCardTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::SmartCardTrigger^ UnwrapSmartCardTrigger(Local<Value> value) {
     return SmartCardTrigger::Unwrap<SmartCardTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitSmartCardTrigger(Local<Object> exports) {
    SmartCardTrigger::Init(exports);
  }

  class ApplicationTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("ApplicationTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);

        Local<Function> func;
        Local<FunctionTemplate> funcTemplate;


          
            Nan::SetPrototypeMethod(localRef, "requestAsync", RequestAsync);
          



        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("ApplicationTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      ApplicationTrigger(::Windows::ApplicationModel::Background::ApplicationTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::ApplicationTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ApplicationTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::ApplicationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::ApplicationTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      ApplicationTrigger *wrapperInstance = new ApplicationTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ApplicationTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::ApplicationTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::ApplicationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapApplicationTrigger(winRtInstance));
    }

    static void RequestAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ApplicationTrigger^>(info.This())) {
        return;
      }

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      ApplicationTrigger *wrapper = ApplicationTrigger::Unwrap<ApplicationTrigger>(info.This());

      ::Windows::Foundation::IAsyncOperation<::Windows::ApplicationModel::Background::ApplicationTriggerResult>^ op;


      if (info.Length() == 1)
      {
        try
        {
          op = wrapper->_instance->RequestAsync();
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 2
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Foundation::Collections::ValueSet^>(info[0]))
      {
        try
        {
          ::Windows::Foundation::Collections::ValueSet^ arg0 = dynamic_cast<::Windows::Foundation::Collections::ValueSet^>(NodeRT::Utils::GetObjectInstance(info[0]));
          
          op = wrapper->_instance->RequestAsync(arg0);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<::Windows::ApplicationModel::Background::ApplicationTriggerResult> t) {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = Nan::New<Integer>(static_cast<int>(result));
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        } catch (Platform::Exception^ exception) {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }






    private:
      ::Windows::ApplicationModel::Background::ApplicationTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapApplicationTrigger(::Windows::ApplicationModel::Background::ApplicationTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::ApplicationTrigger^ UnwrapApplicationTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> ApplicationTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapApplicationTrigger(::Windows::ApplicationModel::Background::ApplicationTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(ApplicationTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::ApplicationTrigger^ UnwrapApplicationTrigger(Local<Value> value) {
     return ApplicationTrigger::Unwrap<ApplicationTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitApplicationTrigger(Local<Object> exports) {
    ApplicationTrigger::Init(exports);
  }

  class ApplicationTriggerDetails : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("ApplicationTriggerDetails").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("arguments").ToLocalChecked(), ArgumentsGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("ApplicationTriggerDetails").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      ApplicationTriggerDetails(::Windows::ApplicationModel::Background::ApplicationTriggerDetails^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::ApplicationTriggerDetails^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ApplicationTriggerDetails^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::ApplicationTriggerDetails^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      ApplicationTriggerDetails *wrapperInstance = new ApplicationTriggerDetails(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ApplicationTriggerDetails^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::ApplicationTriggerDetails^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::ApplicationTriggerDetails^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapApplicationTriggerDetails(winRtInstance));
    }





    static void ArgumentsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ApplicationTriggerDetails^>(info.This())) {
        return;
      }

      ApplicationTriggerDetails *wrapper = ApplicationTriggerDetails::Unwrap<ApplicationTriggerDetails>(info.This());

      try  {
        ::Windows::Foundation::Collections::ValueSet^ result = wrapper->_instance->Arguments;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Foundation.Collections", "ValueSet", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::ApplicationTriggerDetails^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapApplicationTriggerDetails(::Windows::ApplicationModel::Background::ApplicationTriggerDetails^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::ApplicationTriggerDetails^ UnwrapApplicationTriggerDetails(Local<Value> value);
  };

  Persistent<FunctionTemplate> ApplicationTriggerDetails::s_constructorTemplate;

  v8::Local<v8::Value> WrapApplicationTriggerDetails(::Windows::ApplicationModel::Background::ApplicationTriggerDetails^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(ApplicationTriggerDetails::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::ApplicationTriggerDetails^ UnwrapApplicationTriggerDetails(Local<Value> value) {
     return ApplicationTriggerDetails::Unwrap<ApplicationTriggerDetails>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitApplicationTriggerDetails(Local<Object> exports) {
    ApplicationTriggerDetails::Init(exports);
  }

  class MediaProcessingTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("MediaProcessingTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);

        Local<Function> func;
        Local<FunctionTemplate> funcTemplate;


          
            Nan::SetPrototypeMethod(localRef, "requestAsync", RequestAsync);
          



        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("MediaProcessingTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      MediaProcessingTrigger(::Windows::ApplicationModel::Background::MediaProcessingTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::MediaProcessingTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::MediaProcessingTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::MediaProcessingTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::MediaProcessingTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      MediaProcessingTrigger *wrapperInstance = new MediaProcessingTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::MediaProcessingTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::MediaProcessingTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::MediaProcessingTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapMediaProcessingTrigger(winRtInstance));
    }

    static void RequestAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::MediaProcessingTrigger^>(info.This())) {
        return;
      }

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      MediaProcessingTrigger *wrapper = MediaProcessingTrigger::Unwrap<MediaProcessingTrigger>(info.This());

      ::Windows::Foundation::IAsyncOperation<::Windows::ApplicationModel::Background::MediaProcessingTriggerResult>^ op;


      if (info.Length() == 1)
      {
        try
        {
          op = wrapper->_instance->RequestAsync();
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 2
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Foundation::Collections::ValueSet^>(info[0]))
      {
        try
        {
          ::Windows::Foundation::Collections::ValueSet^ arg0 = dynamic_cast<::Windows::Foundation::Collections::ValueSet^>(NodeRT::Utils::GetObjectInstance(info[0]));
          
          op = wrapper->_instance->RequestAsync(arg0);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<::Windows::ApplicationModel::Background::MediaProcessingTriggerResult> t) {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = Nan::New<Integer>(static_cast<int>(result));
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        } catch (Platform::Exception^ exception) {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }






    private:
      ::Windows::ApplicationModel::Background::MediaProcessingTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapMediaProcessingTrigger(::Windows::ApplicationModel::Background::MediaProcessingTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::MediaProcessingTrigger^ UnwrapMediaProcessingTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> MediaProcessingTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapMediaProcessingTrigger(::Windows::ApplicationModel::Background::MediaProcessingTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(MediaProcessingTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::MediaProcessingTrigger^ UnwrapMediaProcessingTrigger(Local<Value> value) {
     return MediaProcessingTrigger::Unwrap<MediaProcessingTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitMediaProcessingTrigger(Local<Object> exports) {
    MediaProcessingTrigger::Init(exports);
  }

  class ContentPrefetchTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("ContentPrefetchTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("waitInterval").ToLocalChecked(), WaitIntervalGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("ContentPrefetchTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      ContentPrefetchTrigger(::Windows::ApplicationModel::Background::ContentPrefetchTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::ContentPrefetchTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ContentPrefetchTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::ContentPrefetchTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsNumber())
      {
        try {
          ::Windows::Foundation::TimeSpan arg0 = NodeRT::Utils::TimeSpanFromMilli(Nan::To<int64_t>(info[0]).FromMaybe(0));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::ContentPrefetchTrigger(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::ContentPrefetchTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      ContentPrefetchTrigger *wrapperInstance = new ContentPrefetchTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ContentPrefetchTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::ContentPrefetchTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::ContentPrefetchTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapContentPrefetchTrigger(winRtInstance));
    }





    static void WaitIntervalGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ContentPrefetchTrigger^>(info.This())) {
        return;
      }

      ContentPrefetchTrigger *wrapper = ContentPrefetchTrigger::Unwrap<ContentPrefetchTrigger>(info.This());

      try  {
        ::Windows::Foundation::TimeSpan result = wrapper->_instance->WaitInterval;
        info.GetReturnValue().Set(Nan::New<Number>(result.Duration/10000.0));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::ContentPrefetchTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapContentPrefetchTrigger(::Windows::ApplicationModel::Background::ContentPrefetchTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::ContentPrefetchTrigger^ UnwrapContentPrefetchTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> ContentPrefetchTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapContentPrefetchTrigger(::Windows::ApplicationModel::Background::ContentPrefetchTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(ContentPrefetchTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::ContentPrefetchTrigger^ UnwrapContentPrefetchTrigger(Local<Value> value) {
     return ContentPrefetchTrigger::Unwrap<ContentPrefetchTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitContentPrefetchTrigger(Local<Object> exports) {
    ContentPrefetchTrigger::Init(exports);
  }

  class SecondaryAuthenticationFactorAuthenticationTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("SecondaryAuthenticationFactorAuthenticationTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("SecondaryAuthenticationFactorAuthenticationTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      SecondaryAuthenticationFactorAuthenticationTrigger(::Windows::ApplicationModel::Background::SecondaryAuthenticationFactorAuthenticationTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::SecondaryAuthenticationFactorAuthenticationTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SecondaryAuthenticationFactorAuthenticationTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::SecondaryAuthenticationFactorAuthenticationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::SecondaryAuthenticationFactorAuthenticationTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      SecondaryAuthenticationFactorAuthenticationTrigger *wrapperInstance = new SecondaryAuthenticationFactorAuthenticationTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SecondaryAuthenticationFactorAuthenticationTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::SecondaryAuthenticationFactorAuthenticationTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::SecondaryAuthenticationFactorAuthenticationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapSecondaryAuthenticationFactorAuthenticationTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::SecondaryAuthenticationFactorAuthenticationTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapSecondaryAuthenticationFactorAuthenticationTrigger(::Windows::ApplicationModel::Background::SecondaryAuthenticationFactorAuthenticationTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::SecondaryAuthenticationFactorAuthenticationTrigger^ UnwrapSecondaryAuthenticationFactorAuthenticationTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> SecondaryAuthenticationFactorAuthenticationTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapSecondaryAuthenticationFactorAuthenticationTrigger(::Windows::ApplicationModel::Background::SecondaryAuthenticationFactorAuthenticationTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(SecondaryAuthenticationFactorAuthenticationTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::SecondaryAuthenticationFactorAuthenticationTrigger^ UnwrapSecondaryAuthenticationFactorAuthenticationTrigger(Local<Value> value) {
     return SecondaryAuthenticationFactorAuthenticationTrigger::Unwrap<SecondaryAuthenticationFactorAuthenticationTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitSecondaryAuthenticationFactorAuthenticationTrigger(Local<Object> exports) {
    SecondaryAuthenticationFactorAuthenticationTrigger::Init(exports);
  }

  class SystemTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("SystemTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("oneShot").ToLocalChecked(), OneShotGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("triggerType").ToLocalChecked(), TriggerTypeGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("SystemTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      SystemTrigger(::Windows::ApplicationModel::Background::SystemTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::SystemTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SystemTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::SystemTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 2
        && info[0]->IsInt32()
        && info[1]->IsBoolean())
      {
        try {
          ::Windows::ApplicationModel::Background::SystemTriggerType arg0 = static_cast<::Windows::ApplicationModel::Background::SystemTriggerType>(Nan::To<int32_t>(info[0]).FromMaybe(0));
          bool arg1 = Nan::To<bool>(info[1]).FromMaybe(false);
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::SystemTrigger(arg0,arg1);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      SystemTrigger *wrapperInstance = new SystemTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SystemTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::SystemTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::SystemTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapSystemTrigger(winRtInstance));
    }





    static void OneShotGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SystemTrigger^>(info.This())) {
        return;
      }

      SystemTrigger *wrapper = SystemTrigger::Unwrap<SystemTrigger>(info.This());

      try  {
        bool result = wrapper->_instance->OneShot;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void TriggerTypeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SystemTrigger^>(info.This())) {
        return;
      }

      SystemTrigger *wrapper = SystemTrigger::Unwrap<SystemTrigger>(info.This());

      try  {
        ::Windows::ApplicationModel::Background::SystemTriggerType result = wrapper->_instance->TriggerType;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::SystemTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapSystemTrigger(::Windows::ApplicationModel::Background::SystemTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::SystemTrigger^ UnwrapSystemTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> SystemTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapSystemTrigger(::Windows::ApplicationModel::Background::SystemTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(SystemTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::SystemTrigger^ UnwrapSystemTrigger(Local<Value> value) {
     return SystemTrigger::Unwrap<SystemTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitSystemTrigger(Local<Object> exports) {
    SystemTrigger::Init(exports);
  }

  class SystemCondition : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("SystemCondition").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("conditionType").ToLocalChecked(), ConditionTypeGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("SystemCondition").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      SystemCondition(::Windows::ApplicationModel::Background::SystemCondition^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::SystemCondition^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SystemCondition^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::SystemCondition^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsInt32())
      {
        try {
          ::Windows::ApplicationModel::Background::SystemConditionType arg0 = static_cast<::Windows::ApplicationModel::Background::SystemConditionType>(Nan::To<int32_t>(info[0]).FromMaybe(0));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::SystemCondition(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      SystemCondition *wrapperInstance = new SystemCondition(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SystemCondition^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::SystemCondition^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::SystemCondition^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapSystemCondition(winRtInstance));
    }





    static void ConditionTypeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SystemCondition^>(info.This())) {
        return;
      }

      SystemCondition *wrapper = SystemCondition::Unwrap<SystemCondition>(info.This());

      try  {
        ::Windows::ApplicationModel::Background::SystemConditionType result = wrapper->_instance->ConditionType;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::SystemCondition^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapSystemCondition(::Windows::ApplicationModel::Background::SystemCondition^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::SystemCondition^ UnwrapSystemCondition(Local<Value> value);
  };

  Persistent<FunctionTemplate> SystemCondition::s_constructorTemplate;

  v8::Local<v8::Value> WrapSystemCondition(::Windows::ApplicationModel::Background::SystemCondition^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(SystemCondition::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::SystemCondition^ UnwrapSystemCondition(Local<Value> value) {
     return SystemCondition::Unwrap<SystemCondition>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitSystemCondition(Local<Object> exports) {
    SystemCondition::Init(exports);
  }

  class NetworkOperatorNotificationTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("NetworkOperatorNotificationTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("networkAccountId").ToLocalChecked(), NetworkAccountIdGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("NetworkOperatorNotificationTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      NetworkOperatorNotificationTrigger(::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsString())
      {
        try {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      NetworkOperatorNotificationTrigger *wrapperInstance = new NetworkOperatorNotificationTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapNetworkOperatorNotificationTrigger(winRtInstance));
    }





    static void NetworkAccountIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger^>(info.This())) {
        return;
      }

      NetworkOperatorNotificationTrigger *wrapper = NetworkOperatorNotificationTrigger::Unwrap<NetworkOperatorNotificationTrigger>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->NetworkAccountId;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapNetworkOperatorNotificationTrigger(::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger^ UnwrapNetworkOperatorNotificationTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> NetworkOperatorNotificationTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapNetworkOperatorNotificationTrigger(::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(NetworkOperatorNotificationTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::NetworkOperatorNotificationTrigger^ UnwrapNetworkOperatorNotificationTrigger(Local<Value> value) {
     return NetworkOperatorNotificationTrigger::Unwrap<NetworkOperatorNotificationTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitNetworkOperatorNotificationTrigger(Local<Object> exports) {
    NetworkOperatorNotificationTrigger::Init(exports);
  }

  class DeviceManufacturerNotificationTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("DeviceManufacturerNotificationTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("oneShot").ToLocalChecked(), OneShotGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("triggerQualifier").ToLocalChecked(), TriggerQualifierGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("DeviceManufacturerNotificationTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      DeviceManufacturerNotificationTrigger(::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 2
        && info[0]->IsString()
        && info[1]->IsBoolean())
      {
        try {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          bool arg1 = Nan::To<bool>(info[1]).FromMaybe(false);
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger(arg0,arg1);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      DeviceManufacturerNotificationTrigger *wrapperInstance = new DeviceManufacturerNotificationTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapDeviceManufacturerNotificationTrigger(winRtInstance));
    }





    static void OneShotGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^>(info.This())) {
        return;
      }

      DeviceManufacturerNotificationTrigger *wrapper = DeviceManufacturerNotificationTrigger::Unwrap<DeviceManufacturerNotificationTrigger>(info.This());

      try  {
        bool result = wrapper->_instance->OneShot;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void TriggerQualifierGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^>(info.This())) {
        return;
      }

      DeviceManufacturerNotificationTrigger *wrapper = DeviceManufacturerNotificationTrigger::Unwrap<DeviceManufacturerNotificationTrigger>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->TriggerQualifier;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapDeviceManufacturerNotificationTrigger(::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^ UnwrapDeviceManufacturerNotificationTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> DeviceManufacturerNotificationTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapDeviceManufacturerNotificationTrigger(::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(DeviceManufacturerNotificationTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::DeviceManufacturerNotificationTrigger^ UnwrapDeviceManufacturerNotificationTrigger(Local<Value> value) {
     return DeviceManufacturerNotificationTrigger::Unwrap<DeviceManufacturerNotificationTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitDeviceManufacturerNotificationTrigger(Local<Object> exports) {
    DeviceManufacturerNotificationTrigger::Init(exports);
  }

  class CachedFileUpdaterTriggerDetails : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("CachedFileUpdaterTriggerDetails").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("canRequestUserInput").ToLocalChecked(), CanRequestUserInputGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("updateRequest").ToLocalChecked(), UpdateRequestGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("updateTarget").ToLocalChecked(), UpdateTargetGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("CachedFileUpdaterTriggerDetails").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      CachedFileUpdaterTriggerDetails(::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      CachedFileUpdaterTriggerDetails *wrapperInstance = new CachedFileUpdaterTriggerDetails(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapCachedFileUpdaterTriggerDetails(winRtInstance));
    }





    static void CanRequestUserInputGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^>(info.This())) {
        return;
      }

      CachedFileUpdaterTriggerDetails *wrapper = CachedFileUpdaterTriggerDetails::Unwrap<CachedFileUpdaterTriggerDetails>(info.This());

      try  {
        bool result = wrapper->_instance->CanRequestUserInput;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void UpdateRequestGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^>(info.This())) {
        return;
      }

      CachedFileUpdaterTriggerDetails *wrapper = CachedFileUpdaterTriggerDetails::Unwrap<CachedFileUpdaterTriggerDetails>(info.This());

      try  {
        ::Windows::Storage::Provider::FileUpdateRequest^ result = wrapper->_instance->UpdateRequest;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Storage.Provider", "FileUpdateRequest", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void UpdateTargetGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^>(info.This())) {
        return;
      }

      CachedFileUpdaterTriggerDetails *wrapper = CachedFileUpdaterTriggerDetails::Unwrap<CachedFileUpdaterTriggerDetails>(info.This());

      try  {
        ::Windows::Storage::Provider::CachedFileTarget result = wrapper->_instance->UpdateTarget;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapCachedFileUpdaterTriggerDetails(::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^ UnwrapCachedFileUpdaterTriggerDetails(Local<Value> value);
  };

  Persistent<FunctionTemplate> CachedFileUpdaterTriggerDetails::s_constructorTemplate;

  v8::Local<v8::Value> WrapCachedFileUpdaterTriggerDetails(::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(CachedFileUpdaterTriggerDetails::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::CachedFileUpdaterTriggerDetails^ UnwrapCachedFileUpdaterTriggerDetails(Local<Value> value) {
     return CachedFileUpdaterTriggerDetails::Unwrap<CachedFileUpdaterTriggerDetails>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitCachedFileUpdaterTriggerDetails(Local<Object> exports) {
    CachedFileUpdaterTriggerDetails::Init(exports);
  }

  class CachedFileUpdaterTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("CachedFileUpdaterTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("CachedFileUpdaterTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      CachedFileUpdaterTrigger(::Windows::ApplicationModel::Background::CachedFileUpdaterTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::CachedFileUpdaterTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::CachedFileUpdaterTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::CachedFileUpdaterTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::CachedFileUpdaterTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      CachedFileUpdaterTrigger *wrapperInstance = new CachedFileUpdaterTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::CachedFileUpdaterTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::CachedFileUpdaterTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::CachedFileUpdaterTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapCachedFileUpdaterTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::CachedFileUpdaterTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapCachedFileUpdaterTrigger(::Windows::ApplicationModel::Background::CachedFileUpdaterTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::CachedFileUpdaterTrigger^ UnwrapCachedFileUpdaterTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> CachedFileUpdaterTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapCachedFileUpdaterTrigger(::Windows::ApplicationModel::Background::CachedFileUpdaterTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(CachedFileUpdaterTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::CachedFileUpdaterTrigger^ UnwrapCachedFileUpdaterTrigger(Local<Value> value) {
     return CachedFileUpdaterTrigger::Unwrap<CachedFileUpdaterTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitCachedFileUpdaterTrigger(Local<Object> exports) {
    CachedFileUpdaterTrigger::Init(exports);
  }

  class TimeTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("TimeTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("freshnessTime").ToLocalChecked(), FreshnessTimeGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("oneShot").ToLocalChecked(), OneShotGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("TimeTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      TimeTrigger(::Windows::ApplicationModel::Background::TimeTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::TimeTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::TimeTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::TimeTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 2
        && info[0]->IsUint32()
        && info[1]->IsBoolean())
      {
        try {
          unsigned int arg0 = static_cast<unsigned int>(Nan::To<uint32_t>(info[0]).FromMaybe(0));
          bool arg1 = Nan::To<bool>(info[1]).FromMaybe(false);
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::TimeTrigger(arg0,arg1);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      TimeTrigger *wrapperInstance = new TimeTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::TimeTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::TimeTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::TimeTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapTimeTrigger(winRtInstance));
    }





    static void FreshnessTimeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::TimeTrigger^>(info.This())) {
        return;
      }

      TimeTrigger *wrapper = TimeTrigger::Unwrap<TimeTrigger>(info.This());

      try  {
        unsigned int result = wrapper->_instance->FreshnessTime;
        info.GetReturnValue().Set(Nan::New<Integer>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void OneShotGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::TimeTrigger^>(info.This())) {
        return;
      }

      TimeTrigger *wrapper = TimeTrigger::Unwrap<TimeTrigger>(info.This());

      try  {
        bool result = wrapper->_instance->OneShot;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::TimeTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapTimeTrigger(::Windows::ApplicationModel::Background::TimeTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::TimeTrigger^ UnwrapTimeTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> TimeTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapTimeTrigger(::Windows::ApplicationModel::Background::TimeTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(TimeTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::TimeTrigger^ UnwrapTimeTrigger(Local<Value> value) {
     return TimeTrigger::Unwrap<TimeTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitTimeTrigger(Local<Object> exports) {
    TimeTrigger::Init(exports);
  }

  class MaintenanceTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("MaintenanceTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("freshnessTime").ToLocalChecked(), FreshnessTimeGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("oneShot").ToLocalChecked(), OneShotGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("MaintenanceTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      MaintenanceTrigger(::Windows::ApplicationModel::Background::MaintenanceTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::MaintenanceTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::MaintenanceTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::MaintenanceTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 2
        && info[0]->IsUint32()
        && info[1]->IsBoolean())
      {
        try {
          unsigned int arg0 = static_cast<unsigned int>(Nan::To<uint32_t>(info[0]).FromMaybe(0));
          bool arg1 = Nan::To<bool>(info[1]).FromMaybe(false);
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::MaintenanceTrigger(arg0,arg1);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      MaintenanceTrigger *wrapperInstance = new MaintenanceTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::MaintenanceTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::MaintenanceTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::MaintenanceTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapMaintenanceTrigger(winRtInstance));
    }





    static void FreshnessTimeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::MaintenanceTrigger^>(info.This())) {
        return;
      }

      MaintenanceTrigger *wrapper = MaintenanceTrigger::Unwrap<MaintenanceTrigger>(info.This());

      try  {
        unsigned int result = wrapper->_instance->FreshnessTime;
        info.GetReturnValue().Set(Nan::New<Integer>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void OneShotGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::MaintenanceTrigger^>(info.This())) {
        return;
      }

      MaintenanceTrigger *wrapper = MaintenanceTrigger::Unwrap<MaintenanceTrigger>(info.This());

      try  {
        bool result = wrapper->_instance->OneShot;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::MaintenanceTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapMaintenanceTrigger(::Windows::ApplicationModel::Background::MaintenanceTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::MaintenanceTrigger^ UnwrapMaintenanceTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> MaintenanceTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapMaintenanceTrigger(::Windows::ApplicationModel::Background::MaintenanceTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(MaintenanceTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::MaintenanceTrigger^ UnwrapMaintenanceTrigger(Local<Value> value) {
     return MaintenanceTrigger::Unwrap<MaintenanceTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitMaintenanceTrigger(Local<Object> exports) {
    MaintenanceTrigger::Init(exports);
  }

  class AppointmentStoreNotificationTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("AppointmentStoreNotificationTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("AppointmentStoreNotificationTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      AppointmentStoreNotificationTrigger(::Windows::ApplicationModel::Background::AppointmentStoreNotificationTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::AppointmentStoreNotificationTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppointmentStoreNotificationTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::AppointmentStoreNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::AppointmentStoreNotificationTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      AppointmentStoreNotificationTrigger *wrapperInstance = new AppointmentStoreNotificationTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppointmentStoreNotificationTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::AppointmentStoreNotificationTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::AppointmentStoreNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapAppointmentStoreNotificationTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::AppointmentStoreNotificationTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapAppointmentStoreNotificationTrigger(::Windows::ApplicationModel::Background::AppointmentStoreNotificationTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::AppointmentStoreNotificationTrigger^ UnwrapAppointmentStoreNotificationTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> AppointmentStoreNotificationTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapAppointmentStoreNotificationTrigger(::Windows::ApplicationModel::Background::AppointmentStoreNotificationTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(AppointmentStoreNotificationTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::AppointmentStoreNotificationTrigger^ UnwrapAppointmentStoreNotificationTrigger(Local<Value> value) {
     return AppointmentStoreNotificationTrigger::Unwrap<AppointmentStoreNotificationTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitAppointmentStoreNotificationTrigger(Local<Object> exports) {
    AppointmentStoreNotificationTrigger::Init(exports);
  }

  class BackgroundExecutionManager : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("BackgroundExecutionManager").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);

        Local<Function> func;
        Local<FunctionTemplate> funcTemplate;





        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);

        Nan::SetMethod(constructor, "removeAccess", RemoveAccess);
        Nan::SetMethod(constructor, "getAccessStatus", GetAccessStatus);
        func = Nan::GetFunction(Nan::New<FunctionTemplate>(RequestAccessAsync)).ToLocalChecked();
        Nan::Set(constructor, Nan::New<String>("requestAccessAsync").ToLocalChecked(), func);


        Nan::Set(exports, Nan::New<String>("BackgroundExecutionManager").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      BackgroundExecutionManager(::Windows::ApplicationModel::Background::BackgroundExecutionManager^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::BackgroundExecutionManager^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundExecutionManager^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::BackgroundExecutionManager^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      BackgroundExecutionManager *wrapperInstance = new BackgroundExecutionManager(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundExecutionManager^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::BackgroundExecutionManager^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::BackgroundExecutionManager^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapBackgroundExecutionManager(winRtInstance));
    }




    static void RequestAccessAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      ::Windows::Foundation::IAsyncOperation<::Windows::ApplicationModel::Background::BackgroundAccessStatus>^ op;


      if (info.Length() == 1)
      {
        try
        {
          op = ::Windows::ApplicationModel::Background::BackgroundExecutionManager::RequestAccessAsync();
        } catch (Platform::Exception ^exception) {
            NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
            return;
        }
      }
      else if (info.Length() == 2
          && info[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
            
          op = ::Windows::ApplicationModel::Background::BackgroundExecutionManager::RequestAccessAsync(arg0);
        } catch (Platform::Exception ^exception) {
            NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
            return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<::Windows::ApplicationModel::Background::BackgroundAccessStatus> t)
      {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = Nan::New<Integer>(static_cast<int>(result));
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        }
        catch (Platform::Exception^ exception)
        {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {

            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }


    static void RemoveAccess(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 0)
      {
        try
        {
          ::Windows::ApplicationModel::Background::BackgroundExecutionManager::RemoveAccess();
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          ::Windows::ApplicationModel::Background::BackgroundExecutionManager::RemoveAccess(arg0);
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }

    static void GetAccessStatus(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 0)
      {
        try
        {
          ::Windows::ApplicationModel::Background::BackgroundAccessStatus result;
          result = ::Windows::ApplicationModel::Background::BackgroundExecutionManager::GetAccessStatus();
          info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          ::Windows::ApplicationModel::Background::BackgroundAccessStatus result;
          result = ::Windows::ApplicationModel::Background::BackgroundExecutionManager::GetAccessStatus(arg0);
          info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    private:
      ::Windows::ApplicationModel::Background::BackgroundExecutionManager^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapBackgroundExecutionManager(::Windows::ApplicationModel::Background::BackgroundExecutionManager^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::BackgroundExecutionManager^ UnwrapBackgroundExecutionManager(Local<Value> value);
  };

  Persistent<FunctionTemplate> BackgroundExecutionManager::s_constructorTemplate;

  v8::Local<v8::Value> WrapBackgroundExecutionManager(::Windows::ApplicationModel::Background::BackgroundExecutionManager^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(BackgroundExecutionManager::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::BackgroundExecutionManager^ UnwrapBackgroundExecutionManager(Local<Value> value) {
     return BackgroundExecutionManager::Unwrap<BackgroundExecutionManager>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitBackgroundExecutionManager(Local<Object> exports) {
    BackgroundExecutionManager::Init(exports);
  }

  class IBackgroundTaskInstance : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IBackgroundTaskInstance").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "getDeferral", GetDeferral);
          


          
          Nan::SetPrototypeMethod(localRef,"addListener", AddListener);
          Nan::SetPrototypeMethod(localRef,"on", AddListener);
          Nan::SetPrototypeMethod(localRef,"removeListener", RemoveListener);
          Nan::SetPrototypeMethod(localRef, "off", RemoveListener);

          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("instanceId").ToLocalChecked(), InstanceIdGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("progress").ToLocalChecked(), ProgressGetter, ProgressSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("suspendedCount").ToLocalChecked(), SuspendedCountGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("task").ToLocalChecked(), TaskGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("triggerDetails").ToLocalChecked(), TriggerDetailsGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IBackgroundTaskInstance").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IBackgroundTaskInstance(::Windows::ApplicationModel::Background::IBackgroundTaskInstance^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::IBackgroundTaskInstance^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTaskInstance^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IBackgroundTaskInstance *wrapperInstance = new IBackgroundTaskInstance(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::IBackgroundTaskInstance^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTaskInstance^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIBackgroundTaskInstance(winRtInstance));
    }


    static void GetDeferral(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance^>(info.This())) {
        return;
      }

      IBackgroundTaskInstance *wrapper = IBackgroundTaskInstance::Unwrap<IBackgroundTaskInstance>(info.This());

      if (info.Length() == 0)
      {
        try
        {
          ::Windows::ApplicationModel::Background::BackgroundTaskDeferral^ result;
          result = wrapper->_instance->GetDeferral();
          info.GetReturnValue().Set(WrapBackgroundTaskDeferral(result));
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    static void InstanceIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance^>(info.This())) {
        return;
      }

      IBackgroundTaskInstance *wrapper = IBackgroundTaskInstance::Unwrap<IBackgroundTaskInstance>(info.This());

      try  {
        ::Platform::Guid result = wrapper->_instance->InstanceId;
        info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void ProgressGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance^>(info.This())) {
        return;
      }

      IBackgroundTaskInstance *wrapper = IBackgroundTaskInstance::Unwrap<IBackgroundTaskInstance>(info.This());

      try  {
        unsigned int result = wrapper->_instance->Progress;
        info.GetReturnValue().Set(Nan::New<Integer>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void ProgressSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsUint32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance^>(info.This())) {
        return;
      }

      IBackgroundTaskInstance *wrapper = IBackgroundTaskInstance::Unwrap<IBackgroundTaskInstance>(info.This());

      try {

        unsigned int winRtValue = static_cast<unsigned int>(Nan::To<uint32_t>(value).FromMaybe(0));

        wrapper->_instance->Progress = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void SuspendedCountGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance^>(info.This())) {
        return;
      }

      IBackgroundTaskInstance *wrapper = IBackgroundTaskInstance::Unwrap<IBackgroundTaskInstance>(info.This());

      try  {
        unsigned int result = wrapper->_instance->SuspendedCount;
        info.GetReturnValue().Set(Nan::New<Integer>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void TaskGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance^>(info.This())) {
        return;
      }

      IBackgroundTaskInstance *wrapper = IBackgroundTaskInstance::Unwrap<IBackgroundTaskInstance>(info.This());

      try  {
        ::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ result = wrapper->_instance->Task;
        info.GetReturnValue().Set(WrapBackgroundTaskRegistration(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void TriggerDetailsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance^>(info.This())) {
        return;
      }

      IBackgroundTaskInstance *wrapper = IBackgroundTaskInstance::Unwrap<IBackgroundTaskInstance>(info.This());

      try  {
        ::Platform::Object^ result = wrapper->_instance->TriggerDetails;
        info.GetReturnValue().Set(CreateOpaqueWrapper(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    static void AddListener(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected arguments are eventName(string),callback(function)")));
        return;
      }

      String::Value eventName(v8::Isolate::GetCurrent(), info[0]);
      auto str = *eventName;

      Local<Function> callback = info[1].As<Function>();

      ::Windows::Foundation::EventRegistrationToken registrationToken;
      if (NodeRT::Utils::CaseInsenstiveEquals(L"canceled", str))
      {
        if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance^>(info.This()))
        {
          Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
      return;
        }
        IBackgroundTaskInstance *wrapper = IBackgroundTaskInstance::Unwrap<IBackgroundTaskInstance>(info.This());
      
        try {
          Persistent<Object>* perstPtr = new Persistent<Object>();
          perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
          std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
            [] (Persistent<Object> *ptr ) {
              NodeUtils::Async::RunOnMain([ptr]() {
                ptr->Reset();
                delete ptr;
            });
          });

          registrationToken = wrapper->_instance->Canceled::add(
            ref new ::Windows::ApplicationModel::Background::BackgroundTaskCanceledEventHandler(
            [callbackObjPtr](::Windows::ApplicationModel::Background::IBackgroundTaskInstance^ arg0, ::Windows::ApplicationModel::Background::BackgroundTaskCancellationReason arg1) {
              NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
                HandleScope scope;


                Local<Value> wrappedArg0;
                Local<Value> wrappedArg1;

                {
                  TryCatch tryCatch;


                  wrappedArg0 = WrapIBackgroundTaskInstance(arg0);
                  wrappedArg1 = Nan::New<Integer>(static_cast<int>(arg1));


                  if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
                  if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
                }

                Local<Value> args[] = { wrappedArg0, wrappedArg1 };
                Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
                NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
              });
            })
          );
        }
        catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }

      }
 else  {
        Nan::ThrowError(Nan::Error(String::Concat(v8::Isolate::GetCurrent(), NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
        return;
      }

      Local<Value> tokenMapVal = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
      Local<Object> tokenMap;

      if (tokenMapVal.IsEmpty() || Nan::Equals(tokenMapVal, Undefined()).FromMaybe(false)) {
        tokenMap = Nan::New<Object>();
        NodeRT::Utils::SetHiddenValueWithObject(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked(), tokenMap);
      } else {
        tokenMap = Nan::To<Object>(tokenMapVal).ToLocalChecked();
      }

      Nan::Set(tokenMap, info[0], CreateOpaqueWrapper(::Windows::Foundation::PropertyValue::CreateInt64(registrationToken.Value)));
    }

    static void RemoveListener(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected a string and a callback")));
        return;
      }

      String::Value eventName(v8::Isolate::GetCurrent(), info[0]);
      auto str = *eventName;

      if ((!NodeRT::Utils::CaseInsenstiveEquals(L"canceled", str))) {
        Nan::ThrowError(Nan::Error(String::Concat(v8::Isolate::GetCurrent(), NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
        return;
      }

      Local<Function> callback = info[1].As<Function>();
      Local<Value> tokenMap = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());

      if (tokenMap.IsEmpty() || Nan::Equals(tokenMap, Undefined()).FromMaybe(false)) {
        return;
      }

      Local<Value> opaqueWrapperObj =  Nan::Get(Nan::To<Object>(tokenMap).ToLocalChecked(), info[0]).ToLocalChecked();

      if (opaqueWrapperObj.IsEmpty() || Nan::Equals(opaqueWrapperObj,Undefined()).FromMaybe(false)) {
        return;
      }

      OpaqueWrapper *opaqueWrapper = OpaqueWrapper::Unwrap<OpaqueWrapper>(opaqueWrapperObj.As<Object>());

      long long tokenValue = (long long) opaqueWrapper->GetObjectInstance();
      ::Windows::Foundation::EventRegistrationToken registrationToken;
      registrationToken.Value = tokenValue;

      try  {
        if (NodeRT::Utils::CaseInsenstiveEquals(L"canceled", str)) {
          if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance^>(info.This()))
          {
            Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
            return;
          }
          IBackgroundTaskInstance *wrapper = IBackgroundTaskInstance::Unwrap<IBackgroundTaskInstance>(info.This());
          wrapper->_instance->Canceled::remove(registrationToken);
        }
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }

      Nan::Delete(Nan::To<Object>(tokenMap).ToLocalChecked(), Nan::To<String>(info[0]).ToLocalChecked());
    }
    private:
      ::Windows::ApplicationModel::Background::IBackgroundTaskInstance^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIBackgroundTaskInstance(::Windows::ApplicationModel::Background::IBackgroundTaskInstance^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::IBackgroundTaskInstance^ UnwrapIBackgroundTaskInstance(Local<Value> value);
  };

  Persistent<FunctionTemplate> IBackgroundTaskInstance::s_constructorTemplate;

  v8::Local<v8::Value> WrapIBackgroundTaskInstance(::Windows::ApplicationModel::Background::IBackgroundTaskInstance^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IBackgroundTaskInstance::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::IBackgroundTaskInstance^ UnwrapIBackgroundTaskInstance(Local<Value> value) {
     return IBackgroundTaskInstance::Unwrap<IBackgroundTaskInstance>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIBackgroundTaskInstance(Local<Object> exports) {
    IBackgroundTaskInstance::Init(exports);
  }

  class BackgroundTaskRegistration : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("BackgroundTaskRegistration").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "unregister", Unregister);
          


          
          Nan::SetPrototypeMethod(localRef,"addListener", AddListener);
          Nan::SetPrototypeMethod(localRef,"on", AddListener);
          Nan::SetPrototypeMethod(localRef,"removeListener", RemoveListener);
          Nan::SetPrototypeMethod(localRef, "off", RemoveListener);

          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("name").ToLocalChecked(), NameGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("taskId").ToLocalChecked(), TaskIdGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("trigger").ToLocalChecked(), TriggerGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("taskGroup").ToLocalChecked(), TaskGroupGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);

        Nan::SetMethod(constructor, "getTaskGroup", GetTaskGroup);
        Nan::SetAccessor(constructor, Nan::New<String>("allTasks").ToLocalChecked(), AllTasksGetter);
        Nan::SetAccessor(constructor, Nan::New<String>("allTaskGroups").ToLocalChecked(), AllTaskGroupsGetter);


        Nan::Set(exports, Nan::New<String>("BackgroundTaskRegistration").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      BackgroundTaskRegistration(::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistration^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::BackgroundTaskRegistration^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      BackgroundTaskRegistration *wrapperInstance = new BackgroundTaskRegistration(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistration^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::BackgroundTaskRegistration^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapBackgroundTaskRegistration(winRtInstance));
    }


    static void Unregister(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistration^>(info.This())) {
        return;
      }

      BackgroundTaskRegistration *wrapper = BackgroundTaskRegistration::Unwrap<BackgroundTaskRegistration>(info.This());

      if (info.Length() == 1
        && info[0]->IsBoolean())
      {
        try
        {
          bool arg0 = Nan::To<bool>(info[0]).FromMaybe(false);
          
          wrapper->_instance->Unregister(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    static void GetTaskGroup(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 1
        && info[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          ::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ result;
          result = ::Windows::ApplicationModel::Background::BackgroundTaskRegistration::GetTaskGroup(arg0);
          info.GetReturnValue().Set(WrapBackgroundTaskRegistrationGroup(result));
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }

    static void NameGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistration^>(info.This())) {
        return;
      }

      BackgroundTaskRegistration *wrapper = BackgroundTaskRegistration::Unwrap<BackgroundTaskRegistration>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->Name;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void TaskIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistration^>(info.This())) {
        return;
      }

      BackgroundTaskRegistration *wrapper = BackgroundTaskRegistration::Unwrap<BackgroundTaskRegistration>(info.This());

      try  {
        ::Platform::Guid result = wrapper->_instance->TaskId;
        info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void TriggerGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistration^>(info.This())) {
        return;
      }

      BackgroundTaskRegistration *wrapper = BackgroundTaskRegistration::Unwrap<BackgroundTaskRegistration>(info.This());

      try  {
        ::Windows::ApplicationModel::Background::IBackgroundTrigger^ result = wrapper->_instance->Trigger;
        info.GetReturnValue().Set(WrapIBackgroundTrigger(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void TaskGroupGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistration^>(info.This())) {
        return;
      }

      BackgroundTaskRegistration *wrapper = BackgroundTaskRegistration::Unwrap<BackgroundTaskRegistration>(info.This());

      try  {
        ::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ result = wrapper->_instance->TaskGroup;
        info.GetReturnValue().Set(WrapBackgroundTaskRegistrationGroup(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    static void AllTasksGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      try
      {
        ::Windows::Foundation::Collections::IMapView<::Platform::Guid, ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^>^ result = ::Windows::ApplicationModel::Background::BackgroundTaskRegistration::AllTasks;
        info.GetReturnValue().Set(NodeRT::Collections::MapViewWrapper<::Platform::Guid,::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^>::CreateMapViewWrapper(result, 
            [](::Platform::Guid val) -> Local<Value> {
              return NodeRT::Utils::GuidToJs(val);
            },
            [](Local<Value> value) -> bool {
              return NodeRT::Utils::IsGuid(value);
            },
            [](Local<Value> value) -> ::Platform::Guid {
              return NodeRT::Utils::GuidFromJs(value);
            },
            [](::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^ val) -> Local<Value> {
              return WrapIBackgroundTaskRegistration(val);
            }
          ));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      

    static void AllTaskGroupsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      try
      {
        ::Windows::Foundation::Collections::IMapView<::Platform::String^, ::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^>^ result = ::Windows::ApplicationModel::Background::BackgroundTaskRegistration::AllTaskGroups;
        info.GetReturnValue().Set(NodeRT::Collections::MapViewWrapper<::Platform::String^,::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^>::CreateMapViewWrapper(result, 
            [](::Platform::String^ val) -> Local<Value> {
              return NodeRT::Utils::NewString(val->Data());
            },
            [](Local<Value> value) -> bool {
              return value->IsString();
            },
            [](Local<Value> value) -> ::Platform::String^ {
              return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), value)));
            },
            [](::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ val) -> Local<Value> {
              return WrapBackgroundTaskRegistrationGroup(val);
            }
          ));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      

    static void AddListener(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected arguments are eventName(string),callback(function)")));
        return;
      }

      String::Value eventName(v8::Isolate::GetCurrent(), info[0]);
      auto str = *eventName;

      Local<Function> callback = info[1].As<Function>();

      ::Windows::Foundation::EventRegistrationToken registrationToken;
      if (NodeRT::Utils::CaseInsenstiveEquals(L"completed", str))
      {
        if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistration^>(info.This()))
        {
          Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
      return;
        }
        BackgroundTaskRegistration *wrapper = BackgroundTaskRegistration::Unwrap<BackgroundTaskRegistration>(info.This());
      
        try {
          Persistent<Object>* perstPtr = new Persistent<Object>();
          perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
          std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
            [] (Persistent<Object> *ptr ) {
              NodeUtils::Async::RunOnMain([ptr]() {
                ptr->Reset();
                delete ptr;
            });
          });

          registrationToken = wrapper->_instance->Completed::add(
            ref new ::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventHandler(
            [callbackObjPtr](::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ arg0, ::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^ arg1) {
              NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
                HandleScope scope;


                Local<Value> wrappedArg0;
                Local<Value> wrappedArg1;

                {
                  TryCatch tryCatch;


                  wrappedArg0 = WrapBackgroundTaskRegistration(arg0);
                  wrappedArg1 = WrapBackgroundTaskCompletedEventArgs(arg1);


                  if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
                  if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
                }

                Local<Value> args[] = { wrappedArg0, wrappedArg1 };
                Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
                NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
              });
            })
          );
        }
        catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }

      }
      else if (NodeRT::Utils::CaseInsenstiveEquals(L"progress", str))
      {
        if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistration^>(info.This()))
        {
          Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
      return;
        }
        BackgroundTaskRegistration *wrapper = BackgroundTaskRegistration::Unwrap<BackgroundTaskRegistration>(info.This());
      
        try {
          Persistent<Object>* perstPtr = new Persistent<Object>();
          perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
          std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
            [] (Persistent<Object> *ptr ) {
              NodeUtils::Async::RunOnMain([ptr]() {
                ptr->Reset();
                delete ptr;
            });
          });

          registrationToken = wrapper->_instance->Progress::add(
            ref new ::Windows::ApplicationModel::Background::BackgroundTaskProgressEventHandler(
            [callbackObjPtr](::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ arg0, ::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^ arg1) {
              NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
                HandleScope scope;


                Local<Value> wrappedArg0;
                Local<Value> wrappedArg1;

                {
                  TryCatch tryCatch;


                  wrappedArg0 = WrapBackgroundTaskRegistration(arg0);
                  wrappedArg1 = WrapBackgroundTaskProgressEventArgs(arg1);


                  if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
                  if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
                }

                Local<Value> args[] = { wrappedArg0, wrappedArg1 };
                Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
                NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
              });
            })
          );
        }
        catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }

      }
 else  {
        Nan::ThrowError(Nan::Error(String::Concat(v8::Isolate::GetCurrent(), NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
        return;
      }

      Local<Value> tokenMapVal = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
      Local<Object> tokenMap;

      if (tokenMapVal.IsEmpty() || Nan::Equals(tokenMapVal, Undefined()).FromMaybe(false)) {
        tokenMap = Nan::New<Object>();
        NodeRT::Utils::SetHiddenValueWithObject(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked(), tokenMap);
      } else {
        tokenMap = Nan::To<Object>(tokenMapVal).ToLocalChecked();
      }

      Nan::Set(tokenMap, info[0], CreateOpaqueWrapper(::Windows::Foundation::PropertyValue::CreateInt64(registrationToken.Value)));
    }

    static void RemoveListener(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected a string and a callback")));
        return;
      }

      String::Value eventName(v8::Isolate::GetCurrent(), info[0]);
      auto str = *eventName;

      if ((!NodeRT::Utils::CaseInsenstiveEquals(L"completed", str)) &&(!NodeRT::Utils::CaseInsenstiveEquals(L"progress", str))) {
        Nan::ThrowError(Nan::Error(String::Concat(v8::Isolate::GetCurrent(), NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
        return;
      }

      Local<Function> callback = info[1].As<Function>();
      Local<Value> tokenMap = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());

      if (tokenMap.IsEmpty() || Nan::Equals(tokenMap, Undefined()).FromMaybe(false)) {
        return;
      }

      Local<Value> opaqueWrapperObj =  Nan::Get(Nan::To<Object>(tokenMap).ToLocalChecked(), info[0]).ToLocalChecked();

      if (opaqueWrapperObj.IsEmpty() || Nan::Equals(opaqueWrapperObj,Undefined()).FromMaybe(false)) {
        return;
      }

      OpaqueWrapper *opaqueWrapper = OpaqueWrapper::Unwrap<OpaqueWrapper>(opaqueWrapperObj.As<Object>());

      long long tokenValue = (long long) opaqueWrapper->GetObjectInstance();
      ::Windows::Foundation::EventRegistrationToken registrationToken;
      registrationToken.Value = tokenValue;

      try  {
        if (NodeRT::Utils::CaseInsenstiveEquals(L"completed", str)) {
          if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistration^>(info.This()))
          {
            Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
            return;
          }
          BackgroundTaskRegistration *wrapper = BackgroundTaskRegistration::Unwrap<BackgroundTaskRegistration>(info.This());
          wrapper->_instance->Completed::remove(registrationToken);
        }
        else if (NodeRT::Utils::CaseInsenstiveEquals(L"progress", str))
        {
          if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistration^>(info.This()))
          {
            Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
            return;
          }
          BackgroundTaskRegistration *wrapper = BackgroundTaskRegistration::Unwrap<BackgroundTaskRegistration>(info.This());
          wrapper->_instance->Progress::remove(registrationToken);
        }
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }

      Nan::Delete(Nan::To<Object>(tokenMap).ToLocalChecked(), Nan::To<String>(info[0]).ToLocalChecked());
    }
    private:
      ::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapBackgroundTaskRegistration(::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ UnwrapBackgroundTaskRegistration(Local<Value> value);
  };

  Persistent<FunctionTemplate> BackgroundTaskRegistration::s_constructorTemplate;

  v8::Local<v8::Value> WrapBackgroundTaskRegistration(::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(BackgroundTaskRegistration::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ UnwrapBackgroundTaskRegistration(Local<Value> value) {
     return BackgroundTaskRegistration::Unwrap<BackgroundTaskRegistration>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitBackgroundTaskRegistration(Local<Object> exports) {
    BackgroundTaskRegistration::Init(exports);
  }

  class BackgroundTaskDeferral : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("BackgroundTaskDeferral").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "complete", Complete);
          




        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("BackgroundTaskDeferral").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      BackgroundTaskDeferral(::Windows::ApplicationModel::Background::BackgroundTaskDeferral^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::BackgroundTaskDeferral^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskDeferral^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::BackgroundTaskDeferral^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      BackgroundTaskDeferral *wrapperInstance = new BackgroundTaskDeferral(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskDeferral^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::BackgroundTaskDeferral^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::BackgroundTaskDeferral^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapBackgroundTaskDeferral(winRtInstance));
    }


    static void Complete(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskDeferral^>(info.This())) {
        return;
      }

      BackgroundTaskDeferral *wrapper = BackgroundTaskDeferral::Unwrap<BackgroundTaskDeferral>(info.This());

      if (info.Length() == 0)
      {
        try
        {
          wrapper->_instance->Complete();
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }





    private:
      ::Windows::ApplicationModel::Background::BackgroundTaskDeferral^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapBackgroundTaskDeferral(::Windows::ApplicationModel::Background::BackgroundTaskDeferral^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::BackgroundTaskDeferral^ UnwrapBackgroundTaskDeferral(Local<Value> value);
  };

  Persistent<FunctionTemplate> BackgroundTaskDeferral::s_constructorTemplate;

  v8::Local<v8::Value> WrapBackgroundTaskDeferral(::Windows::ApplicationModel::Background::BackgroundTaskDeferral^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(BackgroundTaskDeferral::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::BackgroundTaskDeferral^ UnwrapBackgroundTaskDeferral(Local<Value> value) {
     return BackgroundTaskDeferral::Unwrap<BackgroundTaskDeferral>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitBackgroundTaskDeferral(Local<Object> exports) {
    BackgroundTaskDeferral::Init(exports);
  }

  class BackgroundTaskProgressEventArgs : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("BackgroundTaskProgressEventArgs").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("instanceId").ToLocalChecked(), InstanceIdGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("progress").ToLocalChecked(), ProgressGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("BackgroundTaskProgressEventArgs").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      BackgroundTaskProgressEventArgs(::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      BackgroundTaskProgressEventArgs *wrapperInstance = new BackgroundTaskProgressEventArgs(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapBackgroundTaskProgressEventArgs(winRtInstance));
    }





    static void InstanceIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^>(info.This())) {
        return;
      }

      BackgroundTaskProgressEventArgs *wrapper = BackgroundTaskProgressEventArgs::Unwrap<BackgroundTaskProgressEventArgs>(info.This());

      try  {
        ::Platform::Guid result = wrapper->_instance->InstanceId;
        info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void ProgressGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^>(info.This())) {
        return;
      }

      BackgroundTaskProgressEventArgs *wrapper = BackgroundTaskProgressEventArgs::Unwrap<BackgroundTaskProgressEventArgs>(info.This());

      try  {
        unsigned int result = wrapper->_instance->Progress;
        info.GetReturnValue().Set(Nan::New<Integer>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapBackgroundTaskProgressEventArgs(::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^ UnwrapBackgroundTaskProgressEventArgs(Local<Value> value);
  };

  Persistent<FunctionTemplate> BackgroundTaskProgressEventArgs::s_constructorTemplate;

  v8::Local<v8::Value> WrapBackgroundTaskProgressEventArgs(::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(BackgroundTaskProgressEventArgs::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^ UnwrapBackgroundTaskProgressEventArgs(Local<Value> value) {
     return BackgroundTaskProgressEventArgs::Unwrap<BackgroundTaskProgressEventArgs>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitBackgroundTaskProgressEventArgs(Local<Object> exports) {
    BackgroundTaskProgressEventArgs::Init(exports);
  }

  class BackgroundTaskCompletedEventArgs : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("BackgroundTaskCompletedEventArgs").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "checkResult", CheckResult);
          



          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("instanceId").ToLocalChecked(), InstanceIdGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("BackgroundTaskCompletedEventArgs").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      BackgroundTaskCompletedEventArgs(::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      BackgroundTaskCompletedEventArgs *wrapperInstance = new BackgroundTaskCompletedEventArgs(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapBackgroundTaskCompletedEventArgs(winRtInstance));
    }


    static void CheckResult(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^>(info.This())) {
        return;
      }

      BackgroundTaskCompletedEventArgs *wrapper = BackgroundTaskCompletedEventArgs::Unwrap<BackgroundTaskCompletedEventArgs>(info.This());

      if (info.Length() == 0)
      {
        try
        {
          wrapper->_instance->CheckResult();
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    static void InstanceIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^>(info.This())) {
        return;
      }

      BackgroundTaskCompletedEventArgs *wrapper = BackgroundTaskCompletedEventArgs::Unwrap<BackgroundTaskCompletedEventArgs>(info.This());

      try  {
        ::Platform::Guid result = wrapper->_instance->InstanceId;
        info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapBackgroundTaskCompletedEventArgs(::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^ UnwrapBackgroundTaskCompletedEventArgs(Local<Value> value);
  };

  Persistent<FunctionTemplate> BackgroundTaskCompletedEventArgs::s_constructorTemplate;

  v8::Local<v8::Value> WrapBackgroundTaskCompletedEventArgs(::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(BackgroundTaskCompletedEventArgs::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^ UnwrapBackgroundTaskCompletedEventArgs(Local<Value> value) {
     return BackgroundTaskCompletedEventArgs::Unwrap<BackgroundTaskCompletedEventArgs>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitBackgroundTaskCompletedEventArgs(Local<Object> exports) {
    BackgroundTaskCompletedEventArgs::Init(exports);
  }

  class IBackgroundTaskInstance2 : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IBackgroundTaskInstance2").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "getThrottleCount", GetThrottleCount);
          




        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IBackgroundTaskInstance2").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IBackgroundTaskInstance2(::Windows::ApplicationModel::Background::IBackgroundTaskInstance2^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::IBackgroundTaskInstance2^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance2^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTaskInstance2^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IBackgroundTaskInstance2 *wrapperInstance = new IBackgroundTaskInstance2(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance2^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::IBackgroundTaskInstance2^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTaskInstance2^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIBackgroundTaskInstance2(winRtInstance));
    }


    static void GetThrottleCount(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance2^>(info.This())) {
        return;
      }

      IBackgroundTaskInstance2 *wrapper = IBackgroundTaskInstance2::Unwrap<IBackgroundTaskInstance2>(info.This());

      if (info.Length() == 1
        && info[0]->IsInt32())
      {
        try
        {
          ::Windows::ApplicationModel::Background::BackgroundTaskThrottleCounter arg0 = static_cast<::Windows::ApplicationModel::Background::BackgroundTaskThrottleCounter>(Nan::To<int32_t>(info[0]).FromMaybe(0));
          
          unsigned int result;
          result = wrapper->_instance->GetThrottleCount(arg0);
          info.GetReturnValue().Set(Nan::New<Integer>(result));
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }





    private:
      ::Windows::ApplicationModel::Background::IBackgroundTaskInstance2^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIBackgroundTaskInstance2(::Windows::ApplicationModel::Background::IBackgroundTaskInstance2^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::IBackgroundTaskInstance2^ UnwrapIBackgroundTaskInstance2(Local<Value> value);
  };

  Persistent<FunctionTemplate> IBackgroundTaskInstance2::s_constructorTemplate;

  v8::Local<v8::Value> WrapIBackgroundTaskInstance2(::Windows::ApplicationModel::Background::IBackgroundTaskInstance2^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IBackgroundTaskInstance2::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::IBackgroundTaskInstance2^ UnwrapIBackgroundTaskInstance2(Local<Value> value) {
     return IBackgroundTaskInstance2::Unwrap<IBackgroundTaskInstance2>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIBackgroundTaskInstance2(Local<Object> exports) {
    IBackgroundTaskInstance2::Init(exports);
  }

  class IBackgroundTaskInstance4 : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IBackgroundTaskInstance4").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("user").ToLocalChecked(), UserGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IBackgroundTaskInstance4").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IBackgroundTaskInstance4(::Windows::ApplicationModel::Background::IBackgroundTaskInstance4^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::IBackgroundTaskInstance4^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance4^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTaskInstance4^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IBackgroundTaskInstance4 *wrapperInstance = new IBackgroundTaskInstance4(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance4^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::IBackgroundTaskInstance4^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTaskInstance4^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIBackgroundTaskInstance4(winRtInstance));
    }





    static void UserGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance4^>(info.This())) {
        return;
      }

      IBackgroundTaskInstance4 *wrapper = IBackgroundTaskInstance4::Unwrap<IBackgroundTaskInstance4>(info.This());

      try  {
        ::Windows::System::User^ result = wrapper->_instance->User;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.System", "User", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::IBackgroundTaskInstance4^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIBackgroundTaskInstance4(::Windows::ApplicationModel::Background::IBackgroundTaskInstance4^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::IBackgroundTaskInstance4^ UnwrapIBackgroundTaskInstance4(Local<Value> value);
  };

  Persistent<FunctionTemplate> IBackgroundTaskInstance4::s_constructorTemplate;

  v8::Local<v8::Value> WrapIBackgroundTaskInstance4(::Windows::ApplicationModel::Background::IBackgroundTaskInstance4^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IBackgroundTaskInstance4::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::IBackgroundTaskInstance4^ UnwrapIBackgroundTaskInstance4(Local<Value> value) {
     return IBackgroundTaskInstance4::Unwrap<IBackgroundTaskInstance4>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIBackgroundTaskInstance4(Local<Object> exports) {
    IBackgroundTaskInstance4::Init(exports);
  }

  class IBackgroundTask : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IBackgroundTask").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "run", Run);
          




        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IBackgroundTask").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IBackgroundTask(::Windows::ApplicationModel::Background::IBackgroundTask^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::IBackgroundTask^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTask^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTask^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IBackgroundTask *wrapperInstance = new IBackgroundTask(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTask^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::IBackgroundTask^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTask^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIBackgroundTask(winRtInstance));
    }


    static void Run(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTask^>(info.This())) {
        return;
      }

      IBackgroundTask *wrapper = IBackgroundTask::Unwrap<IBackgroundTask>(info.This());

      if (info.Length() == 1
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskInstance^>(info[0]))
      {
        try
        {
          ::Windows::ApplicationModel::Background::IBackgroundTaskInstance^ arg0 = UnwrapIBackgroundTaskInstance(info[0]);
          
          wrapper->_instance->Run(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }





    private:
      ::Windows::ApplicationModel::Background::IBackgroundTask^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIBackgroundTask(::Windows::ApplicationModel::Background::IBackgroundTask^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::IBackgroundTask^ UnwrapIBackgroundTask(Local<Value> value);
  };

  Persistent<FunctionTemplate> IBackgroundTask::s_constructorTemplate;

  v8::Local<v8::Value> WrapIBackgroundTask(::Windows::ApplicationModel::Background::IBackgroundTask^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IBackgroundTask::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::IBackgroundTask^ UnwrapIBackgroundTask(Local<Value> value) {
     return IBackgroundTask::Unwrap<IBackgroundTask>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIBackgroundTask(Local<Object> exports) {
    IBackgroundTask::Init(exports);
  }

  class IBackgroundTaskRegistration : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IBackgroundTaskRegistration").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "unregister", Unregister);
          


          
          Nan::SetPrototypeMethod(localRef,"addListener", AddListener);
          Nan::SetPrototypeMethod(localRef,"on", AddListener);
          Nan::SetPrototypeMethod(localRef,"removeListener", RemoveListener);
          Nan::SetPrototypeMethod(localRef, "off", RemoveListener);

          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("name").ToLocalChecked(), NameGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("taskId").ToLocalChecked(), TaskIdGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IBackgroundTaskRegistration").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IBackgroundTaskRegistration(::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IBackgroundTaskRegistration *wrapperInstance = new IBackgroundTaskRegistration(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIBackgroundTaskRegistration(winRtInstance));
    }


    static void Unregister(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^>(info.This())) {
        return;
      }

      IBackgroundTaskRegistration *wrapper = IBackgroundTaskRegistration::Unwrap<IBackgroundTaskRegistration>(info.This());

      if (info.Length() == 1
        && info[0]->IsBoolean())
      {
        try
        {
          bool arg0 = Nan::To<bool>(info[0]).FromMaybe(false);
          
          wrapper->_instance->Unregister(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    static void NameGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^>(info.This())) {
        return;
      }

      IBackgroundTaskRegistration *wrapper = IBackgroundTaskRegistration::Unwrap<IBackgroundTaskRegistration>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->Name;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void TaskIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^>(info.This())) {
        return;
      }

      IBackgroundTaskRegistration *wrapper = IBackgroundTaskRegistration::Unwrap<IBackgroundTaskRegistration>(info.This());

      try  {
        ::Platform::Guid result = wrapper->_instance->TaskId;
        info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    static void AddListener(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected arguments are eventName(string),callback(function)")));
        return;
      }

      String::Value eventName(v8::Isolate::GetCurrent(), info[0]);
      auto str = *eventName;

      Local<Function> callback = info[1].As<Function>();

      ::Windows::Foundation::EventRegistrationToken registrationToken;
      if (NodeRT::Utils::CaseInsenstiveEquals(L"completed", str))
      {
        if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^>(info.This()))
        {
          Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
      return;
        }
        IBackgroundTaskRegistration *wrapper = IBackgroundTaskRegistration::Unwrap<IBackgroundTaskRegistration>(info.This());
      
        try {
          Persistent<Object>* perstPtr = new Persistent<Object>();
          perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
          std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
            [] (Persistent<Object> *ptr ) {
              NodeUtils::Async::RunOnMain([ptr]() {
                ptr->Reset();
                delete ptr;
            });
          });

          registrationToken = wrapper->_instance->Completed::add(
            ref new ::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventHandler(
            [callbackObjPtr](::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ arg0, ::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs^ arg1) {
              NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
                HandleScope scope;


                Local<Value> wrappedArg0;
                Local<Value> wrappedArg1;

                {
                  TryCatch tryCatch;


                  wrappedArg0 = WrapBackgroundTaskRegistration(arg0);
                  wrappedArg1 = WrapBackgroundTaskCompletedEventArgs(arg1);


                  if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
                  if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
                }

                Local<Value> args[] = { wrappedArg0, wrappedArg1 };
                Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
                NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
              });
            })
          );
        }
        catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }

      }
      else if (NodeRT::Utils::CaseInsenstiveEquals(L"progress", str))
      {
        if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^>(info.This()))
        {
          Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
      return;
        }
        IBackgroundTaskRegistration *wrapper = IBackgroundTaskRegistration::Unwrap<IBackgroundTaskRegistration>(info.This());
      
        try {
          Persistent<Object>* perstPtr = new Persistent<Object>();
          perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
          std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
            [] (Persistent<Object> *ptr ) {
              NodeUtils::Async::RunOnMain([ptr]() {
                ptr->Reset();
                delete ptr;
            });
          });

          registrationToken = wrapper->_instance->Progress::add(
            ref new ::Windows::ApplicationModel::Background::BackgroundTaskProgressEventHandler(
            [callbackObjPtr](::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ arg0, ::Windows::ApplicationModel::Background::BackgroundTaskProgressEventArgs^ arg1) {
              NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
                HandleScope scope;


                Local<Value> wrappedArg0;
                Local<Value> wrappedArg1;

                {
                  TryCatch tryCatch;


                  wrappedArg0 = WrapBackgroundTaskRegistration(arg0);
                  wrappedArg1 = WrapBackgroundTaskProgressEventArgs(arg1);


                  if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
                  if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
                }

                Local<Value> args[] = { wrappedArg0, wrappedArg1 };
                Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
                NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
              });
            })
          );
        }
        catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }

      }
 else  {
        Nan::ThrowError(Nan::Error(String::Concat(v8::Isolate::GetCurrent(), NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
        return;
      }

      Local<Value> tokenMapVal = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
      Local<Object> tokenMap;

      if (tokenMapVal.IsEmpty() || Nan::Equals(tokenMapVal, Undefined()).FromMaybe(false)) {
        tokenMap = Nan::New<Object>();
        NodeRT::Utils::SetHiddenValueWithObject(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked(), tokenMap);
      } else {
        tokenMap = Nan::To<Object>(tokenMapVal).ToLocalChecked();
      }

      Nan::Set(tokenMap, info[0], CreateOpaqueWrapper(::Windows::Foundation::PropertyValue::CreateInt64(registrationToken.Value)));
    }

    static void RemoveListener(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected a string and a callback")));
        return;
      }

      String::Value eventName(v8::Isolate::GetCurrent(), info[0]);
      auto str = *eventName;

      if ((!NodeRT::Utils::CaseInsenstiveEquals(L"completed", str)) &&(!NodeRT::Utils::CaseInsenstiveEquals(L"progress", str))) {
        Nan::ThrowError(Nan::Error(String::Concat(v8::Isolate::GetCurrent(), NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
        return;
      }

      Local<Function> callback = info[1].As<Function>();
      Local<Value> tokenMap = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());

      if (tokenMap.IsEmpty() || Nan::Equals(tokenMap, Undefined()).FromMaybe(false)) {
        return;
      }

      Local<Value> opaqueWrapperObj =  Nan::Get(Nan::To<Object>(tokenMap).ToLocalChecked(), info[0]).ToLocalChecked();

      if (opaqueWrapperObj.IsEmpty() || Nan::Equals(opaqueWrapperObj,Undefined()).FromMaybe(false)) {
        return;
      }

      OpaqueWrapper *opaqueWrapper = OpaqueWrapper::Unwrap<OpaqueWrapper>(opaqueWrapperObj.As<Object>());

      long long tokenValue = (long long) opaqueWrapper->GetObjectInstance();
      ::Windows::Foundation::EventRegistrationToken registrationToken;
      registrationToken.Value = tokenValue;

      try  {
        if (NodeRT::Utils::CaseInsenstiveEquals(L"completed", str)) {
          if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^>(info.This()))
          {
            Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
            return;
          }
          IBackgroundTaskRegistration *wrapper = IBackgroundTaskRegistration::Unwrap<IBackgroundTaskRegistration>(info.This());
          wrapper->_instance->Completed::remove(registrationToken);
        }
        else if (NodeRT::Utils::CaseInsenstiveEquals(L"progress", str))
        {
          if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^>(info.This()))
          {
            Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
            return;
          }
          IBackgroundTaskRegistration *wrapper = IBackgroundTaskRegistration::Unwrap<IBackgroundTaskRegistration>(info.This());
          wrapper->_instance->Progress::remove(registrationToken);
        }
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }

      Nan::Delete(Nan::To<Object>(tokenMap).ToLocalChecked(), Nan::To<String>(info[0]).ToLocalChecked());
    }
    private:
      ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIBackgroundTaskRegistration(::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^ UnwrapIBackgroundTaskRegistration(Local<Value> value);
  };

  Persistent<FunctionTemplate> IBackgroundTaskRegistration::s_constructorTemplate;

  v8::Local<v8::Value> WrapIBackgroundTaskRegistration(::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IBackgroundTaskRegistration::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration^ UnwrapIBackgroundTaskRegistration(Local<Value> value) {
     return IBackgroundTaskRegistration::Unwrap<IBackgroundTaskRegistration>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIBackgroundTaskRegistration(Local<Object> exports) {
    IBackgroundTaskRegistration::Init(exports);
  }

  class IBackgroundTaskRegistration2 : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IBackgroundTaskRegistration2").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("trigger").ToLocalChecked(), TriggerGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IBackgroundTaskRegistration2").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IBackgroundTaskRegistration2(::Windows::ApplicationModel::Background::IBackgroundTaskRegistration2^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration2^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskRegistration2^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTaskRegistration2^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IBackgroundTaskRegistration2 *wrapperInstance = new IBackgroundTaskRegistration2(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskRegistration2^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration2^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTaskRegistration2^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIBackgroundTaskRegistration2(winRtInstance));
    }





    static void TriggerGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskRegistration2^>(info.This())) {
        return;
      }

      IBackgroundTaskRegistration2 *wrapper = IBackgroundTaskRegistration2::Unwrap<IBackgroundTaskRegistration2>(info.This());

      try  {
        ::Windows::ApplicationModel::Background::IBackgroundTrigger^ result = wrapper->_instance->Trigger;
        info.GetReturnValue().Set(WrapIBackgroundTrigger(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration2^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIBackgroundTaskRegistration2(::Windows::ApplicationModel::Background::IBackgroundTaskRegistration2^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration2^ UnwrapIBackgroundTaskRegistration2(Local<Value> value);
  };

  Persistent<FunctionTemplate> IBackgroundTaskRegistration2::s_constructorTemplate;

  v8::Local<v8::Value> WrapIBackgroundTaskRegistration2(::Windows::ApplicationModel::Background::IBackgroundTaskRegistration2^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IBackgroundTaskRegistration2::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration2^ UnwrapIBackgroundTaskRegistration2(Local<Value> value) {
     return IBackgroundTaskRegistration2::Unwrap<IBackgroundTaskRegistration2>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIBackgroundTaskRegistration2(Local<Object> exports) {
    IBackgroundTaskRegistration2::Init(exports);
  }

  class IBackgroundTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IBackgroundTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IBackgroundTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IBackgroundTrigger(::Windows::ApplicationModel::Background::IBackgroundTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::IBackgroundTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IBackgroundTrigger *wrapperInstance = new IBackgroundTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::IBackgroundTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIBackgroundTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::IBackgroundTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIBackgroundTrigger(::Windows::ApplicationModel::Background::IBackgroundTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::IBackgroundTrigger^ UnwrapIBackgroundTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> IBackgroundTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapIBackgroundTrigger(::Windows::ApplicationModel::Background::IBackgroundTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IBackgroundTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::IBackgroundTrigger^ UnwrapIBackgroundTrigger(Local<Value> value) {
     return IBackgroundTrigger::Unwrap<IBackgroundTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIBackgroundTrigger(Local<Object> exports) {
    IBackgroundTrigger::Init(exports);
  }

  class IBackgroundTaskRegistration3 : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IBackgroundTaskRegistration3").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("taskGroup").ToLocalChecked(), TaskGroupGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IBackgroundTaskRegistration3").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IBackgroundTaskRegistration3(::Windows::ApplicationModel::Background::IBackgroundTaskRegistration3^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration3^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskRegistration3^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTaskRegistration3^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IBackgroundTaskRegistration3 *wrapperInstance = new IBackgroundTaskRegistration3(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskRegistration3^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration3^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundTaskRegistration3^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIBackgroundTaskRegistration3(winRtInstance));
    }





    static void TaskGroupGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTaskRegistration3^>(info.This())) {
        return;
      }

      IBackgroundTaskRegistration3 *wrapper = IBackgroundTaskRegistration3::Unwrap<IBackgroundTaskRegistration3>(info.This());

      try  {
        ::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ result = wrapper->_instance->TaskGroup;
        info.GetReturnValue().Set(WrapBackgroundTaskRegistrationGroup(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration3^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIBackgroundTaskRegistration3(::Windows::ApplicationModel::Background::IBackgroundTaskRegistration3^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration3^ UnwrapIBackgroundTaskRegistration3(Local<Value> value);
  };

  Persistent<FunctionTemplate> IBackgroundTaskRegistration3::s_constructorTemplate;

  v8::Local<v8::Value> WrapIBackgroundTaskRegistration3(::Windows::ApplicationModel::Background::IBackgroundTaskRegistration3^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IBackgroundTaskRegistration3::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::IBackgroundTaskRegistration3^ UnwrapIBackgroundTaskRegistration3(Local<Value> value) {
     return IBackgroundTaskRegistration3::Unwrap<IBackgroundTaskRegistration3>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIBackgroundTaskRegistration3(Local<Object> exports) {
    IBackgroundTaskRegistration3::Init(exports);
  }

  class BackgroundTaskRegistrationGroup : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("BackgroundTaskRegistrationGroup").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);




          
          Nan::SetPrototypeMethod(localRef,"addListener", AddListener);
          Nan::SetPrototypeMethod(localRef,"on", AddListener);
          Nan::SetPrototypeMethod(localRef,"removeListener", RemoveListener);
          Nan::SetPrototypeMethod(localRef, "off", RemoveListener);

          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("allTasks").ToLocalChecked(), AllTasksGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("id").ToLocalChecked(), IdGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("name").ToLocalChecked(), NameGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("BackgroundTaskRegistrationGroup").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      BackgroundTaskRegistrationGroup(::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsString())
      {
        try {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 2
        && info[0]->IsString()
        && info[1]->IsString())
      {
        try {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          Platform::String^ arg1 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[1])));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup(arg0,arg1);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      BackgroundTaskRegistrationGroup *wrapperInstance = new BackgroundTaskRegistrationGroup(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapBackgroundTaskRegistrationGroup(winRtInstance));
    }





    static void AllTasksGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^>(info.This())) {
        return;
      }

      BackgroundTaskRegistrationGroup *wrapper = BackgroundTaskRegistrationGroup::Unwrap<BackgroundTaskRegistrationGroup>(info.This());

      try  {
        ::Windows::Foundation::Collections::IMapView<::Platform::Guid, ::Windows::ApplicationModel::Background::BackgroundTaskRegistration^>^ result = wrapper->_instance->AllTasks;
        info.GetReturnValue().Set(NodeRT::Collections::MapViewWrapper<::Platform::Guid,::Windows::ApplicationModel::Background::BackgroundTaskRegistration^>::CreateMapViewWrapper(result, 
            [](::Platform::Guid val) -> Local<Value> {
              return NodeRT::Utils::GuidToJs(val);
            },
            [](Local<Value> value) -> bool {
              return NodeRT::Utils::IsGuid(value);
            },
            [](Local<Value> value) -> ::Platform::Guid {
              return NodeRT::Utils::GuidFromJs(value);
            },
            [](::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ val) -> Local<Value> {
              return WrapBackgroundTaskRegistration(val);
            }
          ));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void IdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^>(info.This())) {
        return;
      }

      BackgroundTaskRegistrationGroup *wrapper = BackgroundTaskRegistrationGroup::Unwrap<BackgroundTaskRegistrationGroup>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->Id;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void NameGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^>(info.This())) {
        return;
      }

      BackgroundTaskRegistrationGroup *wrapper = BackgroundTaskRegistrationGroup::Unwrap<BackgroundTaskRegistrationGroup>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->Name;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    static void AddListener(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected arguments are eventName(string),callback(function)")));
        return;
      }

      String::Value eventName(v8::Isolate::GetCurrent(), info[0]);
      auto str = *eventName;

      Local<Function> callback = info[1].As<Function>();

      ::Windows::Foundation::EventRegistrationToken registrationToken;
      if (NodeRT::Utils::CaseInsenstiveEquals(L"backgroundActivated", str))
      {
        if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^>(info.This()))
        {
          Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
      return;
        }
        BackgroundTaskRegistrationGroup *wrapper = BackgroundTaskRegistrationGroup::Unwrap<BackgroundTaskRegistrationGroup>(info.This());
      
        try {
          Persistent<Object>* perstPtr = new Persistent<Object>();
          perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
          std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
            [] (Persistent<Object> *ptr ) {
              NodeUtils::Async::RunOnMain([ptr]() {
                ptr->Reset();
                delete ptr;
            });
          });

          registrationToken = wrapper->_instance->BackgroundActivated::add(
            ref new ::Windows::Foundation::TypedEventHandler<::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^, ::Windows::ApplicationModel::Activation::BackgroundActivatedEventArgs^>(
            [callbackObjPtr](::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ arg0, ::Windows::ApplicationModel::Activation::BackgroundActivatedEventArgs^ arg1) {
              NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
                HandleScope scope;


                Local<Value> wrappedArg0;
                Local<Value> wrappedArg1;

                {
                  TryCatch tryCatch;


                  wrappedArg0 = WrapBackgroundTaskRegistrationGroup(arg0);
                  wrappedArg1 = NodeRT::Utils::CreateExternalWinRTObject("Windows.ApplicationModel.Activation", "BackgroundActivatedEventArgs", arg1);


                  if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
                  if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
                }

                Local<Value> args[] = { wrappedArg0, wrappedArg1 };
                Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
                NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
              });
            })
          );
        }
        catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }

      }
 else  {
        Nan::ThrowError(Nan::Error(String::Concat(v8::Isolate::GetCurrent(), NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
        return;
      }

      Local<Value> tokenMapVal = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
      Local<Object> tokenMap;

      if (tokenMapVal.IsEmpty() || Nan::Equals(tokenMapVal, Undefined()).FromMaybe(false)) {
        tokenMap = Nan::New<Object>();
        NodeRT::Utils::SetHiddenValueWithObject(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked(), tokenMap);
      } else {
        tokenMap = Nan::To<Object>(tokenMapVal).ToLocalChecked();
      }

      Nan::Set(tokenMap, info[0], CreateOpaqueWrapper(::Windows::Foundation::PropertyValue::CreateInt64(registrationToken.Value)));
    }

    static void RemoveListener(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected a string and a callback")));
        return;
      }

      String::Value eventName(v8::Isolate::GetCurrent(), info[0]);
      auto str = *eventName;

      if ((!NodeRT::Utils::CaseInsenstiveEquals(L"backgroundActivated", str))) {
        Nan::ThrowError(Nan::Error(String::Concat(v8::Isolate::GetCurrent(), NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
        return;
      }

      Local<Function> callback = info[1].As<Function>();
      Local<Value> tokenMap = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());

      if (tokenMap.IsEmpty() || Nan::Equals(tokenMap, Undefined()).FromMaybe(false)) {
        return;
      }

      Local<Value> opaqueWrapperObj =  Nan::Get(Nan::To<Object>(tokenMap).ToLocalChecked(), info[0]).ToLocalChecked();

      if (opaqueWrapperObj.IsEmpty() || Nan::Equals(opaqueWrapperObj,Undefined()).FromMaybe(false)) {
        return;
      }

      OpaqueWrapper *opaqueWrapper = OpaqueWrapper::Unwrap<OpaqueWrapper>(opaqueWrapperObj.As<Object>());

      long long tokenValue = (long long) opaqueWrapper->GetObjectInstance();
      ::Windows::Foundation::EventRegistrationToken registrationToken;
      registrationToken.Value = tokenValue;

      try  {
        if (NodeRT::Utils::CaseInsenstiveEquals(L"backgroundActivated", str)) {
          if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^>(info.This()))
          {
            Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
            return;
          }
          BackgroundTaskRegistrationGroup *wrapper = BackgroundTaskRegistrationGroup::Unwrap<BackgroundTaskRegistrationGroup>(info.This());
          wrapper->_instance->BackgroundActivated::remove(registrationToken);
        }
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }

      Nan::Delete(Nan::To<Object>(tokenMap).ToLocalChecked(), Nan::To<String>(info[0]).ToLocalChecked());
    }
    private:
      ::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapBackgroundTaskRegistrationGroup(::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ UnwrapBackgroundTaskRegistrationGroup(Local<Value> value);
  };

  Persistent<FunctionTemplate> BackgroundTaskRegistrationGroup::s_constructorTemplate;

  v8::Local<v8::Value> WrapBackgroundTaskRegistrationGroup(::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(BackgroundTaskRegistrationGroup::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ UnwrapBackgroundTaskRegistrationGroup(Local<Value> value) {
     return BackgroundTaskRegistrationGroup::Unwrap<BackgroundTaskRegistrationGroup>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitBackgroundTaskRegistrationGroup(Local<Object> exports) {
    BackgroundTaskRegistrationGroup::Init(exports);
  }

  class IBackgroundCondition : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IBackgroundCondition").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IBackgroundCondition").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IBackgroundCondition(::Windows::ApplicationModel::Background::IBackgroundCondition^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::IBackgroundCondition^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundCondition^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundCondition^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IBackgroundCondition *wrapperInstance = new IBackgroundCondition(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundCondition^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::IBackgroundCondition^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::IBackgroundCondition^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIBackgroundCondition(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::IBackgroundCondition^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIBackgroundCondition(::Windows::ApplicationModel::Background::IBackgroundCondition^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::IBackgroundCondition^ UnwrapIBackgroundCondition(Local<Value> value);
  };

  Persistent<FunctionTemplate> IBackgroundCondition::s_constructorTemplate;

  v8::Local<v8::Value> WrapIBackgroundCondition(::Windows::ApplicationModel::Background::IBackgroundCondition^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IBackgroundCondition::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::IBackgroundCondition^ UnwrapIBackgroundCondition(Local<Value> value) {
     return IBackgroundCondition::Unwrap<IBackgroundCondition>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIBackgroundCondition(Local<Object> exports) {
    IBackgroundCondition::Init(exports);
  }

  class BackgroundTaskBuilder : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("BackgroundTaskBuilder").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "setTrigger", SetTrigger);
            Nan::SetPrototypeMethod(localRef, "addCondition", AddCondition);
            Nan::SetPrototypeMethod(localRef, "register", Register);
          



          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("taskEntryPoint").ToLocalChecked(), TaskEntryPointGetter, TaskEntryPointSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("name").ToLocalChecked(), NameGetter, NameSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("cancelOnConditionLoss").ToLocalChecked(), CancelOnConditionLossGetter, CancelOnConditionLossSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("isNetworkRequested").ToLocalChecked(), IsNetworkRequestedGetter, IsNetworkRequestedSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("taskGroup").ToLocalChecked(), TaskGroupGetter, TaskGroupSetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("BackgroundTaskBuilder").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      BackgroundTaskBuilder(::Windows::ApplicationModel::Background::BackgroundTaskBuilder^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::BackgroundTaskBuilder^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskBuilder^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::BackgroundTaskBuilder^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::BackgroundTaskBuilder();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      BackgroundTaskBuilder *wrapperInstance = new BackgroundTaskBuilder(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskBuilder^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::BackgroundTaskBuilder^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::BackgroundTaskBuilder^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapBackgroundTaskBuilder(winRtInstance));
    }


    static void SetTrigger(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskBuilder^>(info.This())) {
        return;
      }

      BackgroundTaskBuilder *wrapper = BackgroundTaskBuilder::Unwrap<BackgroundTaskBuilder>(info.This());

      if (info.Length() == 1
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundTrigger^>(info[0]))
      {
        try
        {
          ::Windows::ApplicationModel::Background::IBackgroundTrigger^ arg0 = UnwrapIBackgroundTrigger(info[0]);
          
          wrapper->_instance->SetTrigger(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void AddCondition(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskBuilder^>(info.This())) {
        return;
      }

      BackgroundTaskBuilder *wrapper = BackgroundTaskBuilder::Unwrap<BackgroundTaskBuilder>(info.This());

      if (info.Length() == 1
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::IBackgroundCondition^>(info[0]))
      {
        try
        {
          ::Windows::ApplicationModel::Background::IBackgroundCondition^ arg0 = UnwrapIBackgroundCondition(info[0]);
          
          wrapper->_instance->AddCondition(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void Register(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskBuilder^>(info.This())) {
        return;
      }

      BackgroundTaskBuilder *wrapper = BackgroundTaskBuilder::Unwrap<BackgroundTaskBuilder>(info.This());

      if (info.Length() == 0)
      {
        try
        {
          ::Windows::ApplicationModel::Background::BackgroundTaskRegistration^ result;
          result = wrapper->_instance->Register();
          info.GetReturnValue().Set(WrapBackgroundTaskRegistration(result));
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    static void TaskEntryPointGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskBuilder^>(info.This())) {
        return;
      }

      BackgroundTaskBuilder *wrapper = BackgroundTaskBuilder::Unwrap<BackgroundTaskBuilder>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->TaskEntryPoint;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void TaskEntryPointSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsString()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskBuilder^>(info.This())) {
        return;
      }

      BackgroundTaskBuilder *wrapper = BackgroundTaskBuilder::Unwrap<BackgroundTaskBuilder>(info.This());

      try {

        Platform::String^ winRtValue = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), value)));

        wrapper->_instance->TaskEntryPoint = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void NameGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskBuilder^>(info.This())) {
        return;
      }

      BackgroundTaskBuilder *wrapper = BackgroundTaskBuilder::Unwrap<BackgroundTaskBuilder>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->Name;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void NameSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsString()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskBuilder^>(info.This())) {
        return;
      }

      BackgroundTaskBuilder *wrapper = BackgroundTaskBuilder::Unwrap<BackgroundTaskBuilder>(info.This());

      try {

        Platform::String^ winRtValue = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), value)));

        wrapper->_instance->Name = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void CancelOnConditionLossGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskBuilder^>(info.This())) {
        return;
      }

      BackgroundTaskBuilder *wrapper = BackgroundTaskBuilder::Unwrap<BackgroundTaskBuilder>(info.This());

      try  {
        bool result = wrapper->_instance->CancelOnConditionLoss;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void CancelOnConditionLossSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsBoolean()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskBuilder^>(info.This())) {
        return;
      }

      BackgroundTaskBuilder *wrapper = BackgroundTaskBuilder::Unwrap<BackgroundTaskBuilder>(info.This());

      try {

        bool winRtValue = Nan::To<bool>(value).FromMaybe(false);

        wrapper->_instance->CancelOnConditionLoss = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void IsNetworkRequestedGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskBuilder^>(info.This())) {
        return;
      }

      BackgroundTaskBuilder *wrapper = BackgroundTaskBuilder::Unwrap<BackgroundTaskBuilder>(info.This());

      try  {
        bool result = wrapper->_instance->IsNetworkRequested;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void IsNetworkRequestedSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsBoolean()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskBuilder^>(info.This())) {
        return;
      }

      BackgroundTaskBuilder *wrapper = BackgroundTaskBuilder::Unwrap<BackgroundTaskBuilder>(info.This());

      try {

        bool winRtValue = Nan::To<bool>(value).FromMaybe(false);

        wrapper->_instance->IsNetworkRequested = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void TaskGroupGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskBuilder^>(info.This())) {
        return;
      }

      BackgroundTaskBuilder *wrapper = BackgroundTaskBuilder::Unwrap<BackgroundTaskBuilder>(info.This());

      try  {
        ::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ result = wrapper->_instance->TaskGroup;
        info.GetReturnValue().Set(WrapBackgroundTaskRegistrationGroup(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void TaskGroupSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^>(value)) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundTaskBuilder^>(info.This())) {
        return;
      }

      BackgroundTaskBuilder *wrapper = BackgroundTaskBuilder::Unwrap<BackgroundTaskBuilder>(info.This());

      try {

        ::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^ winRtValue = dynamic_cast<::Windows::ApplicationModel::Background::BackgroundTaskRegistrationGroup^>(NodeRT::Utils::GetObjectInstance(value));

        wrapper->_instance->TaskGroup = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::BackgroundTaskBuilder^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapBackgroundTaskBuilder(::Windows::ApplicationModel::Background::BackgroundTaskBuilder^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::BackgroundTaskBuilder^ UnwrapBackgroundTaskBuilder(Local<Value> value);
  };

  Persistent<FunctionTemplate> BackgroundTaskBuilder::s_constructorTemplate;

  v8::Local<v8::Value> WrapBackgroundTaskBuilder(::Windows::ApplicationModel::Background::BackgroundTaskBuilder^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(BackgroundTaskBuilder::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::BackgroundTaskBuilder^ UnwrapBackgroundTaskBuilder(Local<Value> value) {
     return BackgroundTaskBuilder::Unwrap<BackgroundTaskBuilder>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitBackgroundTaskBuilder(Local<Object> exports) {
    BackgroundTaskBuilder::Init(exports);
  }

  class BackgroundWorkCost : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("BackgroundWorkCost").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);

        Nan::SetAccessor(constructor, Nan::New<String>("currentBackgroundWorkCost").ToLocalChecked(), CurrentBackgroundWorkCostGetter);


        Nan::Set(exports, Nan::New<String>("BackgroundWorkCost").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      BackgroundWorkCost(::Windows::ApplicationModel::Background::BackgroundWorkCost^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::BackgroundWorkCost^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundWorkCost^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::BackgroundWorkCost^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      BackgroundWorkCost *wrapperInstance = new BackgroundWorkCost(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BackgroundWorkCost^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::BackgroundWorkCost^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::BackgroundWorkCost^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapBackgroundWorkCost(winRtInstance));
    }







    static void CurrentBackgroundWorkCostGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      try
      {
        ::Windows::ApplicationModel::Background::BackgroundWorkCostValue result = ::Windows::ApplicationModel::Background::BackgroundWorkCost::CurrentBackgroundWorkCost;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      

    private:
      ::Windows::ApplicationModel::Background::BackgroundWorkCost^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapBackgroundWorkCost(::Windows::ApplicationModel::Background::BackgroundWorkCost^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::BackgroundWorkCost^ UnwrapBackgroundWorkCost(Local<Value> value);
  };

  Persistent<FunctionTemplate> BackgroundWorkCost::s_constructorTemplate;

  v8::Local<v8::Value> WrapBackgroundWorkCost(::Windows::ApplicationModel::Background::BackgroundWorkCost^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(BackgroundWorkCost::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::BackgroundWorkCost^ UnwrapBackgroundWorkCost(Local<Value> value) {
     return BackgroundWorkCost::Unwrap<BackgroundWorkCost>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitBackgroundWorkCost(Local<Object> exports) {
    BackgroundWorkCost::Init(exports);
  }

  class ChatMessageNotificationTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("ChatMessageNotificationTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("ChatMessageNotificationTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      ChatMessageNotificationTrigger(::Windows::ApplicationModel::Background::ChatMessageNotificationTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::ChatMessageNotificationTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ChatMessageNotificationTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::ChatMessageNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::ChatMessageNotificationTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      ChatMessageNotificationTrigger *wrapperInstance = new ChatMessageNotificationTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ChatMessageNotificationTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::ChatMessageNotificationTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::ChatMessageNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapChatMessageNotificationTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::ChatMessageNotificationTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapChatMessageNotificationTrigger(::Windows::ApplicationModel::Background::ChatMessageNotificationTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::ChatMessageNotificationTrigger^ UnwrapChatMessageNotificationTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> ChatMessageNotificationTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapChatMessageNotificationTrigger(::Windows::ApplicationModel::Background::ChatMessageNotificationTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(ChatMessageNotificationTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::ChatMessageNotificationTrigger^ UnwrapChatMessageNotificationTrigger(Local<Value> value) {
     return ChatMessageNotificationTrigger::Unwrap<ChatMessageNotificationTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitChatMessageNotificationTrigger(Local<Object> exports) {
    ChatMessageNotificationTrigger::Init(exports);
  }

  class ChatMessageReceivedNotificationTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("ChatMessageReceivedNotificationTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("ChatMessageReceivedNotificationTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      ChatMessageReceivedNotificationTrigger(::Windows::ApplicationModel::Background::ChatMessageReceivedNotificationTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::ChatMessageReceivedNotificationTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ChatMessageReceivedNotificationTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::ChatMessageReceivedNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::ChatMessageReceivedNotificationTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      ChatMessageReceivedNotificationTrigger *wrapperInstance = new ChatMessageReceivedNotificationTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ChatMessageReceivedNotificationTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::ChatMessageReceivedNotificationTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::ChatMessageReceivedNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapChatMessageReceivedNotificationTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::ChatMessageReceivedNotificationTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapChatMessageReceivedNotificationTrigger(::Windows::ApplicationModel::Background::ChatMessageReceivedNotificationTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::ChatMessageReceivedNotificationTrigger^ UnwrapChatMessageReceivedNotificationTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> ChatMessageReceivedNotificationTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapChatMessageReceivedNotificationTrigger(::Windows::ApplicationModel::Background::ChatMessageReceivedNotificationTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(ChatMessageReceivedNotificationTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::ChatMessageReceivedNotificationTrigger^ UnwrapChatMessageReceivedNotificationTrigger(Local<Value> value) {
     return ChatMessageReceivedNotificationTrigger::Unwrap<ChatMessageReceivedNotificationTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitChatMessageReceivedNotificationTrigger(Local<Object> exports) {
    ChatMessageReceivedNotificationTrigger::Init(exports);
  }

  class RcsEndUserMessageAvailableTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("RcsEndUserMessageAvailableTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("RcsEndUserMessageAvailableTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      RcsEndUserMessageAvailableTrigger(::Windows::ApplicationModel::Background::RcsEndUserMessageAvailableTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::RcsEndUserMessageAvailableTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::RcsEndUserMessageAvailableTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::RcsEndUserMessageAvailableTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::RcsEndUserMessageAvailableTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      RcsEndUserMessageAvailableTrigger *wrapperInstance = new RcsEndUserMessageAvailableTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::RcsEndUserMessageAvailableTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::RcsEndUserMessageAvailableTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::RcsEndUserMessageAvailableTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapRcsEndUserMessageAvailableTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::RcsEndUserMessageAvailableTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapRcsEndUserMessageAvailableTrigger(::Windows::ApplicationModel::Background::RcsEndUserMessageAvailableTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::RcsEndUserMessageAvailableTrigger^ UnwrapRcsEndUserMessageAvailableTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> RcsEndUserMessageAvailableTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapRcsEndUserMessageAvailableTrigger(::Windows::ApplicationModel::Background::RcsEndUserMessageAvailableTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(RcsEndUserMessageAvailableTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::RcsEndUserMessageAvailableTrigger^ UnwrapRcsEndUserMessageAvailableTrigger(Local<Value> value) {
     return RcsEndUserMessageAvailableTrigger::Unwrap<RcsEndUserMessageAvailableTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitRcsEndUserMessageAvailableTrigger(Local<Object> exports) {
    RcsEndUserMessageAvailableTrigger::Init(exports);
  }

  class ContactStoreNotificationTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("ContactStoreNotificationTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("ContactStoreNotificationTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      ContactStoreNotificationTrigger(::Windows::ApplicationModel::Background::ContactStoreNotificationTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::ContactStoreNotificationTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ContactStoreNotificationTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::ContactStoreNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::ContactStoreNotificationTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      ContactStoreNotificationTrigger *wrapperInstance = new ContactStoreNotificationTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ContactStoreNotificationTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::ContactStoreNotificationTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::ContactStoreNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapContactStoreNotificationTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::ContactStoreNotificationTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapContactStoreNotificationTrigger(::Windows::ApplicationModel::Background::ContactStoreNotificationTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::ContactStoreNotificationTrigger^ UnwrapContactStoreNotificationTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> ContactStoreNotificationTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapContactStoreNotificationTrigger(::Windows::ApplicationModel::Background::ContactStoreNotificationTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(ContactStoreNotificationTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::ContactStoreNotificationTrigger^ UnwrapContactStoreNotificationTrigger(Local<Value> value) {
     return ContactStoreNotificationTrigger::Unwrap<ContactStoreNotificationTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitContactStoreNotificationTrigger(Local<Object> exports) {
    ContactStoreNotificationTrigger::Init(exports);
  }

  class EmailStoreNotificationTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("EmailStoreNotificationTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("EmailStoreNotificationTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      EmailStoreNotificationTrigger(::Windows::ApplicationModel::Background::EmailStoreNotificationTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::EmailStoreNotificationTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::EmailStoreNotificationTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::EmailStoreNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::EmailStoreNotificationTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      EmailStoreNotificationTrigger *wrapperInstance = new EmailStoreNotificationTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::EmailStoreNotificationTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::EmailStoreNotificationTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::EmailStoreNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapEmailStoreNotificationTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::EmailStoreNotificationTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapEmailStoreNotificationTrigger(::Windows::ApplicationModel::Background::EmailStoreNotificationTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::EmailStoreNotificationTrigger^ UnwrapEmailStoreNotificationTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> EmailStoreNotificationTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapEmailStoreNotificationTrigger(::Windows::ApplicationModel::Background::EmailStoreNotificationTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(EmailStoreNotificationTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::EmailStoreNotificationTrigger^ UnwrapEmailStoreNotificationTrigger(Local<Value> value) {
     return EmailStoreNotificationTrigger::Unwrap<EmailStoreNotificationTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitEmailStoreNotificationTrigger(Local<Object> exports) {
    EmailStoreNotificationTrigger::Init(exports);
  }

  class MobileBroadbandRegistrationStateChangeTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("MobileBroadbandRegistrationStateChangeTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("MobileBroadbandRegistrationStateChangeTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      MobileBroadbandRegistrationStateChangeTrigger(::Windows::ApplicationModel::Background::MobileBroadbandRegistrationStateChangeTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::MobileBroadbandRegistrationStateChangeTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::MobileBroadbandRegistrationStateChangeTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::MobileBroadbandRegistrationStateChangeTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::MobileBroadbandRegistrationStateChangeTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      MobileBroadbandRegistrationStateChangeTrigger *wrapperInstance = new MobileBroadbandRegistrationStateChangeTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::MobileBroadbandRegistrationStateChangeTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::MobileBroadbandRegistrationStateChangeTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::MobileBroadbandRegistrationStateChangeTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapMobileBroadbandRegistrationStateChangeTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::MobileBroadbandRegistrationStateChangeTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapMobileBroadbandRegistrationStateChangeTrigger(::Windows::ApplicationModel::Background::MobileBroadbandRegistrationStateChangeTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::MobileBroadbandRegistrationStateChangeTrigger^ UnwrapMobileBroadbandRegistrationStateChangeTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> MobileBroadbandRegistrationStateChangeTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapMobileBroadbandRegistrationStateChangeTrigger(::Windows::ApplicationModel::Background::MobileBroadbandRegistrationStateChangeTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(MobileBroadbandRegistrationStateChangeTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::MobileBroadbandRegistrationStateChangeTrigger^ UnwrapMobileBroadbandRegistrationStateChangeTrigger(Local<Value> value) {
     return MobileBroadbandRegistrationStateChangeTrigger::Unwrap<MobileBroadbandRegistrationStateChangeTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitMobileBroadbandRegistrationStateChangeTrigger(Local<Object> exports) {
    MobileBroadbandRegistrationStateChangeTrigger::Init(exports);
  }

  class MobileBroadbandRadioStateChangeTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("MobileBroadbandRadioStateChangeTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("MobileBroadbandRadioStateChangeTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      MobileBroadbandRadioStateChangeTrigger(::Windows::ApplicationModel::Background::MobileBroadbandRadioStateChangeTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::MobileBroadbandRadioStateChangeTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::MobileBroadbandRadioStateChangeTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::MobileBroadbandRadioStateChangeTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::MobileBroadbandRadioStateChangeTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      MobileBroadbandRadioStateChangeTrigger *wrapperInstance = new MobileBroadbandRadioStateChangeTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::MobileBroadbandRadioStateChangeTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::MobileBroadbandRadioStateChangeTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::MobileBroadbandRadioStateChangeTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapMobileBroadbandRadioStateChangeTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::MobileBroadbandRadioStateChangeTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapMobileBroadbandRadioStateChangeTrigger(::Windows::ApplicationModel::Background::MobileBroadbandRadioStateChangeTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::MobileBroadbandRadioStateChangeTrigger^ UnwrapMobileBroadbandRadioStateChangeTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> MobileBroadbandRadioStateChangeTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapMobileBroadbandRadioStateChangeTrigger(::Windows::ApplicationModel::Background::MobileBroadbandRadioStateChangeTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(MobileBroadbandRadioStateChangeTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::MobileBroadbandRadioStateChangeTrigger^ UnwrapMobileBroadbandRadioStateChangeTrigger(Local<Value> value) {
     return MobileBroadbandRadioStateChangeTrigger::Unwrap<MobileBroadbandRadioStateChangeTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitMobileBroadbandRadioStateChangeTrigger(Local<Object> exports) {
    MobileBroadbandRadioStateChangeTrigger::Init(exports);
  }

  class MobileBroadbandPinLockStateChangeTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("MobileBroadbandPinLockStateChangeTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("MobileBroadbandPinLockStateChangeTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      MobileBroadbandPinLockStateChangeTrigger(::Windows::ApplicationModel::Background::MobileBroadbandPinLockStateChangeTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::MobileBroadbandPinLockStateChangeTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::MobileBroadbandPinLockStateChangeTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::MobileBroadbandPinLockStateChangeTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::MobileBroadbandPinLockStateChangeTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      MobileBroadbandPinLockStateChangeTrigger *wrapperInstance = new MobileBroadbandPinLockStateChangeTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::MobileBroadbandPinLockStateChangeTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::MobileBroadbandPinLockStateChangeTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::MobileBroadbandPinLockStateChangeTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapMobileBroadbandPinLockStateChangeTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::MobileBroadbandPinLockStateChangeTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapMobileBroadbandPinLockStateChangeTrigger(::Windows::ApplicationModel::Background::MobileBroadbandPinLockStateChangeTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::MobileBroadbandPinLockStateChangeTrigger^ UnwrapMobileBroadbandPinLockStateChangeTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> MobileBroadbandPinLockStateChangeTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapMobileBroadbandPinLockStateChangeTrigger(::Windows::ApplicationModel::Background::MobileBroadbandPinLockStateChangeTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(MobileBroadbandPinLockStateChangeTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::MobileBroadbandPinLockStateChangeTrigger^ UnwrapMobileBroadbandPinLockStateChangeTrigger(Local<Value> value) {
     return MobileBroadbandPinLockStateChangeTrigger::Unwrap<MobileBroadbandPinLockStateChangeTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitMobileBroadbandPinLockStateChangeTrigger(Local<Object> exports) {
    MobileBroadbandPinLockStateChangeTrigger::Init(exports);
  }

  class MobileBroadbandDeviceServiceNotificationTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("MobileBroadbandDeviceServiceNotificationTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("MobileBroadbandDeviceServiceNotificationTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      MobileBroadbandDeviceServiceNotificationTrigger(::Windows::ApplicationModel::Background::MobileBroadbandDeviceServiceNotificationTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::MobileBroadbandDeviceServiceNotificationTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::MobileBroadbandDeviceServiceNotificationTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::MobileBroadbandDeviceServiceNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::MobileBroadbandDeviceServiceNotificationTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      MobileBroadbandDeviceServiceNotificationTrigger *wrapperInstance = new MobileBroadbandDeviceServiceNotificationTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::MobileBroadbandDeviceServiceNotificationTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::MobileBroadbandDeviceServiceNotificationTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::MobileBroadbandDeviceServiceNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapMobileBroadbandDeviceServiceNotificationTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::MobileBroadbandDeviceServiceNotificationTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapMobileBroadbandDeviceServiceNotificationTrigger(::Windows::ApplicationModel::Background::MobileBroadbandDeviceServiceNotificationTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::MobileBroadbandDeviceServiceNotificationTrigger^ UnwrapMobileBroadbandDeviceServiceNotificationTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> MobileBroadbandDeviceServiceNotificationTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapMobileBroadbandDeviceServiceNotificationTrigger(::Windows::ApplicationModel::Background::MobileBroadbandDeviceServiceNotificationTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(MobileBroadbandDeviceServiceNotificationTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::MobileBroadbandDeviceServiceNotificationTrigger^ UnwrapMobileBroadbandDeviceServiceNotificationTrigger(Local<Value> value) {
     return MobileBroadbandDeviceServiceNotificationTrigger::Unwrap<MobileBroadbandDeviceServiceNotificationTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitMobileBroadbandDeviceServiceNotificationTrigger(Local<Object> exports) {
    MobileBroadbandDeviceServiceNotificationTrigger::Init(exports);
  }

  class SmsMessageReceivedTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("SmsMessageReceivedTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("SmsMessageReceivedTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      SmsMessageReceivedTrigger(::Windows::ApplicationModel::Background::SmsMessageReceivedTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::SmsMessageReceivedTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SmsMessageReceivedTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::SmsMessageReceivedTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Sms::SmsFilterRules^>(info[0]))
      {
        try {
          ::Windows::Devices::Sms::SmsFilterRules^ arg0 = dynamic_cast<::Windows::Devices::Sms::SmsFilterRules^>(NodeRT::Utils::GetObjectInstance(info[0]));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::SmsMessageReceivedTrigger(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      SmsMessageReceivedTrigger *wrapperInstance = new SmsMessageReceivedTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SmsMessageReceivedTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::SmsMessageReceivedTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::SmsMessageReceivedTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapSmsMessageReceivedTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::SmsMessageReceivedTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapSmsMessageReceivedTrigger(::Windows::ApplicationModel::Background::SmsMessageReceivedTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::SmsMessageReceivedTrigger^ UnwrapSmsMessageReceivedTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> SmsMessageReceivedTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapSmsMessageReceivedTrigger(::Windows::ApplicationModel::Background::SmsMessageReceivedTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(SmsMessageReceivedTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::SmsMessageReceivedTrigger^ UnwrapSmsMessageReceivedTrigger(Local<Value> value) {
     return SmsMessageReceivedTrigger::Unwrap<SmsMessageReceivedTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitSmsMessageReceivedTrigger(Local<Object> exports) {
    SmsMessageReceivedTrigger::Init(exports);
  }

  class StorageLibraryContentChangedTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("StorageLibraryContentChangedTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);

        Nan::SetMethod(constructor, "create", Create);
        Nan::SetMethod(constructor, "createFromLibraries", CreateFromLibraries);


        Nan::Set(exports, Nan::New<String>("StorageLibraryContentChangedTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      StorageLibraryContentChangedTrigger(::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      StorageLibraryContentChangedTrigger *wrapperInstance = new StorageLibraryContentChangedTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapStorageLibraryContentChangedTrigger(winRtInstance));
    }





    static void Create(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 1
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Storage::StorageLibrary^>(info[0]))
      {
        try
        {
          ::Windows::Storage::StorageLibrary^ arg0 = dynamic_cast<::Windows::Storage::StorageLibrary^>(NodeRT::Utils::GetObjectInstance(info[0]));
          
          ::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^ result;
          result = ::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger::Create(arg0);
          info.GetReturnValue().Set(WrapStorageLibraryContentChangedTrigger(result));
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }

    static void CreateFromLibraries(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 1
        && (NodeRT::Utils::IsWinRtWrapperOf<::Windows::Foundation::Collections::IIterable<::Windows::Storage::StorageLibrary^>^>(info[0]) || info[0]->IsArray()))
      {
        try
        {
          ::Windows::Foundation::Collections::IIterable<::Windows::Storage::StorageLibrary^>^ arg0 = 
            [] (v8::Local<v8::Value> value) -> ::Windows::Foundation::Collections::IIterable<::Windows::Storage::StorageLibrary^>^
            {
              if (value->IsArray())
              {
                return NodeRT::Collections::JsArrayToWinrtVector<::Windows::Storage::StorageLibrary^>(value.As<Array>(), 
                 [](Local<Value> value) -> bool {
                   return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Storage::StorageLibrary^>(value);
                 },
                 [](Local<Value> value) -> ::Windows::Storage::StorageLibrary^ {
                   return dynamic_cast<::Windows::Storage::StorageLibrary^>(NodeRT::Utils::GetObjectInstance(value));
                 }
                );
              }
              else
              {
                return dynamic_cast<::Windows::Foundation::Collections::IIterable<::Windows::Storage::StorageLibrary^>^>(NodeRT::Utils::GetObjectInstance(value));
              }
            } (info[0]);
          
          ::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^ result;
          result = ::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger::CreateFromLibraries(arg0);
          info.GetReturnValue().Set(WrapStorageLibraryContentChangedTrigger(result));
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    private:
      ::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapStorageLibraryContentChangedTrigger(::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^ UnwrapStorageLibraryContentChangedTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> StorageLibraryContentChangedTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapStorageLibraryContentChangedTrigger(::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(StorageLibraryContentChangedTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::StorageLibraryContentChangedTrigger^ UnwrapStorageLibraryContentChangedTrigger(Local<Value> value) {
     return StorageLibraryContentChangedTrigger::Unwrap<StorageLibraryContentChangedTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitStorageLibraryContentChangedTrigger(Local<Object> exports) {
    StorageLibraryContentChangedTrigger::Init(exports);
  }

  class DeviceUseTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("DeviceUseTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);

        Local<Function> func;
        Local<FunctionTemplate> funcTemplate;


          
            Nan::SetPrototypeMethod(localRef, "requestAsync", RequestAsync);
          



        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("DeviceUseTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      DeviceUseTrigger(::Windows::ApplicationModel::Background::DeviceUseTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::DeviceUseTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceUseTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::DeviceUseTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::DeviceUseTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      DeviceUseTrigger *wrapperInstance = new DeviceUseTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceUseTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::DeviceUseTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::DeviceUseTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapDeviceUseTrigger(winRtInstance));
    }

    static void RequestAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceUseTrigger^>(info.This())) {
        return;
      }

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      DeviceUseTrigger *wrapper = DeviceUseTrigger::Unwrap<DeviceUseTrigger>(info.This());

      ::Windows::Foundation::IAsyncOperation<::Windows::ApplicationModel::Background::DeviceTriggerResult>^ op;


      if (info.Length() == 2
        && info[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          op = wrapper->_instance->RequestAsync(arg0);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 3
        && info[0]->IsString()
        && info[1]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          Platform::String^ arg1 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[1])));
          
          op = wrapper->_instance->RequestAsync(arg0,arg1);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<::Windows::ApplicationModel::Background::DeviceTriggerResult> t) {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = Nan::New<Integer>(static_cast<int>(result));
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        } catch (Platform::Exception^ exception) {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }






    private:
      ::Windows::ApplicationModel::Background::DeviceUseTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapDeviceUseTrigger(::Windows::ApplicationModel::Background::DeviceUseTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::DeviceUseTrigger^ UnwrapDeviceUseTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> DeviceUseTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapDeviceUseTrigger(::Windows::ApplicationModel::Background::DeviceUseTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(DeviceUseTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::DeviceUseTrigger^ UnwrapDeviceUseTrigger(Local<Value> value) {
     return DeviceUseTrigger::Unwrap<DeviceUseTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitDeviceUseTrigger(Local<Object> exports) {
    DeviceUseTrigger::Init(exports);
  }

  class DeviceServicingTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("DeviceServicingTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);

        Local<Function> func;
        Local<FunctionTemplate> funcTemplate;


          
            Nan::SetPrototypeMethod(localRef, "requestAsync", RequestAsync);
          



        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("DeviceServicingTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      DeviceServicingTrigger(::Windows::ApplicationModel::Background::DeviceServicingTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::DeviceServicingTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceServicingTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::DeviceServicingTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::DeviceServicingTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      DeviceServicingTrigger *wrapperInstance = new DeviceServicingTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceServicingTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::DeviceServicingTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::DeviceServicingTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapDeviceServicingTrigger(winRtInstance));
    }

    static void RequestAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceServicingTrigger^>(info.This())) {
        return;
      }

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      DeviceServicingTrigger *wrapper = DeviceServicingTrigger::Unwrap<DeviceServicingTrigger>(info.This());

      ::Windows::Foundation::IAsyncOperation<::Windows::ApplicationModel::Background::DeviceTriggerResult>^ op;


      if (info.Length() == 3
        && info[0]->IsString()
        && info[1]->IsNumber())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          ::Windows::Foundation::TimeSpan arg1 = NodeRT::Utils::TimeSpanFromMilli(Nan::To<int64_t>(info[1]).FromMaybe(0));
          
          op = wrapper->_instance->RequestAsync(arg0,arg1);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 4
        && info[0]->IsString()
        && info[1]->IsNumber()
        && info[2]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          ::Windows::Foundation::TimeSpan arg1 = NodeRT::Utils::TimeSpanFromMilli(Nan::To<int64_t>(info[1]).FromMaybe(0));
          Platform::String^ arg2 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[2])));
          
          op = wrapper->_instance->RequestAsync(arg0,arg1,arg2);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<::Windows::ApplicationModel::Background::DeviceTriggerResult> t) {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = Nan::New<Integer>(static_cast<int>(result));
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        } catch (Platform::Exception^ exception) {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }






    private:
      ::Windows::ApplicationModel::Background::DeviceServicingTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapDeviceServicingTrigger(::Windows::ApplicationModel::Background::DeviceServicingTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::DeviceServicingTrigger^ UnwrapDeviceServicingTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> DeviceServicingTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapDeviceServicingTrigger(::Windows::ApplicationModel::Background::DeviceServicingTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(DeviceServicingTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::DeviceServicingTrigger^ UnwrapDeviceServicingTrigger(Local<Value> value) {
     return DeviceServicingTrigger::Unwrap<DeviceServicingTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitDeviceServicingTrigger(Local<Object> exports) {
    DeviceServicingTrigger::Init(exports);
  }

  class RfcommConnectionTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("RfcommConnectionTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("remoteHostName").ToLocalChecked(), RemoteHostNameGetter, RemoteHostNameSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("protectionLevel").ToLocalChecked(), ProtectionLevelGetter, ProtectionLevelSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("allowMultipleConnections").ToLocalChecked(), AllowMultipleConnectionsGetter, AllowMultipleConnectionsSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("inboundConnection").ToLocalChecked(), InboundConnectionGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("outboundConnection").ToLocalChecked(), OutboundConnectionGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("RfcommConnectionTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      RfcommConnectionTrigger(::Windows::ApplicationModel::Background::RfcommConnectionTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::RfcommConnectionTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::RfcommConnectionTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::RfcommConnectionTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::RfcommConnectionTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      RfcommConnectionTrigger *wrapperInstance = new RfcommConnectionTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::RfcommConnectionTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::RfcommConnectionTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::RfcommConnectionTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapRfcommConnectionTrigger(winRtInstance));
    }





    static void RemoteHostNameGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::RfcommConnectionTrigger^>(info.This())) {
        return;
      }

      RfcommConnectionTrigger *wrapper = RfcommConnectionTrigger::Unwrap<RfcommConnectionTrigger>(info.This());

      try  {
        ::Windows::Networking::HostName^ result = wrapper->_instance->RemoteHostName;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Networking", "HostName", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void RemoteHostNameSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Networking::HostName^>(value)) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::RfcommConnectionTrigger^>(info.This())) {
        return;
      }

      RfcommConnectionTrigger *wrapper = RfcommConnectionTrigger::Unwrap<RfcommConnectionTrigger>(info.This());

      try {

        ::Windows::Networking::HostName^ winRtValue = dynamic_cast<::Windows::Networking::HostName^>(NodeRT::Utils::GetObjectInstance(value));

        wrapper->_instance->RemoteHostName = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void ProtectionLevelGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::RfcommConnectionTrigger^>(info.This())) {
        return;
      }

      RfcommConnectionTrigger *wrapper = RfcommConnectionTrigger::Unwrap<RfcommConnectionTrigger>(info.This());

      try  {
        ::Windows::Networking::Sockets::SocketProtectionLevel result = wrapper->_instance->ProtectionLevel;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void ProtectionLevelSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsInt32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::RfcommConnectionTrigger^>(info.This())) {
        return;
      }

      RfcommConnectionTrigger *wrapper = RfcommConnectionTrigger::Unwrap<RfcommConnectionTrigger>(info.This());

      try {

        ::Windows::Networking::Sockets::SocketProtectionLevel winRtValue = static_cast<::Windows::Networking::Sockets::SocketProtectionLevel>(Nan::To<int32_t>(value).FromMaybe(0));

        wrapper->_instance->ProtectionLevel = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void AllowMultipleConnectionsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::RfcommConnectionTrigger^>(info.This())) {
        return;
      }

      RfcommConnectionTrigger *wrapper = RfcommConnectionTrigger::Unwrap<RfcommConnectionTrigger>(info.This());

      try  {
        bool result = wrapper->_instance->AllowMultipleConnections;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void AllowMultipleConnectionsSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsBoolean()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::RfcommConnectionTrigger^>(info.This())) {
        return;
      }

      RfcommConnectionTrigger *wrapper = RfcommConnectionTrigger::Unwrap<RfcommConnectionTrigger>(info.This());

      try {

        bool winRtValue = Nan::To<bool>(value).FromMaybe(false);

        wrapper->_instance->AllowMultipleConnections = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void InboundConnectionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::RfcommConnectionTrigger^>(info.This())) {
        return;
      }

      RfcommConnectionTrigger *wrapper = RfcommConnectionTrigger::Unwrap<RfcommConnectionTrigger>(info.This());

      try  {
        ::Windows::Devices::Bluetooth::Background::RfcommInboundConnectionInformation^ result = wrapper->_instance->InboundConnection;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Devices.Bluetooth.Background", "RfcommInboundConnectionInformation", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void OutboundConnectionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::RfcommConnectionTrigger^>(info.This())) {
        return;
      }

      RfcommConnectionTrigger *wrapper = RfcommConnectionTrigger::Unwrap<RfcommConnectionTrigger>(info.This());

      try  {
        ::Windows::Devices::Bluetooth::Background::RfcommOutboundConnectionInformation^ result = wrapper->_instance->OutboundConnection;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Devices.Bluetooth.Background", "RfcommOutboundConnectionInformation", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::RfcommConnectionTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapRfcommConnectionTrigger(::Windows::ApplicationModel::Background::RfcommConnectionTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::RfcommConnectionTrigger^ UnwrapRfcommConnectionTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> RfcommConnectionTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapRfcommConnectionTrigger(::Windows::ApplicationModel::Background::RfcommConnectionTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(RfcommConnectionTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::RfcommConnectionTrigger^ UnwrapRfcommConnectionTrigger(Local<Value> value) {
     return RfcommConnectionTrigger::Unwrap<RfcommConnectionTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitRfcommConnectionTrigger(Local<Object> exports) {
    RfcommConnectionTrigger::Init(exports);
  }

  class DeviceConnectionChangeTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("DeviceConnectionChangeTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);

        Local<Function> func;
        Local<FunctionTemplate> funcTemplate;




          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("maintainConnection").ToLocalChecked(), MaintainConnectionGetter, MaintainConnectionSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("canMaintainConnection").ToLocalChecked(), CanMaintainConnectionGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("deviceId").ToLocalChecked(), DeviceIdGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);

        func = Nan::GetFunction(Nan::New<FunctionTemplate>(FromIdAsync)).ToLocalChecked();
        Nan::Set(constructor, Nan::New<String>("fromIdAsync").ToLocalChecked(), func);


        Nan::Set(exports, Nan::New<String>("DeviceConnectionChangeTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      DeviceConnectionChangeTrigger(::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      DeviceConnectionChangeTrigger *wrapperInstance = new DeviceConnectionChangeTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapDeviceConnectionChangeTrigger(winRtInstance));
    }




    static void FromIdAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      ::Windows::Foundation::IAsyncOperation<::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^>^ op;


      if (info.Length() == 2
          && info[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
            
          op = ::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger::FromIdAsync(arg0);
        } catch (Platform::Exception ^exception) {
            NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
            return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^> t)
      {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = WrapDeviceConnectionChangeTrigger(result);
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        }
        catch (Platform::Exception^ exception)
        {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {

            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }


    static void MaintainConnectionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^>(info.This())) {
        return;
      }

      DeviceConnectionChangeTrigger *wrapper = DeviceConnectionChangeTrigger::Unwrap<DeviceConnectionChangeTrigger>(info.This());

      try  {
        bool result = wrapper->_instance->MaintainConnection;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void MaintainConnectionSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsBoolean()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^>(info.This())) {
        return;
      }

      DeviceConnectionChangeTrigger *wrapper = DeviceConnectionChangeTrigger::Unwrap<DeviceConnectionChangeTrigger>(info.This());

      try {

        bool winRtValue = Nan::To<bool>(value).FromMaybe(false);

        wrapper->_instance->MaintainConnection = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void CanMaintainConnectionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^>(info.This())) {
        return;
      }

      DeviceConnectionChangeTrigger *wrapper = DeviceConnectionChangeTrigger::Unwrap<DeviceConnectionChangeTrigger>(info.This());

      try  {
        bool result = wrapper->_instance->CanMaintainConnection;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void DeviceIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^>(info.This())) {
        return;
      }

      DeviceConnectionChangeTrigger *wrapper = DeviceConnectionChangeTrigger::Unwrap<DeviceConnectionChangeTrigger>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->DeviceId;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapDeviceConnectionChangeTrigger(::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^ UnwrapDeviceConnectionChangeTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> DeviceConnectionChangeTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapDeviceConnectionChangeTrigger(::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(DeviceConnectionChangeTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::DeviceConnectionChangeTrigger^ UnwrapDeviceConnectionChangeTrigger(Local<Value> value) {
     return DeviceConnectionChangeTrigger::Unwrap<DeviceConnectionChangeTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitDeviceConnectionChangeTrigger(Local<Object> exports) {
    DeviceConnectionChangeTrigger::Init(exports);
  }

  class GattCharacteristicNotificationTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("GattCharacteristicNotificationTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("characteristic").ToLocalChecked(), CharacteristicGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("eventTriggeringMode").ToLocalChecked(), EventTriggeringModeGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("GattCharacteristicNotificationTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      GattCharacteristicNotificationTrigger(::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 2
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info[0])
        && info[1]->IsInt32())
      {
        try {
          ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ arg0 = dynamic_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(NodeRT::Utils::GetObjectInstance(info[0]));
          ::Windows::Devices::Bluetooth::Background::BluetoothEventTriggeringMode arg1 = static_cast<::Windows::Devices::Bluetooth::Background::BluetoothEventTriggeringMode>(Nan::To<int32_t>(info[1]).FromMaybe(0));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger(arg0,arg1);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info[0]))
      {
        try {
          ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ arg0 = dynamic_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(NodeRT::Utils::GetObjectInstance(info[0]));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      GattCharacteristicNotificationTrigger *wrapperInstance = new GattCharacteristicNotificationTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapGattCharacteristicNotificationTrigger(winRtInstance));
    }





    static void CharacteristicGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^>(info.This())) {
        return;
      }

      GattCharacteristicNotificationTrigger *wrapper = GattCharacteristicNotificationTrigger::Unwrap<GattCharacteristicNotificationTrigger>(info.This());

      try  {
        ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ result = wrapper->_instance->Characteristic;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Devices.Bluetooth.GenericAttributeProfile", "GattCharacteristic", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void EventTriggeringModeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^>(info.This())) {
        return;
      }

      GattCharacteristicNotificationTrigger *wrapper = GattCharacteristicNotificationTrigger::Unwrap<GattCharacteristicNotificationTrigger>(info.This());

      try  {
        ::Windows::Devices::Bluetooth::Background::BluetoothEventTriggeringMode result = wrapper->_instance->EventTriggeringMode;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapGattCharacteristicNotificationTrigger(::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^ UnwrapGattCharacteristicNotificationTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> GattCharacteristicNotificationTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapGattCharacteristicNotificationTrigger(::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattCharacteristicNotificationTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::GattCharacteristicNotificationTrigger^ UnwrapGattCharacteristicNotificationTrigger(Local<Value> value) {
     return GattCharacteristicNotificationTrigger::Unwrap<GattCharacteristicNotificationTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitGattCharacteristicNotificationTrigger(Local<Object> exports) {
    GattCharacteristicNotificationTrigger::Init(exports);
  }

  class GattServiceProviderTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("GattServiceProviderTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);

        Local<Function> func;
        Local<FunctionTemplate> funcTemplate;




          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("advertisingParameters").ToLocalChecked(), AdvertisingParametersGetter, AdvertisingParametersSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("service").ToLocalChecked(), ServiceGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("triggerId").ToLocalChecked(), TriggerIdGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);

        func = Nan::GetFunction(Nan::New<FunctionTemplate>(CreateAsync)).ToLocalChecked();
        Nan::Set(constructor, Nan::New<String>("createAsync").ToLocalChecked(), func);


        Nan::Set(exports, Nan::New<String>("GattServiceProviderTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      GattServiceProviderTrigger(::Windows::ApplicationModel::Background::GattServiceProviderTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::GattServiceProviderTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::GattServiceProviderTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::GattServiceProviderTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      GattServiceProviderTrigger *wrapperInstance = new GattServiceProviderTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::GattServiceProviderTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::GattServiceProviderTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::GattServiceProviderTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapGattServiceProviderTrigger(winRtInstance));
    }




    static void CreateAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      ::Windows::Foundation::IAsyncOperation<::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^>^ op;


      if (info.Length() == 3
          && info[0]->IsString()
          && NodeRT::Utils::IsGuid(info[1]))
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          ::Platform::Guid arg1 = NodeRT::Utils::GuidFromJs(info[1]);
            
          op = ::Windows::ApplicationModel::Background::GattServiceProviderTrigger::CreateAsync(arg0,arg1);
        } catch (Platform::Exception ^exception) {
            NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
            return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^> t)
      {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = WrapGattServiceProviderTriggerResult(result);
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        }
        catch (Platform::Exception^ exception)
        {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {

            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }


    static void AdvertisingParametersGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::GattServiceProviderTrigger^>(info.This())) {
        return;
      }

      GattServiceProviderTrigger *wrapper = GattServiceProviderTrigger::Unwrap<GattServiceProviderTrigger>(info.This());

      try  {
        ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^ result = wrapper->_instance->AdvertisingParameters;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Devices.Bluetooth.GenericAttributeProfile", "GattServiceProviderAdvertisingParameters", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void AdvertisingParametersSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^>(value)) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::GattServiceProviderTrigger^>(info.This())) {
        return;
      }

      GattServiceProviderTrigger *wrapper = GattServiceProviderTrigger::Unwrap<GattServiceProviderTrigger>(info.This());

      try {

        ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^ winRtValue = dynamic_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^>(NodeRT::Utils::GetObjectInstance(value));

        wrapper->_instance->AdvertisingParameters = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void ServiceGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::GattServiceProviderTrigger^>(info.This())) {
        return;
      }

      GattServiceProviderTrigger *wrapper = GattServiceProviderTrigger::Unwrap<GattServiceProviderTrigger>(info.This());

      try  {
        ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^ result = wrapper->_instance->Service;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Devices.Bluetooth.GenericAttributeProfile", "GattLocalService", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void TriggerIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::GattServiceProviderTrigger^>(info.This())) {
        return;
      }

      GattServiceProviderTrigger *wrapper = GattServiceProviderTrigger::Unwrap<GattServiceProviderTrigger>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->TriggerId;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::GattServiceProviderTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapGattServiceProviderTrigger(::Windows::ApplicationModel::Background::GattServiceProviderTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::GattServiceProviderTrigger^ UnwrapGattServiceProviderTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> GattServiceProviderTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapGattServiceProviderTrigger(::Windows::ApplicationModel::Background::GattServiceProviderTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattServiceProviderTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::GattServiceProviderTrigger^ UnwrapGattServiceProviderTrigger(Local<Value> value) {
     return GattServiceProviderTrigger::Unwrap<GattServiceProviderTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitGattServiceProviderTrigger(Local<Object> exports) {
    GattServiceProviderTrigger::Init(exports);
  }

  class GattServiceProviderTriggerResult : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("GattServiceProviderTriggerResult").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("error").ToLocalChecked(), ErrorGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("trigger").ToLocalChecked(), TriggerGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("GattServiceProviderTriggerResult").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      GattServiceProviderTriggerResult(::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      GattServiceProviderTriggerResult *wrapperInstance = new GattServiceProviderTriggerResult(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapGattServiceProviderTriggerResult(winRtInstance));
    }





    static void ErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^>(info.This())) {
        return;
      }

      GattServiceProviderTriggerResult *wrapper = GattServiceProviderTriggerResult::Unwrap<GattServiceProviderTriggerResult>(info.This());

      try  {
        ::Windows::Devices::Bluetooth::BluetoothError result = wrapper->_instance->Error;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void TriggerGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^>(info.This())) {
        return;
      }

      GattServiceProviderTriggerResult *wrapper = GattServiceProviderTriggerResult::Unwrap<GattServiceProviderTriggerResult>(info.This());

      try  {
        ::Windows::ApplicationModel::Background::GattServiceProviderTrigger^ result = wrapper->_instance->Trigger;
        info.GetReturnValue().Set(WrapGattServiceProviderTrigger(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapGattServiceProviderTriggerResult(::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^ UnwrapGattServiceProviderTriggerResult(Local<Value> value);
  };

  Persistent<FunctionTemplate> GattServiceProviderTriggerResult::s_constructorTemplate;

  v8::Local<v8::Value> WrapGattServiceProviderTriggerResult(::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattServiceProviderTriggerResult::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::GattServiceProviderTriggerResult^ UnwrapGattServiceProviderTriggerResult(Local<Value> value) {
     return GattServiceProviderTriggerResult::Unwrap<GattServiceProviderTriggerResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitGattServiceProviderTriggerResult(Local<Object> exports) {
    GattServiceProviderTriggerResult::Init(exports);
  }

  class BluetoothLEAdvertisementWatcherTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("BluetoothLEAdvertisementWatcherTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("signalStrengthFilter").ToLocalChecked(), SignalStrengthFilterGetter, SignalStrengthFilterSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("advertisementFilter").ToLocalChecked(), AdvertisementFilterGetter, AdvertisementFilterSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("maxOutOfRangeTimeout").ToLocalChecked(), MaxOutOfRangeTimeoutGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("maxSamplingInterval").ToLocalChecked(), MaxSamplingIntervalGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("minOutOfRangeTimeout").ToLocalChecked(), MinOutOfRangeTimeoutGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("minSamplingInterval").ToLocalChecked(), MinSamplingIntervalGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("BluetoothLEAdvertisementWatcherTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      BluetoothLEAdvertisementWatcherTrigger(::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      BluetoothLEAdvertisementWatcherTrigger *wrapperInstance = new BluetoothLEAdvertisementWatcherTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapBluetoothLEAdvertisementWatcherTrigger(winRtInstance));
    }





    static void SignalStrengthFilterGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^>(info.This())) {
        return;
      }

      BluetoothLEAdvertisementWatcherTrigger *wrapper = BluetoothLEAdvertisementWatcherTrigger::Unwrap<BluetoothLEAdvertisementWatcherTrigger>(info.This());

      try  {
        ::Windows::Devices::Bluetooth::BluetoothSignalStrengthFilter^ result = wrapper->_instance->SignalStrengthFilter;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Devices.Bluetooth", "BluetoothSignalStrengthFilter", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void SignalStrengthFilterSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::BluetoothSignalStrengthFilter^>(value)) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^>(info.This())) {
        return;
      }

      BluetoothLEAdvertisementWatcherTrigger *wrapper = BluetoothLEAdvertisementWatcherTrigger::Unwrap<BluetoothLEAdvertisementWatcherTrigger>(info.This());

      try {

        ::Windows::Devices::Bluetooth::BluetoothSignalStrengthFilter^ winRtValue = dynamic_cast<::Windows::Devices::Bluetooth::BluetoothSignalStrengthFilter^>(NodeRT::Utils::GetObjectInstance(value));

        wrapper->_instance->SignalStrengthFilter = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void AdvertisementFilterGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^>(info.This())) {
        return;
      }

      BluetoothLEAdvertisementWatcherTrigger *wrapper = BluetoothLEAdvertisementWatcherTrigger::Unwrap<BluetoothLEAdvertisementWatcherTrigger>(info.This());

      try  {
        ::Windows::Devices::Bluetooth::Advertisement::BluetoothLEAdvertisementFilter^ result = wrapper->_instance->AdvertisementFilter;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Devices.Bluetooth.Advertisement", "BluetoothLEAdvertisementFilter", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void AdvertisementFilterSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::Advertisement::BluetoothLEAdvertisementFilter^>(value)) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^>(info.This())) {
        return;
      }

      BluetoothLEAdvertisementWatcherTrigger *wrapper = BluetoothLEAdvertisementWatcherTrigger::Unwrap<BluetoothLEAdvertisementWatcherTrigger>(info.This());

      try {

        ::Windows::Devices::Bluetooth::Advertisement::BluetoothLEAdvertisementFilter^ winRtValue = dynamic_cast<::Windows::Devices::Bluetooth::Advertisement::BluetoothLEAdvertisementFilter^>(NodeRT::Utils::GetObjectInstance(value));

        wrapper->_instance->AdvertisementFilter = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void MaxOutOfRangeTimeoutGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^>(info.This())) {
        return;
      }

      BluetoothLEAdvertisementWatcherTrigger *wrapper = BluetoothLEAdvertisementWatcherTrigger::Unwrap<BluetoothLEAdvertisementWatcherTrigger>(info.This());

      try  {
        ::Windows::Foundation::TimeSpan result = wrapper->_instance->MaxOutOfRangeTimeout;
        info.GetReturnValue().Set(Nan::New<Number>(result.Duration/10000.0));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void MaxSamplingIntervalGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^>(info.This())) {
        return;
      }

      BluetoothLEAdvertisementWatcherTrigger *wrapper = BluetoothLEAdvertisementWatcherTrigger::Unwrap<BluetoothLEAdvertisementWatcherTrigger>(info.This());

      try  {
        ::Windows::Foundation::TimeSpan result = wrapper->_instance->MaxSamplingInterval;
        info.GetReturnValue().Set(Nan::New<Number>(result.Duration/10000.0));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void MinOutOfRangeTimeoutGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^>(info.This())) {
        return;
      }

      BluetoothLEAdvertisementWatcherTrigger *wrapper = BluetoothLEAdvertisementWatcherTrigger::Unwrap<BluetoothLEAdvertisementWatcherTrigger>(info.This());

      try  {
        ::Windows::Foundation::TimeSpan result = wrapper->_instance->MinOutOfRangeTimeout;
        info.GetReturnValue().Set(Nan::New<Number>(result.Duration/10000.0));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void MinSamplingIntervalGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^>(info.This())) {
        return;
      }

      BluetoothLEAdvertisementWatcherTrigger *wrapper = BluetoothLEAdvertisementWatcherTrigger::Unwrap<BluetoothLEAdvertisementWatcherTrigger>(info.This());

      try  {
        ::Windows::Foundation::TimeSpan result = wrapper->_instance->MinSamplingInterval;
        info.GetReturnValue().Set(Nan::New<Number>(result.Duration/10000.0));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapBluetoothLEAdvertisementWatcherTrigger(::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^ UnwrapBluetoothLEAdvertisementWatcherTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> BluetoothLEAdvertisementWatcherTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapBluetoothLEAdvertisementWatcherTrigger(::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(BluetoothLEAdvertisementWatcherTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::BluetoothLEAdvertisementWatcherTrigger^ UnwrapBluetoothLEAdvertisementWatcherTrigger(Local<Value> value) {
     return BluetoothLEAdvertisementWatcherTrigger::Unwrap<BluetoothLEAdvertisementWatcherTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitBluetoothLEAdvertisementWatcherTrigger(Local<Object> exports) {
    BluetoothLEAdvertisementWatcherTrigger::Init(exports);
  }

  class BluetoothLEAdvertisementPublisherTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("BluetoothLEAdvertisementPublisherTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("advertisement").ToLocalChecked(), AdvertisementGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("BluetoothLEAdvertisementPublisherTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      BluetoothLEAdvertisementPublisherTrigger(::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      BluetoothLEAdvertisementPublisherTrigger *wrapperInstance = new BluetoothLEAdvertisementPublisherTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapBluetoothLEAdvertisementPublisherTrigger(winRtInstance));
    }





    static void AdvertisementGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger^>(info.This())) {
        return;
      }

      BluetoothLEAdvertisementPublisherTrigger *wrapper = BluetoothLEAdvertisementPublisherTrigger::Unwrap<BluetoothLEAdvertisementPublisherTrigger>(info.This());

      try  {
        ::Windows::Devices::Bluetooth::Advertisement::BluetoothLEAdvertisement^ result = wrapper->_instance->Advertisement;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Devices.Bluetooth.Advertisement", "BluetoothLEAdvertisement", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapBluetoothLEAdvertisementPublisherTrigger(::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger^ UnwrapBluetoothLEAdvertisementPublisherTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> BluetoothLEAdvertisementPublisherTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapBluetoothLEAdvertisementPublisherTrigger(::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(BluetoothLEAdvertisementPublisherTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::BluetoothLEAdvertisementPublisherTrigger^ UnwrapBluetoothLEAdvertisementPublisherTrigger(Local<Value> value) {
     return BluetoothLEAdvertisementPublisherTrigger::Unwrap<BluetoothLEAdvertisementPublisherTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitBluetoothLEAdvertisementPublisherTrigger(Local<Object> exports) {
    BluetoothLEAdvertisementPublisherTrigger::Init(exports);
  }

  class DeviceWatcherTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("DeviceWatcherTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("DeviceWatcherTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      DeviceWatcherTrigger(::Windows::ApplicationModel::Background::DeviceWatcherTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::DeviceWatcherTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceWatcherTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::DeviceWatcherTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      DeviceWatcherTrigger *wrapperInstance = new DeviceWatcherTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::DeviceWatcherTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::DeviceWatcherTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::DeviceWatcherTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapDeviceWatcherTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::DeviceWatcherTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapDeviceWatcherTrigger(::Windows::ApplicationModel::Background::DeviceWatcherTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::DeviceWatcherTrigger^ UnwrapDeviceWatcherTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> DeviceWatcherTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapDeviceWatcherTrigger(::Windows::ApplicationModel::Background::DeviceWatcherTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(DeviceWatcherTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::DeviceWatcherTrigger^ UnwrapDeviceWatcherTrigger(Local<Value> value) {
     return DeviceWatcherTrigger::Unwrap<DeviceWatcherTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitDeviceWatcherTrigger(Local<Object> exports) {
    DeviceWatcherTrigger::Init(exports);
  }

  class LocationTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("LocationTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("triggerType").ToLocalChecked(), TriggerTypeGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("LocationTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      LocationTrigger(::Windows::ApplicationModel::Background::LocationTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::LocationTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::LocationTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::LocationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsInt32())
      {
        try {
          ::Windows::ApplicationModel::Background::LocationTriggerType arg0 = static_cast<::Windows::ApplicationModel::Background::LocationTriggerType>(Nan::To<int32_t>(info[0]).FromMaybe(0));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::LocationTrigger(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      LocationTrigger *wrapperInstance = new LocationTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::LocationTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::LocationTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::LocationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapLocationTrigger(winRtInstance));
    }





    static void TriggerTypeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::LocationTrigger^>(info.This())) {
        return;
      }

      LocationTrigger *wrapper = LocationTrigger::Unwrap<LocationTrigger>(info.This());

      try  {
        ::Windows::ApplicationModel::Background::LocationTriggerType result = wrapper->_instance->TriggerType;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::LocationTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapLocationTrigger(::Windows::ApplicationModel::Background::LocationTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::LocationTrigger^ UnwrapLocationTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> LocationTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapLocationTrigger(::Windows::ApplicationModel::Background::LocationTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(LocationTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::LocationTrigger^ UnwrapLocationTrigger(Local<Value> value) {
     return LocationTrigger::Unwrap<LocationTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitLocationTrigger(Local<Object> exports) {
    LocationTrigger::Init(exports);
  }

  class ActivitySensorTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("ActivitySensorTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("minimumReportInterval").ToLocalChecked(), MinimumReportIntervalGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("reportInterval").ToLocalChecked(), ReportIntervalGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("subscribedActivities").ToLocalChecked(), SubscribedActivitiesGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("supportedActivities").ToLocalChecked(), SupportedActivitiesGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("ActivitySensorTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      ActivitySensorTrigger(::Windows::ApplicationModel::Background::ActivitySensorTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::ActivitySensorTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ActivitySensorTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::ActivitySensorTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsUint32())
      {
        try {
          unsigned int arg0 = static_cast<unsigned int>(Nan::To<uint32_t>(info[0]).FromMaybe(0));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::ActivitySensorTrigger(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      ActivitySensorTrigger *wrapperInstance = new ActivitySensorTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ActivitySensorTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::ActivitySensorTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::ActivitySensorTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapActivitySensorTrigger(winRtInstance));
    }





    static void MinimumReportIntervalGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ActivitySensorTrigger^>(info.This())) {
        return;
      }

      ActivitySensorTrigger *wrapper = ActivitySensorTrigger::Unwrap<ActivitySensorTrigger>(info.This());

      try  {
        unsigned int result = wrapper->_instance->MinimumReportInterval;
        info.GetReturnValue().Set(Nan::New<Integer>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void ReportIntervalGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ActivitySensorTrigger^>(info.This())) {
        return;
      }

      ActivitySensorTrigger *wrapper = ActivitySensorTrigger::Unwrap<ActivitySensorTrigger>(info.This());

      try  {
        unsigned int result = wrapper->_instance->ReportInterval;
        info.GetReturnValue().Set(Nan::New<Integer>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void SubscribedActivitiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ActivitySensorTrigger^>(info.This())) {
        return;
      }

      ActivitySensorTrigger *wrapper = ActivitySensorTrigger::Unwrap<ActivitySensorTrigger>(info.This());

      try  {
        ::Windows::Foundation::Collections::IVector<::Windows::Devices::Sensors::ActivityType>^ result = wrapper->_instance->SubscribedActivities;
        info.GetReturnValue().Set(NodeRT::Collections::VectorWrapper<::Windows::Devices::Sensors::ActivityType>::CreateVectorWrapper(result, 
            [](::Windows::Devices::Sensors::ActivityType val) -> Local<Value> {
              return Nan::New<Integer>(static_cast<int>(val));
            },
            [](Local<Value> value) -> bool {
              return value->IsInt32();
            },
            [](Local<Value> value) -> ::Windows::Devices::Sensors::ActivityType {
              return static_cast<::Windows::Devices::Sensors::ActivityType>(Nan::To<int32_t>(value).FromMaybe(0));
            }
          ));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void SupportedActivitiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ActivitySensorTrigger^>(info.This())) {
        return;
      }

      ActivitySensorTrigger *wrapper = ActivitySensorTrigger::Unwrap<ActivitySensorTrigger>(info.This());

      try  {
        ::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Sensors::ActivityType>^ result = wrapper->_instance->SupportedActivities;
        info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Sensors::ActivityType>::CreateVectorViewWrapper(result, 
            [](::Windows::Devices::Sensors::ActivityType val) -> Local<Value> {
              return Nan::New<Integer>(static_cast<int>(val));
            },
            [](Local<Value> value) -> bool {
              return value->IsInt32();
            },
            [](Local<Value> value) -> ::Windows::Devices::Sensors::ActivityType {
              return static_cast<::Windows::Devices::Sensors::ActivityType>(Nan::To<int32_t>(value).FromMaybe(0));
            }
          ));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::ActivitySensorTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapActivitySensorTrigger(::Windows::ApplicationModel::Background::ActivitySensorTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::ActivitySensorTrigger^ UnwrapActivitySensorTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> ActivitySensorTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapActivitySensorTrigger(::Windows::ApplicationModel::Background::ActivitySensorTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(ActivitySensorTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::ActivitySensorTrigger^ UnwrapActivitySensorTrigger(Local<Value> value) {
     return ActivitySensorTrigger::Unwrap<ActivitySensorTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitActivitySensorTrigger(Local<Object> exports) {
    ActivitySensorTrigger::Init(exports);
  }

  class SensorDataThresholdTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("SensorDataThresholdTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("SensorDataThresholdTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      SensorDataThresholdTrigger(::Windows::ApplicationModel::Background::SensorDataThresholdTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::SensorDataThresholdTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SensorDataThresholdTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::SensorDataThresholdTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Sensors::ISensorDataThreshold^>(info[0]))
      {
        try {
          ::Windows::Devices::Sensors::ISensorDataThreshold^ arg0 = dynamic_cast<::Windows::Devices::Sensors::ISensorDataThreshold^>(NodeRT::Utils::GetObjectInstance(info[0]));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::SensorDataThresholdTrigger(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      SensorDataThresholdTrigger *wrapperInstance = new SensorDataThresholdTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SensorDataThresholdTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::SensorDataThresholdTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::SensorDataThresholdTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapSensorDataThresholdTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::SensorDataThresholdTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapSensorDataThresholdTrigger(::Windows::ApplicationModel::Background::SensorDataThresholdTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::SensorDataThresholdTrigger^ UnwrapSensorDataThresholdTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> SensorDataThresholdTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapSensorDataThresholdTrigger(::Windows::ApplicationModel::Background::SensorDataThresholdTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(SensorDataThresholdTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::SensorDataThresholdTrigger^ UnwrapSensorDataThresholdTrigger(Local<Value> value) {
     return SensorDataThresholdTrigger::Unwrap<SensorDataThresholdTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitSensorDataThresholdTrigger(Local<Object> exports) {
    SensorDataThresholdTrigger::Init(exports);
  }

  class NetworkOperatorHotspotAuthenticationTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("NetworkOperatorHotspotAuthenticationTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("NetworkOperatorHotspotAuthenticationTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      NetworkOperatorHotspotAuthenticationTrigger(::Windows::ApplicationModel::Background::NetworkOperatorHotspotAuthenticationTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::NetworkOperatorHotspotAuthenticationTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::NetworkOperatorHotspotAuthenticationTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::NetworkOperatorHotspotAuthenticationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::NetworkOperatorHotspotAuthenticationTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      NetworkOperatorHotspotAuthenticationTrigger *wrapperInstance = new NetworkOperatorHotspotAuthenticationTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::NetworkOperatorHotspotAuthenticationTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::NetworkOperatorHotspotAuthenticationTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::NetworkOperatorHotspotAuthenticationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapNetworkOperatorHotspotAuthenticationTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::NetworkOperatorHotspotAuthenticationTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapNetworkOperatorHotspotAuthenticationTrigger(::Windows::ApplicationModel::Background::NetworkOperatorHotspotAuthenticationTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::NetworkOperatorHotspotAuthenticationTrigger^ UnwrapNetworkOperatorHotspotAuthenticationTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> NetworkOperatorHotspotAuthenticationTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapNetworkOperatorHotspotAuthenticationTrigger(::Windows::ApplicationModel::Background::NetworkOperatorHotspotAuthenticationTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(NetworkOperatorHotspotAuthenticationTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::NetworkOperatorHotspotAuthenticationTrigger^ UnwrapNetworkOperatorHotspotAuthenticationTrigger(Local<Value> value) {
     return NetworkOperatorHotspotAuthenticationTrigger::Unwrap<NetworkOperatorHotspotAuthenticationTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitNetworkOperatorHotspotAuthenticationTrigger(Local<Object> exports) {
    NetworkOperatorHotspotAuthenticationTrigger::Init(exports);
  }

  class SocketActivityTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("SocketActivityTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("isWakeFromLowPowerSupported").ToLocalChecked(), IsWakeFromLowPowerSupportedGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("SocketActivityTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      SocketActivityTrigger(::Windows::ApplicationModel::Background::SocketActivityTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::SocketActivityTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SocketActivityTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::SocketActivityTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::SocketActivityTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      SocketActivityTrigger *wrapperInstance = new SocketActivityTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SocketActivityTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::SocketActivityTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::SocketActivityTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapSocketActivityTrigger(winRtInstance));
    }





    static void IsWakeFromLowPowerSupportedGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::SocketActivityTrigger^>(info.This())) {
        return;
      }

      SocketActivityTrigger *wrapper = SocketActivityTrigger::Unwrap<SocketActivityTrigger>(info.This());

      try  {
        bool result = wrapper->_instance->IsWakeFromLowPowerSupported;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::SocketActivityTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapSocketActivityTrigger(::Windows::ApplicationModel::Background::SocketActivityTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::SocketActivityTrigger^ UnwrapSocketActivityTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> SocketActivityTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapSocketActivityTrigger(::Windows::ApplicationModel::Background::SocketActivityTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(SocketActivityTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::SocketActivityTrigger^ UnwrapSocketActivityTrigger(Local<Value> value) {
     return SocketActivityTrigger::Unwrap<SocketActivityTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitSocketActivityTrigger(Local<Object> exports) {
    SocketActivityTrigger::Init(exports);
  }

  class PushNotificationTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("PushNotificationTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("PushNotificationTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      PushNotificationTrigger(::Windows::ApplicationModel::Background::PushNotificationTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::PushNotificationTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::PushNotificationTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::PushNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsString())
      {
        try {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::PushNotificationTrigger(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::PushNotificationTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      PushNotificationTrigger *wrapperInstance = new PushNotificationTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::PushNotificationTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::PushNotificationTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::PushNotificationTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapPushNotificationTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::PushNotificationTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapPushNotificationTrigger(::Windows::ApplicationModel::Background::PushNotificationTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::PushNotificationTrigger^ UnwrapPushNotificationTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> PushNotificationTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapPushNotificationTrigger(::Windows::ApplicationModel::Background::PushNotificationTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(PushNotificationTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::PushNotificationTrigger^ UnwrapPushNotificationTrigger(Local<Value> value) {
     return PushNotificationTrigger::Unwrap<PushNotificationTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitPushNotificationTrigger(Local<Object> exports) {
    PushNotificationTrigger::Init(exports);
  }

  class ToastNotificationHistoryChangedTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("ToastNotificationHistoryChangedTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("ToastNotificationHistoryChangedTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      ToastNotificationHistoryChangedTrigger(::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsString())
      {
        try {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      ToastNotificationHistoryChangedTrigger *wrapperInstance = new ToastNotificationHistoryChangedTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapToastNotificationHistoryChangedTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapToastNotificationHistoryChangedTrigger(::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger^ UnwrapToastNotificationHistoryChangedTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> ToastNotificationHistoryChangedTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapToastNotificationHistoryChangedTrigger(::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(ToastNotificationHistoryChangedTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::ToastNotificationHistoryChangedTrigger^ UnwrapToastNotificationHistoryChangedTrigger(Local<Value> value) {
     return ToastNotificationHistoryChangedTrigger::Unwrap<ToastNotificationHistoryChangedTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitToastNotificationHistoryChangedTrigger(Local<Object> exports) {
    ToastNotificationHistoryChangedTrigger::Init(exports);
  }

  class ToastNotificationActionTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("ToastNotificationActionTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("ToastNotificationActionTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      ToastNotificationActionTrigger(::Windows::ApplicationModel::Background::ToastNotificationActionTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::ToastNotificationActionTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ToastNotificationActionTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::ToastNotificationActionTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsString())
      {
        try {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::ToastNotificationActionTrigger(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::ApplicationModel::Background::ToastNotificationActionTrigger();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      ToastNotificationActionTrigger *wrapperInstance = new ToastNotificationActionTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::ToastNotificationActionTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::ToastNotificationActionTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::ToastNotificationActionTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapToastNotificationActionTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::ToastNotificationActionTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapToastNotificationActionTrigger(::Windows::ApplicationModel::Background::ToastNotificationActionTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::ToastNotificationActionTrigger^ UnwrapToastNotificationActionTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> ToastNotificationActionTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapToastNotificationActionTrigger(::Windows::ApplicationModel::Background::ToastNotificationActionTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(ToastNotificationActionTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::ToastNotificationActionTrigger^ UnwrapToastNotificationActionTrigger(Local<Value> value) {
     return ToastNotificationActionTrigger::Unwrap<ToastNotificationActionTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitToastNotificationActionTrigger(Local<Object> exports) {
    ToastNotificationActionTrigger::Init(exports);
  }

  class UserNotificationChangedTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("UserNotificationChangedTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("UserNotificationChangedTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      UserNotificationChangedTrigger(::Windows::ApplicationModel::Background::UserNotificationChangedTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::UserNotificationChangedTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::UserNotificationChangedTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::UserNotificationChangedTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsInt32())
      {
        try {
          ::Windows::UI::Notifications::NotificationKinds arg0 = static_cast<::Windows::UI::Notifications::NotificationKinds>(Nan::To<int32_t>(info[0]).FromMaybe(0));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::UserNotificationChangedTrigger(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      UserNotificationChangedTrigger *wrapperInstance = new UserNotificationChangedTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::UserNotificationChangedTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::UserNotificationChangedTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::UserNotificationChangedTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapUserNotificationChangedTrigger(winRtInstance));
    }







    private:
      ::Windows::ApplicationModel::Background::UserNotificationChangedTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapUserNotificationChangedTrigger(::Windows::ApplicationModel::Background::UserNotificationChangedTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::UserNotificationChangedTrigger^ UnwrapUserNotificationChangedTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> UserNotificationChangedTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapUserNotificationChangedTrigger(::Windows::ApplicationModel::Background::UserNotificationChangedTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(UserNotificationChangedTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::UserNotificationChangedTrigger^ UnwrapUserNotificationChangedTrigger(Local<Value> value) {
     return UserNotificationChangedTrigger::Unwrap<UserNotificationChangedTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitUserNotificationChangedTrigger(Local<Object> exports) {
    UserNotificationChangedTrigger::Init(exports);
  }

  class AppBroadcastTriggerProviderInfo : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("AppBroadcastTriggerProviderInfo").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("videoKeyFrameInterval").ToLocalChecked(), VideoKeyFrameIntervalGetter, VideoKeyFrameIntervalSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("maxVideoWidth").ToLocalChecked(), MaxVideoWidthGetter, MaxVideoWidthSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("maxVideoHeight").ToLocalChecked(), MaxVideoHeightGetter, MaxVideoHeightSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("maxVideoBitrate").ToLocalChecked(), MaxVideoBitrateGetter, MaxVideoBitrateSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("logoResource").ToLocalChecked(), LogoResourceGetter, LogoResourceSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("displayNameResource").ToLocalChecked(), DisplayNameResourceGetter, DisplayNameResourceSetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("AppBroadcastTriggerProviderInfo").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      AppBroadcastTriggerProviderInfo(::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      AppBroadcastTriggerProviderInfo *wrapperInstance = new AppBroadcastTriggerProviderInfo(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapAppBroadcastTriggerProviderInfo(winRtInstance));
    }





    static void VideoKeyFrameIntervalGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(info.This())) {
        return;
      }

      AppBroadcastTriggerProviderInfo *wrapper = AppBroadcastTriggerProviderInfo::Unwrap<AppBroadcastTriggerProviderInfo>(info.This());

      try  {
        ::Windows::Foundation::TimeSpan result = wrapper->_instance->VideoKeyFrameInterval;
        info.GetReturnValue().Set(Nan::New<Number>(result.Duration/10000.0));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void VideoKeyFrameIntervalSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsNumber()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(info.This())) {
        return;
      }

      AppBroadcastTriggerProviderInfo *wrapper = AppBroadcastTriggerProviderInfo::Unwrap<AppBroadcastTriggerProviderInfo>(info.This());

      try {

        ::Windows::Foundation::TimeSpan winRtValue = NodeRT::Utils::TimeSpanFromMilli(Nan::To<int64_t>(value).FromMaybe(0));

        wrapper->_instance->VideoKeyFrameInterval = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void MaxVideoWidthGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(info.This())) {
        return;
      }

      AppBroadcastTriggerProviderInfo *wrapper = AppBroadcastTriggerProviderInfo::Unwrap<AppBroadcastTriggerProviderInfo>(info.This());

      try  {
        unsigned int result = wrapper->_instance->MaxVideoWidth;
        info.GetReturnValue().Set(Nan::New<Integer>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void MaxVideoWidthSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsUint32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(info.This())) {
        return;
      }

      AppBroadcastTriggerProviderInfo *wrapper = AppBroadcastTriggerProviderInfo::Unwrap<AppBroadcastTriggerProviderInfo>(info.This());

      try {

        unsigned int winRtValue = static_cast<unsigned int>(Nan::To<uint32_t>(value).FromMaybe(0));

        wrapper->_instance->MaxVideoWidth = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void MaxVideoHeightGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(info.This())) {
        return;
      }

      AppBroadcastTriggerProviderInfo *wrapper = AppBroadcastTriggerProviderInfo::Unwrap<AppBroadcastTriggerProviderInfo>(info.This());

      try  {
        unsigned int result = wrapper->_instance->MaxVideoHeight;
        info.GetReturnValue().Set(Nan::New<Integer>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void MaxVideoHeightSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsUint32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(info.This())) {
        return;
      }

      AppBroadcastTriggerProviderInfo *wrapper = AppBroadcastTriggerProviderInfo::Unwrap<AppBroadcastTriggerProviderInfo>(info.This());

      try {

        unsigned int winRtValue = static_cast<unsigned int>(Nan::To<uint32_t>(value).FromMaybe(0));

        wrapper->_instance->MaxVideoHeight = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void MaxVideoBitrateGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(info.This())) {
        return;
      }

      AppBroadcastTriggerProviderInfo *wrapper = AppBroadcastTriggerProviderInfo::Unwrap<AppBroadcastTriggerProviderInfo>(info.This());

      try  {
        unsigned int result = wrapper->_instance->MaxVideoBitrate;
        info.GetReturnValue().Set(Nan::New<Integer>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void MaxVideoBitrateSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsUint32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(info.This())) {
        return;
      }

      AppBroadcastTriggerProviderInfo *wrapper = AppBroadcastTriggerProviderInfo::Unwrap<AppBroadcastTriggerProviderInfo>(info.This());

      try {

        unsigned int winRtValue = static_cast<unsigned int>(Nan::To<uint32_t>(value).FromMaybe(0));

        wrapper->_instance->MaxVideoBitrate = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void LogoResourceGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(info.This())) {
        return;
      }

      AppBroadcastTriggerProviderInfo *wrapper = AppBroadcastTriggerProviderInfo::Unwrap<AppBroadcastTriggerProviderInfo>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->LogoResource;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void LogoResourceSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsString()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(info.This())) {
        return;
      }

      AppBroadcastTriggerProviderInfo *wrapper = AppBroadcastTriggerProviderInfo::Unwrap<AppBroadcastTriggerProviderInfo>(info.This());

      try {

        Platform::String^ winRtValue = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), value)));

        wrapper->_instance->LogoResource = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void DisplayNameResourceGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(info.This())) {
        return;
      }

      AppBroadcastTriggerProviderInfo *wrapper = AppBroadcastTriggerProviderInfo::Unwrap<AppBroadcastTriggerProviderInfo>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->DisplayNameResource;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void DisplayNameResourceSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsString()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(info.This())) {
        return;
      }

      AppBroadcastTriggerProviderInfo *wrapper = AppBroadcastTriggerProviderInfo::Unwrap<AppBroadcastTriggerProviderInfo>(info.This());

      try {

        Platform::String^ winRtValue = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), value)));

        wrapper->_instance->DisplayNameResource = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapAppBroadcastTriggerProviderInfo(::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^ UnwrapAppBroadcastTriggerProviderInfo(Local<Value> value);
  };

  Persistent<FunctionTemplate> AppBroadcastTriggerProviderInfo::s_constructorTemplate;

  v8::Local<v8::Value> WrapAppBroadcastTriggerProviderInfo(::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(AppBroadcastTriggerProviderInfo::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^ UnwrapAppBroadcastTriggerProviderInfo(Local<Value> value) {
     return AppBroadcastTriggerProviderInfo::Unwrap<AppBroadcastTriggerProviderInfo>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitAppBroadcastTriggerProviderInfo(Local<Object> exports) {
    AppBroadcastTriggerProviderInfo::Init(exports);
  }

  class AppBroadcastTrigger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("AppBroadcastTrigger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("providerInfo").ToLocalChecked(), ProviderInfoGetter, ProviderInfoSetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("AppBroadcastTrigger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      AppBroadcastTrigger(::Windows::ApplicationModel::Background::AppBroadcastTrigger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::ApplicationModel::Background::AppBroadcastTrigger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTrigger^>(info[0])) {
        try {
          winRtInstance = (::Windows::ApplicationModel::Background::AppBroadcastTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsString())
      {
        try {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          winRtInstance = ref new ::Windows::ApplicationModel::Background::AppBroadcastTrigger(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      AppBroadcastTrigger *wrapperInstance = new AppBroadcastTrigger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTrigger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::ApplicationModel::Background::AppBroadcastTrigger^ winRtInstance;
      try {
        winRtInstance = (::Windows::ApplicationModel::Background::AppBroadcastTrigger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapAppBroadcastTrigger(winRtInstance));
    }





    static void ProviderInfoGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTrigger^>(info.This())) {
        return;
      }

      AppBroadcastTrigger *wrapper = AppBroadcastTrigger::Unwrap<AppBroadcastTrigger>(info.This());

      try  {
        ::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^ result = wrapper->_instance->ProviderInfo;
        info.GetReturnValue().Set(WrapAppBroadcastTriggerProviderInfo(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void ProviderInfoSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(value)) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::ApplicationModel::Background::AppBroadcastTrigger^>(info.This())) {
        return;
      }

      AppBroadcastTrigger *wrapper = AppBroadcastTrigger::Unwrap<AppBroadcastTrigger>(info.This());

      try {

        ::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^ winRtValue = dynamic_cast<::Windows::ApplicationModel::Background::AppBroadcastTriggerProviderInfo^>(NodeRT::Utils::GetObjectInstance(value));

        wrapper->_instance->ProviderInfo = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      


    private:
      ::Windows::ApplicationModel::Background::AppBroadcastTrigger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapAppBroadcastTrigger(::Windows::ApplicationModel::Background::AppBroadcastTrigger^ wintRtInstance);
      friend ::Windows::ApplicationModel::Background::AppBroadcastTrigger^ UnwrapAppBroadcastTrigger(Local<Value> value);
  };

  Persistent<FunctionTemplate> AppBroadcastTrigger::s_constructorTemplate;

  v8::Local<v8::Value> WrapAppBroadcastTrigger(::Windows::ApplicationModel::Background::AppBroadcastTrigger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(AppBroadcastTrigger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::ApplicationModel::Background::AppBroadcastTrigger^ UnwrapAppBroadcastTrigger(Local<Value> value) {
     return AppBroadcastTrigger::Unwrap<AppBroadcastTrigger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitAppBroadcastTrigger(Local<Object> exports) {
    AppBroadcastTrigger::Init(exports);
  }


} } } } 

NAN_MODULE_INIT(init) {
  // We ignore failures for now since it probably means that
  // the initialization already happened for STA, and that's cool

  CoInitializeEx(nullptr, COINIT_MULTITHREADED);

  /*
  if (FAILED(CoInitializeEx(nullptr, COINIT_MULTITHREADED))) {
    Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"error in CoInitializeEx()")));
    return;
  }
  */

      NodeRT::Windows::ApplicationModel::Background::InitAlarmAccessStatusEnum(target);
      NodeRT::Windows::ApplicationModel::Background::InitApplicationTriggerResultEnum(target);
      NodeRT::Windows::ApplicationModel::Background::InitMediaProcessingTriggerResultEnum(target);
      NodeRT::Windows::ApplicationModel::Background::InitSystemTriggerTypeEnum(target);
      NodeRT::Windows::ApplicationModel::Background::InitSystemConditionTypeEnum(target);
      NodeRT::Windows::ApplicationModel::Background::InitBackgroundAccessStatusEnum(target);
      NodeRT::Windows::ApplicationModel::Background::InitBackgroundTaskCancellationReasonEnum(target);
      NodeRT::Windows::ApplicationModel::Background::InitBackgroundWorkCostValueEnum(target);
      NodeRT::Windows::ApplicationModel::Background::InitBackgroundTaskThrottleCounterEnum(target);
      NodeRT::Windows::ApplicationModel::Background::InitDeviceTriggerResultEnum(target);
      NodeRT::Windows::ApplicationModel::Background::InitLocationTriggerTypeEnum(target);
      NodeRT::Windows::ApplicationModel::Background::InitAlarmApplicationManager(target);
      NodeRT::Windows::ApplicationModel::Background::InitPhoneTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitCommunicationBlockingAppSetAsActiveTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitSmartCardTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitApplicationTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitApplicationTriggerDetails(target);
      NodeRT::Windows::ApplicationModel::Background::InitMediaProcessingTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitContentPrefetchTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitSecondaryAuthenticationFactorAuthenticationTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitSystemTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitSystemCondition(target);
      NodeRT::Windows::ApplicationModel::Background::InitNetworkOperatorNotificationTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitDeviceManufacturerNotificationTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitCachedFileUpdaterTriggerDetails(target);
      NodeRT::Windows::ApplicationModel::Background::InitCachedFileUpdaterTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitTimeTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitMaintenanceTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitAppointmentStoreNotificationTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitBackgroundExecutionManager(target);
      NodeRT::Windows::ApplicationModel::Background::InitIBackgroundTaskInstance(target);
      NodeRT::Windows::ApplicationModel::Background::InitBackgroundTaskRegistration(target);
      NodeRT::Windows::ApplicationModel::Background::InitBackgroundTaskDeferral(target);
      NodeRT::Windows::ApplicationModel::Background::InitBackgroundTaskProgressEventArgs(target);
      NodeRT::Windows::ApplicationModel::Background::InitBackgroundTaskCompletedEventArgs(target);
      NodeRT::Windows::ApplicationModel::Background::InitIBackgroundTaskInstance2(target);
      NodeRT::Windows::ApplicationModel::Background::InitIBackgroundTaskInstance4(target);
      NodeRT::Windows::ApplicationModel::Background::InitIBackgroundTask(target);
      NodeRT::Windows::ApplicationModel::Background::InitIBackgroundTaskRegistration(target);
      NodeRT::Windows::ApplicationModel::Background::InitIBackgroundTaskRegistration2(target);
      NodeRT::Windows::ApplicationModel::Background::InitIBackgroundTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitIBackgroundTaskRegistration3(target);
      NodeRT::Windows::ApplicationModel::Background::InitBackgroundTaskRegistrationGroup(target);
      NodeRT::Windows::ApplicationModel::Background::InitIBackgroundCondition(target);
      NodeRT::Windows::ApplicationModel::Background::InitBackgroundTaskBuilder(target);
      NodeRT::Windows::ApplicationModel::Background::InitBackgroundWorkCost(target);
      NodeRT::Windows::ApplicationModel::Background::InitChatMessageNotificationTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitChatMessageReceivedNotificationTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitRcsEndUserMessageAvailableTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitContactStoreNotificationTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitEmailStoreNotificationTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitMobileBroadbandRegistrationStateChangeTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitMobileBroadbandRadioStateChangeTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitMobileBroadbandPinLockStateChangeTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitMobileBroadbandDeviceServiceNotificationTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitSmsMessageReceivedTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitStorageLibraryContentChangedTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitDeviceUseTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitDeviceServicingTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitRfcommConnectionTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitDeviceConnectionChangeTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitGattCharacteristicNotificationTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitGattServiceProviderTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitGattServiceProviderTriggerResult(target);
      NodeRT::Windows::ApplicationModel::Background::InitBluetoothLEAdvertisementWatcherTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitBluetoothLEAdvertisementPublisherTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitDeviceWatcherTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitLocationTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitActivitySensorTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitSensorDataThresholdTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitNetworkOperatorHotspotAuthenticationTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitSocketActivityTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitPushNotificationTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitToastNotificationHistoryChangedTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitToastNotificationActionTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitUserNotificationChangedTrigger(target);
      NodeRT::Windows::ApplicationModel::Background::InitAppBroadcastTriggerProviderInfo(target);
      NodeRT::Windows::ApplicationModel::Background::InitAppBroadcastTrigger(target);


  NodeRT::Utils::RegisterNameSpace("Windows.ApplicationModel.Background", target);
}



NODE_MODULE(binding, init)
