[C++]C++ Nativated Property With Event Code Snippet
#pragma region Public Property public: declspec(property(get=Get$field$,put=Set$field$)) $type$ m_$field$; #pragma endregion
#pragma region Event public: __event void $field$Changing(void* sender, $eventArgs$* e); __event void $field$Changed(void* sender, $eventArgs$* e); #pragma endregion
#pragma region Property Process Method public: inline $type$ Get_$field$() { return _$field$; }
inline void Set_$field$($type$ value)
{
if(_$field$ == value)
return;
$eventArgs$ e;
On$field$Changing(&e);
_$field$ = value;
On$field$Changed(&e);
}
#pragma endregion
#pragma region Protected Method protected: void On$field$Changing($eventArgs$* e) { __raise $field$Changing(this, e); }
void On$field$Changed($eventArgs$* e)
{
__raise $field$Changed(this, e);
}
#pragma endregion
]]></Code> </Snippet> </CodeSnippet> </CodeSnippets>
#pragma region Public Property public: __declspec(property(get=Get_nValue,put=Set_nValue)) int m_nValue; #pragma endregion
#pragma region Event public: __event void nValueChanging(void* sender, EventArgs* e); __event void nValueChanged(void* sender, EventArgs* e); #pragma endregion
#pragma region Property Process Method public: inline int Get_nValue() { return _nValue; }
inline void Set_nValue(int value)
{
if(_nValue == value)
return;
EventArgs e;
OnnValueChanging(&e);
_nValue = value;
OnnValueChanged(&e);
}
#pragma endregion
#pragma region Protected Method protected: void OnnValueChanging(EventArgs* e) { __raise nValueChanging(this, e); }
void OnnValueChanged(EventArgs* e)
{
__raise nValueChanged(this, e);
}
#pragma endregion