private static void RunDesignModeValueProvider(object target, IPlatform platform, ValueTranslationService valueTranslationService, IType type, Type runtimeType, PropertyIdentifier property, ReferenceStep referenceStep, bool isFirstTime) { if (!runtimeType.IsAssignableFrom(target.GetType())) { return; } ModelItem modelItemForObject = DesignModeValueProviderService.GetModelItemForObject(platform, target); if (modelItemForObject == null) { return; } ReferenceStep referenceStep1 = (ReferenceStep)DesignTimeProperties.GetShadowProperty((IProperty)referenceStep, (ITypeId)type); try { object valueToSet; if (isFirstTime && !referenceStep1.IsSet(target)) { valueToSet = referenceStep.GetValue(target); referenceStep1.SetValue(target, valueToSet); } else { valueToSet = referenceStep1.GetValue(target); } referenceStep.SetValue(target, valueTranslationService.TranslatePropertyValue(runtimeType, modelItemForObject, property, valueToSet)); } catch (Exception ex) { } }
private static bool ShouldSet(SceneNode node, IPropertyId property) { ReferenceStep referenceStep = node.ProjectContext.ResolveProperty(property) as ReferenceStep; if (referenceStep == null) { return(false); } IViewObject viewObject = node.IsViewObjectValid ? node.ViewObject : (IViewObject)null; object objToInspect = viewObject != null ? viewObject.PlatformSpecificObject : (object)null; if (objToInspect == null || referenceStep.IsSet(objToInspect)) { return(false); } return(object.Equals(referenceStep.GetDefaultValue(objToInspect.GetType()), referenceStep.GetValue(objToInspect))); }