public static PropertyPath FigureBinding(ComponentPath path, PropertyChangedEventHandler handler, bool resolveDataContext) { Type type; if (resolveDataContext && path.Component is DataContext) { type = (path.Component as DataContext).Type; } else { type = path.Component.GetType(); } var prop = new PropertyPath(path.Property, type, true); if (handler != null) { if (resolveDataContext && path.Component is DataContext) { (path.Component as DataContext).AddDependentProperty(prop, handler); } else { prop.AddHandler(path.Component, handler); } } return(prop); }
public static object GetValue(ComponentPath path, PropertyPath prop, bool resolveDataContext = true) { if (resolveDataContext && path.Component is DataContext) return (path.Component as DataContext).GetValue(prop); else return prop.GetValue(path.Component, null); }
void SaveVoiceMemo() { string compPath = ComponentPath.Replace(".", "_"); string fileName = AssessmentTrackingNumber + "_" + compPath + ".wav"; var filePath = recorder.GetAudioFilePath(); //Save DependencyService.Get <IDataCollectionDependencyService>().SaveVoiceMemo(filePath, AssessmentTrackingNumber, fileName); }
public static object GetValue(ComponentPath path, PropertyPath prop, bool resolveDataContext = true) { if (resolveDataContext && path.Component is DataContext) { return((path.Component as DataContext).GetValue(prop)); } else { return(prop.GetValue(path.Component, null)); } }
public static PropertyPath FigureBinding(ComponentPath path, Action handler, bool resolveDataContext) { Type type = PropertyBinding.GetComponentType(path.Component, resolveDataContext); var prop = new PropertyPath(path.Property, type, true); if (handler != null) { if (resolveDataContext && path.Component is DataContext) { (path.Component as DataContext).AddDependentProperty(prop, handler); } else { prop.AddHandler(path.Component, handler); } } return(prop); }
public static PropertyPath FigureBinding(ComponentPath path, PropertyChangedEventHandler handler, bool resolveDataContext) { Type type; if (resolveDataContext && path.Component is DataContext) type = (path.Component as DataContext).Type; else type = path.Component.GetType(); var prop = new PropertyPath(path.Property, type, true); if (handler != null) { if (resolveDataContext && path.Component is DataContext) (path.Component as DataContext).AddDependentProperty(prop, handler); else prop.AddHandler(path.Component, handler); } return prop; }
void Reset() { var context = gameObject.GetComponentInParent(typeof(DataContext)) as DataContext; if (context != null) { _source = new ComponentPath { Component = context } } ; var view = gameObject.GetComponents <UIBehaviour>().OrderBy((behaviour => OrderOnType(behaviour))).FirstOrDefault(); if (view != null) { _target = new ComponentPath { Component = view } } ; }
} // 此菜单关联的权限key. public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (MenuType == MenuEnumType.Menu) { if (Name.IsNullOrWhiteSpace()) { yield return(new ValidationResult("Name 不能为空", new[] { "Name" })); } if (DisplayName.IsNullOrWhiteSpace()) { yield return(new ValidationResult("DisplayName 不能为空", new[] { "DisplayName" })); } if (RouterPath.IsNullOrWhiteSpace()) { yield return(new ValidationResult("RouterPath 不能为空", new[] { "RouterPath" })); } if (ComponentPath.IsNullOrWhiteSpace()) { yield return(new ValidationResult("ComponentPath 不能为空", new[] { "ComponentPath" })); } } else if (MenuType == MenuEnumType.Permission) { if (DisplayName.IsNullOrWhiteSpace()) { yield return(new ValidationResult("DisplayName 不能为空", new[] { "DisplayName" })); } if (!ParentId.HasValue) { yield return(new ValidationResult("ParentId 不能为空", new[] { "ParentId" })); } } }
////////////////////////////////////////////////////////////////////////// private void implValidateComponent(ComponentPath componentPath, SerializationManager.SerializationInfoWrapper info) { info.Prefix = componentPath.InfoPrefix; implFindGameObjectComponent(componentPath.m_Path, Type.GetType(componentPath.m_Type), out var component); (component as SerializationManager.IComponent)?.iLoad(info); }
void Reset() { var context = gameObject.GetComponentInParent(typeof(DataContext)) as DataContext; if (context != null) _viewModel = new ComponentPath { Component = context }; var view = gameObject.GetComponents<UIBehaviour>().OrderBy((behaviour => OrderOnType(behaviour))).FirstOrDefault(); if (view != null) _view = new ComponentPath { Component = view }; }