protected override IBaseElement SpecificAction(IBaseElement instance, FieldInfo field, object parent, Type type) { var element = (WebBaseElement)instance; if (parent != null && type == null) { return(element); } var frameBy = FrameAttribute.GetFrame(field); if (frameBy != null) { element.WebAvatar.FrameLocator = frameBy; } return(element); }
private IBaseElement CreateChildFromFieldStatic(object parent, Type parentClass, FieldInfo field, string driverName) { var instance = (WebBaseElement)field.GetValue(parent); if (instance == null) { instance = ActionWithException( () => GetElementInstance(field, driverName), ex => $"Can't create child for parent '{parentClass.Name}' with type '{field.FieldType.Name}'. Exception: {ex}"); } else if (instance.Locator == null) { instance.WebAvatar.ByLocator = GetNewLocator(field); } instance.Frame = FrameAttribute.GetFrame(field); return(instance); }
public PassNode(NsNode parent, IList<Point3D> xyz, IList<Point3D> uvw, IList<double> speed, IList<double> caxis) : this(parent) { ContourAttribute pl = new ContourAttribute(this, null, xyz); Attributes.Add(pl); //pl.BlockRef.LayerIndex = 0; pl = new ContourAttribute(this, null, uvw); Attributes.Add(pl); //pl.BlockRef.LayerIndex = 1; ArrayAttribute aa = new ArrayAttribute(this, null, speed); Attributes.Add(aa); //aa.BlockRef.LayerIndex = 2; aa = new ArrayAttribute(this, null, caxis); Attributes.Add(aa); //aa.BlockRef.LayerIndex = 3; double scale = Length / 20.0; int mid = xyz.Count/2; Vector3D[] tpn = TPN(mid); //add a direction arrow ArrowAttribute arrow = new ArrowAttribute(this, XYZ(mid), tpn[0], tpn[1], tpn[2], scale); Attributes.Add(arrow); //arrow.BlockRef.LayerIndex = 4; //add a gantry frame for each point FrameAttribute gant; for( int i = 0; i < uvw.Count; i++ ) { tpn = TPN(i); if( tpn == null ) continue; gant = new FrameAttribute(this, XYZ(i), tpn[0], tpn[1], tpn[2], scale); Attributes.Add(gant); //gant.BlockRef.LayerIndex = 1; } }
protected override IBaseElement SpecificAction(IBaseElement instance, FieldInfo field, object parent, Type type) { var element = (WebBaseElement)instance; if (parent != null && type == null) { return(element); } var frameBy = FrameAttribute.GetFrame(field); if (frameBy != null) { element.WebAvatar.FrameLocator = frameBy; } By template; if (element.Parent is Form form && !element.HasLocator && (template = form.LocatorTemplate) != null) { element.WebAvatar.ByLocator = template.FillByTemplate(field.Name); } return(element); }
private void CreateContext(FieldInfo viElement, ref VIElement instance) { instance.Context.Add(Context); var frameAttr = FrameAttribute.GetFrame(viElement); if (frameAttr != null) { instance.Context.Add(ContextType.Frame, frameAttr); } var locatorAttr = LocatorAttribute.GetLocator(viElement) ?? LocatorAttribute.GetLocatorFomFindsBy(viElement); if (locatorAttr != null) { instance.Locator = locatorAttr; } if (_locator != null) { instance.Context.Add((this is Frame) ? ContextType.Frame : ContextType.Locator, _locator); } }
private IBaseElement CreateChildFromFieldStatic(object parent, Type parentClass, FieldInfo field, Type type, string driverName) { var instance = (WebBaseElement)field.GetValue(parent); if (instance == null) { instance = ActionWithException( () => GetElementInstance(field, driverName), ex => $"Can't create child for parent '{parentClass.Name}' with type '{field.FieldType.Name}'. Exception: {ex}"); } else if (instance.Locator == null) { instance.WebAvatar.ByLocator = GetNewLocator(field); } instance.WebAvatar.Context = parent is IBaseElement ? ((WebBaseElement)parent).WebAvatar.Context.Copy() : new Pairs <ContextType, By>(); if (parent == null || type != null) { var frameBy = FrameAttribute.GetFrame(field); if (frameBy != null) { instance.WebAvatar.Context.Add(ContextType.Frame, frameBy); } } if (parent is IBaseElement) { var parentLocator = ((WebBaseElement)parent).Locator; if (parentLocator != null) { instance.WebAvatar.Context.Add(ContextType.Locator, parentLocator); } } return(instance); }