예제 #1
0
        private void rdbtnSimulation_CheckedChanged(object sender, EventArgs e)
        {
            if (!rdbtnSimulation.Checked)
            {
                return;
            }
            rdbtnSimulation.ForeColor = Color.DarkRed;
            rdbtnRealTime.ForeColor   = SystemColors.ActiveCaptionText;
            rdbtnSimulation.BackColor = Color.MintCream;
            rdbtnRealTime.BackColor   = Color.Lavender;
            btnPauseRun.Visible       = true;
            lbModeStatus.Text         = "     Simulation mode is running.";

            Display.Mode           = "Simulation";
            timerComStatus.Enabled = false;

            // Add label of columns at node
            RackColumn.ListColumn.ForEach(col => RackColumn.RemoveLabelColumn(pnFloor, col));
            RackColumn.SimListColumn.ForEach(col => pnFloor.Controls.Add(col.ColumnLabel));


            // Remove real time label, add simulation label
            AGV.ListAGV.ForEach(agv => Display.RemoveLabelAGV(pnFloor, agv.ID));
            foreach (AGV agv in AGV.SimListAGV)
            {
                Display.AddLabelAGV(pnFloor, agv.ID, agv.ExitNode, agv.Orientation, agv.DistanceToExitNode);
            }

            // Clear draw path in panel
            Display.Points = new Point[] { new Point(), new Point() };
            pnFloor.Refresh();
        }
예제 #2
0
        private void rdbtnRealTime_CheckedChanged(object sender, EventArgs e)
        {
            if (!rdbtnRealTime.Checked)
            {
                return;
            }
            rdbtnRealTime.ForeColor   = Color.DarkRed;
            rdbtnSimulation.ForeColor = SystemColors.ActiveCaptionText;
            rdbtnRealTime.BackColor   = Color.MintCream;
            rdbtnSimulation.BackColor = Color.Lavender;
            btnPauseRun.Visible       = false;
            if (Communicator.SerialPort.IsOpen)
            {
                lbModeStatus.Text = "     Connection: " + Communicator.SerialPort.PortName + " ["
                                    + Communicator.SerialPort.BaudRate.ToString() + "-"
                                    + Communicator.SerialPort.Parity + "-"
                                    + Communicator.SerialPort.DataBits.ToString() + "-"
                                    + Communicator.SerialPort.StopBits + "]";
            }
            else
            {
                lbModeStatus.Text = "     Please set communication to run.";
            }

            Display.Mode           = "Real Time";
            timerComStatus.Enabled = true;

            // Add label of columns at node
            RackColumn.SimListColumn.ForEach(col => RackColumn.RemoveLabelColumn(pnFloor, col));
            RackColumn.ListColumn.ForEach(col => pnFloor.Controls.Add(col.ColumnLabel));

            // Remove simulation label, add real time label
            AGV.SimListAGV.ForEach(agv => Display.RemoveLabelAGV(pnFloor, agv.ID));
            foreach (AGV agv in AGV.ListAGV)
            {
                Display.AddLabelAGV(pnFloor, agv.ID, agv.ExitNode, agv.Orientation, agv.DistanceToExitNode);
            }

            // Clear draw path in panel
            Display.Points = new Point[] { new Point(), new Point() };
            pnFloor.Refresh();
        }