private void InterfaceEventReceived(InterfaceEvent e) { if (IsItMe(e.Environment, e.RPI, e.Device)) { if (components.Count > 0) { foreach (IoTComponent c in components) { Destroy(c); } } foreach (ComponentInterface c in e.components) { if (c.componentID == "LED") { gameObject.AddComponent <LED>(); } if (c.componentID == "BUTTON") { gameObject.AddComponent <IoTPlatform.IoTComponents.Button>(); } } MQTTHandler.Instance.MqttPublishMsg(MQTTHandler.MQTTMsgType.State_Req, MQTTHandler.MQTTMsgEnvironment.House, e.RPI, e.Device, "REQ"); } }
public void InterfaceEvent() { InterfaceEvent inter = new InterfaceEvent(controller); inter.Name = "File"; inter.DataType = new DataType(controller, "int"); inter.DataType = new DataType(controller, "EventHandler"); inter.HasNewKeyword = true; Assert.That(inter.IsTheSame(inter.Clone(), ComparisonDepth.Outer), Is.True); }
public void An_InterfaceEvent_Is_Created() { const string code = "event Delegate1 Event1;"; CSharpParser parser = new CSharpParser(); IBaseConstruct bc = parser.ParseSingleConstruct(code, BaseConstructType.InterfaceEventDeclaration); Assert.That(bc, Is.Not.Null); Assert.That(bc, Is.InstanceOfType(typeof(InterfaceEvent))); InterfaceEvent con = (InterfaceEvent)bc; Assert.That(con.Name, Is.EqualTo("Event1")); Assert.That(con.DataType.Name, Is.EqualTo("Delegate1")); }
public void InterfaceEvent() { Interface it = new Interface(controller, "Interface1"); InterfaceEvent item = new InterfaceEvent(controller, "Event1", new DataType(controller, "Delegate1"), false); Assert.That(item.FullyQualifiedDisplayName, Is.EqualTo("Event1")); it.AddChild(item); Namespace ns = new Namespace(controller); ns.Name = "ns1"; ns.AddChild(it); Assert.That(item.FullyQualifiedDisplayName, Is.EqualTo("ns1.Interface1.Event1")); }
private void StandardEvent(InterfaceEvent ev, CGM.CGMObject source) { CGM.Resource[] resources = GetResourcesFrom(source); CGME.Actor source_actor = source.GetCGMEActor(); if (resources == null) { return; } foreach (CGM.Resource res in resources) { if (res.Trigger == ev && res.CGME_Resource is CGME.ResourceAction && (!res.RestrictParent || (source_actor.Parent != null && res.ParentType == source_actor.Parent.CGType))) { RunAction(res.CGME_Resource as CGME.ResourceAction, source_actor); } } }
public void Interface_Events() { const string code = @" public interface Interface1 { event Delegate1 Event1; } "; CSharpParser parser = new CSharpParser(); parser.ParseCode(code); ICodeRoot codeRoot = parser.CreatedCodeRoot; Interface clazz = (Interface)codeRoot.WalkChildren()[0]; InterfaceEvent enu = (InterfaceEvent)clazz.WalkChildren()[0]; Assert.That(enu.Name, Is.EqualTo("Event1")); Assert.That(enu.DataType.ToString(), Is.EqualTo("Delegate1")); }
public void ReportEvent(InterfaceEvent ev, CGM.CGMObject source) { if (popup_window != null) { return; } //Debug.Log (ev); if (ev == InterfaceEvent.PopUp) { PopupEvent(source); return; } if (ev == InterfaceEvent.Any || ev == InterfaceEvent.MouseOver || (ev == InterfaceEvent.Click)) { //Debug.Log (ev); StandardEvent(ev, source); return; } }
public bool CopyFrom(CGME.Resource res) { if (CGME_resource.CGType == res.CGType) { if (res is CGME.ResourceNumber) { (CGME_resource as CGME.ResourceNumber).Value = (res as CGME.ResourceNumber).Value; } if (res is CGME.ResourceText) { (CGME_resource as CGME.ResourceText).Value = (res as CGME.ResourceText).Value; } if (res is CGME.ResourceBool) { (CGME_resource as CGME.ResourceBool).Value = (res as CGME.ResourceBool).Value; } if (res is CGME.ResourceAction) { (CGME_resource as CGME.ResourceAction).Value = (res as CGME.ResourceAction).Value; Trigger = InterfaceEvent.Any; (CGME_resource as CGME.ResourceAction).Phase = (res as CGME.ResourceAction).Phase; } return(true); } return(false); }
public void InterfaceEvent() { InterfaceEvent inter = new InterfaceEvent(controller); inter.Name = "File"; inter.DataType = new DataType(controller, "EventHandler"); inter.HasNewKeyword = true; CodeRoot root = CreateNamespaceAndInterface(inter); CodeRootMap map = new CodeRootMap(); map.AddCodeRoot(root, Version.User); map.AddCodeRoot(root, Version.NewGen); map.AddCodeRoot(root, Version.PrevGen); string result = map.GetMergedCodeRoot().ToString(); Assert.That(result, Is.EqualTo(root.ToString())); Assertions.StringContains(result, "public interface Interface1"); Assertions.StringContains(result, "[Serializable(true)]"); Assertions.StringContains(result, "namespace ArchAngel.Tests"); Assertions.StringContains(result, "new event EventHandler File"); }
protected abstract void SMError(InterfaceEvent interfaceEvent);
public VBInterfaceEventPrinter(InterfaceEvent obj) { this.obj = obj; }
public void RaiseBothEvents() { InterfaceEvent?.Invoke(this, EventArgs.Empty); Interface2Event?.Invoke(this, EventArgs.Empty); }
protected virtual void OnInterfaceEvent() { InterfaceEvent?.Invoke(this, EventArgs.Empty); }
protected override void SMError(InterfaceEvent _interfaceEvent) { Parent.Controls.Add(new LiteralControl (String.Format("State machine error, in {0} the event {1} occured", Parent.m_ControlState.InterfaceState.ToString(), _interfaceEvent.ToString()))); }
private EventHandler <T> CreateHandler <T>(InterfaceEvent evt) where T : EventArgs { return((object sender, T e) => Events.Add(new Tuple <InterfaceEvent, object, EventArgs> (evt, sender, e))); }
public void InterfaceEvent_Change_DataType() { InterfaceEvent merged1 = new InterfaceEvent(controller); InterfaceEvent merged2 = new InterfaceEvent(controller); InterfaceEvent merged3 = new InterfaceEvent(controller); DataType type1 = new DataType(controller, DataType1); DataType type2 = new DataType(controller, DataType2); const string name = "MyName1"; const string expectedResult = "event " + DataType2 + " " + name; InterfaceEvent changing = new InterfaceEvent(controller, name, type2, false); InterfaceEvent unchanging = new InterfaceEvent(controller, name, type1, false); Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult); }
private void Process_Interace_Event_Declaration(InterfaceEventDeclaration node) { if (node == null) throw new ArgumentNullException("node"); InterfaceEvent inter = new InterfaceEvent(controller); inter.Name = node.Name.Text; inter.DataType = FormatterUtility.GetDataTypeFromTypeReference(node.EventType, document, controller); SetupBaseConstruct(node, inter); }
public ReadOnlyInterfaceEvent(InterfaceEvent interfaceEvent) { this.interfaceEvent = interfaceEvent; eventType = new ReadOnlyDelegateReference(interfaceEvent.Type); }
public void InterfaceEvent() { InterfaceEvent inter = new InterfaceEvent(controller); inter.Name = "File"; inter.DataType = new DataType(controller,"int"); inter.DataType = new DataType(controller, "EventHandler"); inter.HasNewKeyword = true; Assert.That(inter.IsTheSame(inter.Clone(), ComparisonDepth.Outer), Is.True); }
// protected void ReportEvent(InterfaceEvent ev) { manager.ReportEvent(ev, this); }