public IEnumerable <ITreeNode> GetChildren(bool refresh) { var commandText = "select trigger_name from sys.dba_triggers where table_owner = '{0}' and table_name = '{1}' order by trigger_name"; commandText = string.Format(commandText, _table.Schema.Name, _table.Name); var dataTable = new DataTable(); var command = new OracleCommand(commandText, _table.Schema.SchemasNode.Connection); command.FetchSize = 256 * 1024; command.Fill(dataTable, CancellationToken.None); var count = dataTable.Rows.Count; var triggers = new string[count]; for (var i = 0; i < count; i++) { var name = (string)dataTable.Rows[i][0]; triggers[i] = name; } var treeNodes = new ITreeNode[triggers.Length]; for (var i = 0; i < triggers.Length; i++) { treeNodes[i] = new TriggerNode(_table, triggers[i]); } return(treeNodes); }
public static TreeNode GetAllTypeNode() { TypesB1Node nodeType = new TypesB1Node(); nodeType.Text = nodeType.KNXMainNumber + "." + nodeType.KNXSubNumber + " " + nodeType.Name; nodeType.Nodes.Add(SwitchNode.GetTypeNode()); nodeType.Nodes.Add(BoolNode.GetTypeNoe()); nodeType.Nodes.Add(EnableNode.GetTypeNode()); nodeType.Nodes.Add(RampNode.GetTypeNode()); nodeType.Nodes.Add(AlarmNode.GetTypeNode()); nodeType.Nodes.Add(BinaryValueNode.GetTypeNode()); nodeType.Nodes.Add(StepNode.GetTypeNode()); nodeType.Nodes.Add(UpDownNode.GetTypeNode()); nodeType.Nodes.Add(OpenCloseNode.GetTypeNode()); nodeType.Nodes.Add(StartNode.GetTypeNode()); nodeType.Nodes.Add(StateNode.GetTypeNode()); nodeType.Nodes.Add(InvertNode.GetTypeNode()); nodeType.Nodes.Add(DimSendStyleNode.GetTypeNode()); nodeType.Nodes.Add(InputSourceNode.GetTypeNode()); nodeType.Nodes.Add(ResetNode.GetTypeNode()); nodeType.Nodes.Add(AckNode.GetTypeNode()); nodeType.Nodes.Add(TriggerNode.GetTypeNode()); nodeType.Nodes.Add(OccupancyNode.GetTypeNode()); nodeType.Nodes.Add(WindowDoorNode.GetTypeNode()); nodeType.Nodes.Add(LogicalFunctionNode.GetTypeNode()); nodeType.Nodes.Add(SceneABNode.GetTypeNode()); nodeType.Nodes.Add(ShutterBlindsModeNode.GetTypeNode()); nodeType.Nodes.Add(HeatCoolNode.GetTypeNode()); return(nodeType); }
public static TriggerBaseNode FindOrCreateTrigger(TriggerSourceInformation triggerSource, ITriggerContainer triggerContainer, SceneViewModel viewModel) { RoutedEventInformation eventInformation = triggerSource as RoutedEventInformation; PropertyInformation propertyInformation = triggerSource as PropertyInformation; foreach (TriggerBaseNode triggerBaseNode in (IEnumerable <TriggerBaseNode>)triggerContainer.VisualTriggers) { EventTriggerNode eventTriggerNode = triggerBaseNode as EventTriggerNode; TriggerNode triggerNode = triggerBaseNode as TriggerNode; if (eventTriggerNode != null && (TriggerSourceInformation)eventInformation != (TriggerSourceInformation)null && eventTriggerNode.RoutedEvent == eventInformation.RoutedEvent) { return((TriggerBaseNode)eventTriggerNode); } if (triggerNode != null && (TriggerSourceInformation)propertyInformation != (TriggerSourceInformation)null && ((ITriggerConditionNode)triggerNode).PropertyKey == propertyInformation.DependencyProperty) { return((TriggerBaseNode)triggerNode); } } TriggerBaseNode trigger = TriggersHelper.CreateTrigger(triggerSource, viewModel); if (trigger != null) { triggerContainer.VisualTriggers.Add(trigger); } return(trigger); }
public static TriggerBaseNode CreateTrigger(TriggerSourceInformation triggerSource, SceneViewModel viewModel) { RoutedEventInformation eventInformation = triggerSource as RoutedEventInformation; PropertyInformation propertyInformation = triggerSource as PropertyInformation; if ((TriggerSourceInformation)eventInformation != (TriggerSourceInformation)null) { EventTriggerNode eventTriggerNode = EventTriggerNode.Factory.Instantiate(viewModel); eventTriggerNode.RoutedEvent = eventInformation.RoutedEvent; return((TriggerBaseNode)eventTriggerNode); } if (!((TriggerSourceInformation)propertyInformation != (TriggerSourceInformation)null)) { return((TriggerBaseNode)null); } TriggerNode triggerNode = (TriggerNode)null; DependencyProperty dependencyProperty = propertyInformation.DependencyProperty; if (dependencyProperty != null) { triggerNode = TriggerNode.Factory.Instantiate(viewModel); ITriggerConditionNode triggerConditionNode = (ITriggerConditionNode)triggerNode; triggerConditionNode.PropertyKey = dependencyProperty; triggerConditionNode.Value = dependencyProperty.DefaultMetadata.DefaultValue; } return((TriggerBaseNode)triggerNode); }
public static TriggerNode ConvertToTrigger(MultiTriggerNode multiTrigger) { TriggerNode triggerNode = TriggerNode.Factory.Instantiate(multiTrigger.ViewModel); if (multiTrigger.Conditions.Count > 0) { ConditionNode conditionNode = multiTrigger.Conditions[0]; ((ITriggerConditionNode)triggerNode).Value = conditionNode.Value; ((ITriggerConditionNode)triggerNode).PropertyKey = conditionNode.PropertyKey; if (conditionNode.SourceName != null) { ((ITriggerConditionNode)triggerNode).SourceName = conditionNode.SourceName; } } List <SceneNode> list1 = new List <SceneNode>((IEnumerable <SceneNode>)multiTrigger.Setters); while (multiTrigger.Setters.Count > 0) { multiTrigger.Setters.RemoveAt(0); } List <TriggerActionNode> list2 = new List <TriggerActionNode>((IEnumerable <TriggerActionNode>)multiTrigger.EnterActions); while (multiTrigger.EnterActions.Count > 0) { multiTrigger.EnterActions.RemoveAt(0); } List <TriggerActionNode> list3 = new List <TriggerActionNode>((IEnumerable <TriggerActionNode>)multiTrigger.ExitActions); while (multiTrigger.ExitActions.Count > 0) { multiTrigger.ExitActions.RemoveAt(0); } TriggersHelper.ReplaceSceneNode((SceneNode)multiTrigger, (SceneNode)triggerNode); foreach (SceneNode sceneNode in list1) { triggerNode.Setters.Add(sceneNode); } foreach (TriggerActionNode triggerActionNode in list2) { triggerNode.EnterActions.Add(triggerActionNode); } foreach (TriggerActionNode triggerActionNode in list3) { triggerNode.ExitActions.Add(triggerActionNode); } SceneViewModel viewModel = multiTrigger.ViewModel; if (viewModel.ActiveVisualTrigger == multiTrigger) { viewModel.SetActiveTrigger((TriggerBaseNode)triggerNode); } return(triggerNode); }
public override bool DrawContent(Event e) { TriggerNode node = _node as TriggerNode; Rect content = new Rect(); content.size = Transform.size; content.width -= 20; content.height -= 20; content.position = Transform.position; content.x += 10; content.y += 10; string prevName = node.name; GUILayout.BeginArea(content); GUILayout.BeginVertical(); GUILayout.FlexibleSpace(); if (editingName) { node.name = EditorGUILayout.TextField(node.name); if (GUILayout.Button("Done")) { editingName = false; } } else { GUILayout.Label(node.name); if (GUILayout.Button("Edit name")) { editingName = true; } } GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.EndArea(); return(prevName != node.name); }
private BaseNode MakeNewNode(int id) { string nodeId = DataViewHierarchyAccessor.GetNodeId(id); nodeId = nodeId.ToLowerInvariant(); BaseNode newNode; switch (nodeId) { case "table": newNode = new TableNode(DataViewHierarchyAccessor, id); break; case "storedprocedure": newNode = new StoredProcedureNode(DataViewHierarchyAccessor, id, false); break; case "storedfunction": newNode = new StoredProcedureNode(DataViewHierarchyAccessor, id, true); break; case "view": newNode = new ViewNode(DataViewHierarchyAccessor, id); break; case "udf": newNode = new UdfNode(DataViewHierarchyAccessor, id); break; case "trigger": newNode = new TriggerNode(DataViewHierarchyAccessor, id); break; default: throw new NotSupportedException("Node type not supported"); } Debug.Assert(newNode != null); return(newNode); }
public static void DefaultAddAction(TriggerBaseNode trigger, TriggerActionNode action) { TriggerNode triggerNode = trigger as TriggerNode; MultiTriggerNode multiTriggerNode = trigger as MultiTriggerNode; EventTriggerNode eventTriggerNode = trigger as EventTriggerNode; if (triggerNode != null) { triggerNode.EnterActions.Add(action); } else if (multiTriggerNode != null) { multiTriggerNode.EnterActions.Add(action); } else { if (eventTriggerNode == null) { return; } eventTriggerNode.Actions.Add((SceneNode)action); } }
private void DoCommanderSetup(ElectricCommander EC, IEnumerable<BuildNode> AllNodes, IEnumerable<AggregateNode> AllAggregates, List<BuildNode> OrdereredToDo, int TimeIndex, int TimeQuantum, bool bSkipTriggers, bool bFake, bool bFakeEC, string CLString, TriggerNode ExplicitTrigger, List<TriggerNode> UnfinishedTriggers, string FakeFail, bool bPreflightBuild) { List<BuildNode> SortedNodes = TopologicalSort(new HashSet<BuildNode>(AllNodes), null, SubSort: false, DoNotConsiderCompletion: true); Log("******* {0} GUBP Nodes", SortedNodes.Count); List<BuildNode> FilteredOrdereredToDo = new List<BuildNode>(); using(TelemetryStopwatch StartFilterTimer = new TelemetryStopwatch("FilterNodes")) { // remove nodes that have unfinished triggers foreach (BuildNode NodeToDo in OrdereredToDo) { if (NodeToDo.ControllingTriggers.Length == 0 || !UnfinishedTriggers.Contains(NodeToDo.ControllingTriggers.Last())) { // if we are triggering, then remove nodes that are not controlled by the trigger or are dependencies of this trigger if (ExplicitTrigger != null && ExplicitTrigger != NodeToDo && !ExplicitTrigger.DependsOn(NodeToDo) && !NodeToDo.DependsOn(ExplicitTrigger)) { continue; // this wasn't on the chain related to the trigger we are triggering, so it is not relevant } // in preflight builds, we are either skipping triggers (and running things downstream) or we just stop at triggers and don't make them available for triggering. if (bPreflightBuild && !bSkipTriggers && (NodeToDo is TriggerNode)) { continue; } FilteredOrdereredToDo.Add(NodeToDo); } } } using(TelemetryStopwatch PrintNodesTimer = new TelemetryStopwatch("SetupCommanderPrint")) { Log("*********** EC Nodes, in order."); PrintNodes(this, FilteredOrdereredToDo, AllAggregates, UnfinishedTriggers, TimeQuantum); } EC.DoCommanderSetup(AllNodes, AllAggregates, FilteredOrdereredToDo, SortedNodes, TimeIndex, TimeQuantum, bSkipTriggers, bFake, bFakeEC, CLString, ExplicitTrigger, UnfinishedTriggers, FakeFail); }
public TriggerNodeGUIContent(TriggerNode node, NodeMachineEditor editor) : base(node, editor) { }
/// <summary> /// Visits a single <see cref="TriggerNode"/> and produces a value of type <typeparamref name="TResult"/>. /// </summary> /// <param name="node">The node to visit.</param> /// <returns>The result of visitng the node.</returns> protected internal abstract TResult VisitTrigger(TriggerNode node);
/// <summary> /// clone /// </summary> /// <returns></returns> public IBehaviourNode Clone() { var behaviourNode = new TriggerNode(this.eventType); base.CopyTo(behaviourNode); return behaviourNode; }