示例#1
0
    // -----------------------------------------------------------------------------------------

    /// <summary>
    /// Updates the RELEAVNT buttons in Subscriber nodes, when a SUCCESSFUL Event has occured.
    /// </summary>
    /// <param name="status">Checks if Event Broadcast was succefull or not.</param>
    /// <param name="eventName">The associated event</param>
    public void UpdateButtonsOnSubscriberNodes(TranzmitDebug.LogEntry logEntry)
    {
        // They only react to Success Logs - Which only have index[0] in LogEntries List.
        if (logEntry.Status == Tranzmit.DeliveryStatuses.Success)
        {
            foreach (SubscriberNodeData subNode in SubscriberNodes)
            {
                foreach (PortEdgeEventData portNodeEvent in subNode.PortEdgeEvent)
                {
                    if (portNodeEvent.EventName == logEntry.TranzmitEvent)
                    {
                        portNodeEvent.TranzmitPort.portColor   = SuccessColor.PropertyValue;
                        portNodeEvent.TranzmitPort.visualClass = "";                                                                                                                                       // HACK: Force Refresh. Vary the input to trigger otherwise only works once.

                        portNodeEvent.SubscriberPort.portName    = $"{logEntry.TranzmitEvent.ToString()} [{TranzmitDebug.Success[logEntry.TranzmitEvent][0].Subscribers[subNode.Subscriber].EventCount}]"; // Always index 0!
                        portNodeEvent.SubscriberPort.portColor   = SuccessColor.PropertyValue;
                        portNodeEvent.SubscriberPort.visualClass = "";                                                                                                                                     // HACK: Force Refresh. Vary the input to trigger otherwise only works once.

                        portNodeEvent.Edge.UpdateEdgeControl();
                    }
                }
            }
        }
    }
示例#2
0
    // -----------------------------------------------------------------------------------------

    /// <summary>
    /// Updates the RELEVANT buttons and Ports assicoated with the Event that occured.
    /// </summary>
    /// <param name="logEntry">The log entry that was added or modified.</param>
    /// <param name="forceRefresh">Use full refresh all buttons when no event has occured.</param>
    public void UpdateButtonsAndPortsOnBroadcasterNodes(TranzmitDebug.LogEntry logEntry, bool forceRefresh)
    {
        if (BroadcasterNodes.ContainsKey(logEntry.TranzmitEvent))
        {
            // BUTTONS
            foreach (KeyValuePair <object, TranzmitDebug.ButtonData> buttonData in logEntry.Broadcasters)
            {
                // IF Button does not exist, create it.
                if (buttonData.Value.GraphButton == null || forceRefresh == true)
                {
                    buttonData.Value.GraphButton = new Button(clickEvent: () => { SelectObject(buttonData.Key); });

                    if (logEntry.Errors.Contains(Tranzmit.Errors.MissingSource))
                    {
                        buttonData.Value.GraphButton.text = $"Source Missing! [{buttonData.Value.EventCount}]";
                    }
                    else
                    {
                        buttonData.Value.GraphButton.text = $"{buttonData.Key.ToString()} [{buttonData.Value.EventCount}]";
                    }

                    if (logEntry.Status == Tranzmit.DeliveryStatuses.Failed)
                    {
                        buttonData.Value.GraphButton.style.backgroundColor = ErrorColor.PropertyValue;
                    }

                    BroadcasterNodes[logEntry.TranzmitEvent].TranzmitNodeEventNode.mainContainer.Add(buttonData.Value.GraphButton);
                }
                else // Button Exists
                {
                    if (logEntry.Errors.Contains(Tranzmit.Errors.MissingSource))
                    {
                        buttonData.Value.GraphButton.text = $"Source Missing! [{buttonData.Value.EventCount}]";
                    }
                    else
                    {
                        buttonData.Value.GraphButton.text = $"{buttonData.Key.ToString()} [{buttonData.Value.EventCount}]";
                    }
                }

                BroadcasterNodes[logEntry.TranzmitEvent].TotalButtons = BroadcasterNodes[logEntry.TranzmitEvent].TranzmitNodeEventNode.mainContainer.childCount;
            }

            // PORTS
            if (logEntry.Status == Tranzmit.DeliveryStatuses.Success)
            {
                if (BroadcasterNodes[logEntry.TranzmitEvent].Port.portColor != ErrorColor.PropertyValue)
                {
                    BroadcasterNodes[logEntry.TranzmitEvent].TranzmitPort.portColor   = SuccessColor.PropertyValue;
                    BroadcasterNodes[logEntry.TranzmitEvent].TranzmitPort.visualClass = ""; // HACK: Force Refresh.

                    BroadcasterNodes[logEntry.TranzmitEvent].Port.portColor   = SuccessColor.PropertyValue;
                    BroadcasterNodes[logEntry.TranzmitEvent].Port.visualClass = ""; // HACK: Force Refresh.
                }
            }
            else
            {
                if (BroadcasterNodes[logEntry.TranzmitEvent].Port.portColor != ErrorColor.PropertyValue)
                {
                    BroadcasterNodes[logEntry.TranzmitEvent].TranzmitPort.portColor   = ErrorColor.PropertyValue;
                    BroadcasterNodes[logEntry.TranzmitEvent].TranzmitPort.visualClass = "1"; // HACK: Force Refresh.

                    BroadcasterNodes[logEntry.TranzmitEvent].Port.portColor   = ErrorColor.PropertyValue;
                    BroadcasterNodes[logEntry.TranzmitEvent].Port.visualClass = "1"; // HACK: Force Refresh.
                }
            }


            Arrange_Broadcaster_Results(CurrentArrangementType);
        }
    }
示例#3
0
 public void TranzmitDebugLogUpdated(TranzmitDebug.LogEntry logEntry)
 {
     UpdateButtonsOnSubscriberNodes(logEntry);
     UpdateButtonsAndPortsOnBroadcasterNodes(logEntry, false);
 }