Variant GetDPByExpExpression::Evaluate(Expressive::EvalContext* context)
{
	Object* obj = m_object->Evaluate(context);
	DependencyObject* depObj = dynamic_cast<DependencyObject*>(obj);
	if (depObj == NULL)
	{
		VERIFY(0);
	}
	Variant propertyRef = m_exp->Evaluate(context);

	PropertyValue* pProperty;

	if (propertyRef.IsString())
		pProperty = depObj->GetProperty(depObj->GetClass()->GetLocalProperty(propertyRef.ToString()));
	else if (propertyRef.IsInt())
		pProperty = depObj->GetProperty(depObj->GetClass()->GetLocalProperty((int)propertyRef));
	else
		throw new Exception("property not found");

	return pProperty->GetComputedValue();
}
bool GetDPByExpExpression::Set(Expressive::EvalContext* context, Variant value)
{
	Object* obj = m_object->Evaluate(context);
	DependencyObject* depObj = dynamic_cast<DependencyObject*>(obj);
	if (depObj == NULL)
	{
		VERIFY(0);
	}
	Variant propertyRef = m_exp->Evaluate(context);

	PropertyValue* pProperty;

	if (propertyRef.IsString())
		pProperty = depObj->GetProperty(depObj->GetClass()->GetLocalProperty(propertyRef.ToString()));
	else if (propertyRef.IsInt())
		pProperty = depObj->GetProperty(depObj->GetClass()->GetLocalProperty(int(propertyRef)));
	else
		raise(Exception("property not found"));

	pProperty->UpdateValue(value);
	return true;
}