private static void magix_forms_set_video(object sender, ActiveEventArgs e) { Node ip = Ip(e.Params); if (ShouldInspect(ip)) { AppendInspectFromResource( ip["inspect"], "Magix.forms", "Magix.forms.hyperlisp.inspect.hl", "[magix.forms.set-video-dox].value"); AppendCodeFromResource( ip, "Magix.forms", "Magix.forms.hyperlisp.inspect.hl", "[magix.forms.set-video-sample]"); return; } Node dp = Dp(e.Params); if (!ip.ContainsValue("video")) { throw new ArgumentException("no [video] value given to [magix.forms.set-video]"); } string video = Expressions.GetExpressionValue <string>(ip["video"].Get <string>(), dp, ip, false); AttributeControl ctrl = FindControl <AttributeControl>(e.Params); ctrl.SetAttribute("src", video); }
private static void magix_forms_add_attribute(object sender, ActiveEventArgs e) { Node ip = Ip(e.Params); if (ShouldInspect(ip)) { AppendInspectFromResource( ip["inspect"], "Magix.forms", "Magix.forms.hyperlisp.inspect.hl", "[magix.forms.add-attribute-dox].value"); AppendCodeFromResource( ip, "Magix.forms", "Magix.forms.hyperlisp.inspect.hl", "[magix.forms.add-attribute-sample]"); return; } Node dp = Dp(e.Params); string name = Expressions.GetExpressionValue <string>(ip["name"].Get <string>(), dp, ip, false); string value = Expressions.GetExpressionValue <string>(ip["value"].Get <string>(), dp, ip, false); AttributeControl ctrl = FindControl <AttributeControl>(e.Params); ctrl.Attributes.Add(new AttributeControl.Attribute(name, value)); }
public void Ctor_Accepts_AttributeToReturn_Param_Array() { //Act var sc = new AttributeControl(new AttributeToReturn()); //Assert Assert.That(sc, Is.Not.Null); }
public void Can_Instantiate_New_AttributeSearchControls() { //Act var asc = new AttributeControl(); //Assert Assert.That(asc, Is.Not.Null); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); AttributeControl attributeControl = (AttributeControl)target; attributeControl.IconSprite = attributeControl.EditorIconSprite; attributeControl.attributeName = attributeControl.EditorAttributeName; attributeControl.attributeValue = attributeControl.EditorAttributeValue; }
public void CanSpecifyNodeName() { //Act var acon = new AttributeControl("Foo", new AttributeTypeToReturn { Type = AttributeDataType.StructureText }); //Assert Assert.That(acon.ToAdsml().Name.ToString(), Is.EqualTo("Foo")); }
public void CanSpecifyIdList() { //Arrange string expected = new XElement("Foo", new XAttribute("idlist", "1, 2, 3, 4")).ToString(); //Act var acon = new AttributeControl("Foo", new [] { 1, 2, 3, 4 }); //Assert Assert.That(acon.ToAdsml().ToString(), Is.EqualTo(expected)); }
public void Can_Generate_Api_Xml() { //Arrange var expected = new XElement("AttributesToReturn", new XElement("Attribute", new XAttribute("id", "20"))); var asc = new AttributeControl(new AttributeToReturn { DefinitionId = 20 }); //Act var actual = asc.ToAdsml(); //Assert Assert.That(actual.ToString(), Is.EqualTo(expected.ToString())); }
public void CanSpecifyAttributesToReturnWithAttributeNodes() { //Arrange string expected = new XElement("AttributesToReturn", new XElement("Attribute", new XAttribute("name", "foo"))).ToString(); //Act var acon = new AttributeControl(AttributeToReturn.WithName("foo")); //Assert Assert.That(acon, Is.Not.Null); Assert.That(acon.ToAdsml().ToString(), Is.EqualTo(expected)); }
private void afterReadConfig(ConfigReadData data) { _initing = true; data.setToConfig(); data.refreshData(); SensitiveWordConfig.init(); refreshConfig(); AttributeControl.init(); data.afterReadConfigAll(); _initing = false; }
/* * fills out the attributes */ protected override void FillOutParameters(Node pars, BaseControl ctrl) { base.FillOutParameters(pars, ctrl); Node ip = Ip(pars); Node node = ip["_code"].Get <Node>(); AttributeControl atrCtrl = ctrl as AttributeControl; foreach (Node idx in node) { if (idx.Name.StartsWith("@")) { atrCtrl.Attributes.Add(new AttributeControl.Attribute(idx.Name.Substring(1), idx.Get <string>())); } } }
public void Can_Generate_Api_Xml_With_Outer_Node_XAttributes() { //Arrange var expected = new XElement("AttributesToReturn", new XAttribute("foo", "bar"), new XElement("Attribute", new XAttribute("id", "20"))); var asc = new AttributeControl(new AttributeToReturn { DefinitionId = 20 }) { OuterNodeAttributes = new List <XAttribute> { new XAttribute("foo", "bar") } }; //Act var actual = asc.ToAdsml(); //Assert Assert.That(actual.ToString(), Is.EqualTo(expected.ToString())); }
private void BindDataPanel(StackPanel p, Type t, object value) { foreach( var prop in t.GetProperties().OrderBy(pr => pr.Name) ) { object v = value != null ? prop.GetValue(value, null) : null; if( v == null ) { var tmp = GetTempManager().GetDefault(prop.PropertyType.FullName); if( tmp != null ) v = tmp.Object; } var ctl = new AttributeControl(prop.Name, prop.PropertyType, v); ctl.DefineComplextType += ctl_DefineComplextType; p.Children.Add(ctl); } }