예제 #1
0
        private Pen GetPen(string command, DataBuses targetBus)
        {
            var commands = RegisteredOTHERCommands;

            switch (targetBus)
            {
            case DataBuses.NONE: return(inactivePenThin);

            case DataBuses.RBUS:
                commands = RegisteredRBUSCommands;
                break;

            case DataBuses.DBUS:
                commands = RegisteredDBUSCommands;
                break;

            case DataBuses.SBUS:
                commands = RegisteredSBUSCommands;
                break;

            default:
                break;
            }
            if (commands[command].Active && commands[command].TargetBus == targetBus)
            {
                return(activePen);
            }
            else
            {
                return(inactivePen);
            }
        }
        private void DrawVerticalCommandArrow(Graphics g, Rectangle rect, DataBuses destinationBus, string text, double width, int yOffset, string command)
        {
            int x     = (int)(rect.Location.X + rect.Width * width);
            int y     = rect.Location.Y + rect.Height + yOffset;
            int destY = GetBusY(destinationBus);

            g.DrawArrow(GetPen(command, destinationBus), x, y, x, destY);
            g.DrawString(text, Font, Brushes.Black, x, destY - (destY - y) / 2);
        }
        private void DrawVerticalCommandArrow(Graphics g, DataBuses sourceBus, Rectangle rect, string text, double width, int yOffset, string command, bool inverted = false)
        {
            int x       = (int)(rect.Location.X + rect.Width * width);
            int y       = rect.Location.Y + yOffset + (inverted ? rect.Height : 0);
            int sourceY = GetBusY(sourceBus);

            if (false)
            {
                int t = y;
                y       = sourceY;
                sourceY = t;
            }
            g.DrawArrow(GetPen(command, sourceBus), x, sourceY, x, y);
            g.DrawString(text, Font, Brushes.Black, x, y - (y - sourceY) / 2 - 10);
        }
예제 #4
0
        private int GetBusY(DataBuses bus)
        {
            switch (bus)
            {
            case DataBuses.NONE: return(0);

            case DataBuses.RBUS: return(RBusY);

            case DataBuses.DBUS: return(DBusY);

            case DataBuses.SBUS: return(SBusY);

            default: return(0);
            }
        }
 private void DrawVerticalCommandArrow(Graphics g, DataBuses sourceBus, Rectangle rect, string value, double width)
 {
     DrawVerticalCommandArrow(g, sourceBus, rect, value, width, 0, value);
 }
 private void DrawVerticalCommandArrow(Graphics g, Rectangle rect, DataBuses destinationBus, string value, double width)
 {
     DrawVerticalCommandArrow(g, rect, destinationBus, value, width, 0, value);
 }
예제 #7
0
 public void Activate(DataBuses targetBus)
 {
     Active    = true;
     TargetBus = targetBus;
     StatusChanged?.Invoke(this, new CommandStatusChangedEventArgs(targetBus, Name));
 }
예제 #8
0
 public CommandStatusChangedEventArgs(DataBuses targetBus, string name)
 {
     TargetBus = targetBus;
     Name      = name;
 }