private void P5Create_Click(object sender, EventArgs e) { MainBox.AppendText("PCB 5 Created !\n"); P5Signal.BackColor = System.Drawing.Color.Yellow; System.Threading.Thread.Sleep(300); P5Ready_Click(sender, e); }
private void k_Click(object sender, RoutedEventArgs e) { MainBox.Clear(); foreach (var I in Database.StudentsReturn("SELECT * FROM Names ORDER BY AverageScore")) { MainBox.AppendText($"{I}\n"); } }
private void ShowAll(object sender, RoutedEventArgs e) { MainBox.Clear(); foreach (var I in Database.StudentsReturn("SELECT * FROM Names")) { MainBox.AppendText($"{I}\n"); } }
private void P5Run_Click(object sender, EventArgs e) { MainBox.AppendText("PCB 5 is Running !\n"); P5Signal.BackColor = System.Drawing.Color.Green; if (Run.IsEmpty()) { Run.Push(5); } else { RunToBlock(sender, e); Run.Push(5); } }
private void P5Exit_Click(object sender, EventArgs e) { MainBox.AppendText("PCB 5 Exited !\n"); P5Signal.BackColor = System.Drawing.Color.White; //Bar1.Value = 0; if (Run.Gettop() == 5) { Run.Pop(); if (!Block.IsEmpty()) { Run.Push(Block.Pop()); ExitToLight(sender, e); } } Ready.Pop(5); }
//RunArea private void P1Run_Click(object sender, EventArgs e) { MainBox.AppendText("PCB 1 is Running !\n"); P1Signal.BackColor = System.Drawing.Color.Green; //timer1.Start(); //mainTimer.Start(); if (Run.IsEmpty()) { Run.Push(1); } else { RunToBlock(sender, e); Run.Push(1); } }
private void ExitToLight(object sender, EventArgs e) { switch (Run.Gettop()) { case 1: MainBox.AppendText("PCB 1 goto Running !\n"); P1Signal.BackColor = System.Drawing.Color.Green; break; case 2: MainBox.AppendText("PCB 2 goto Running !\n"); P2Signal.BackColor = System.Drawing.Color.Green; break; case 3: MainBox.AppendText("PCB 3 goto Running !\n"); P3Signal.BackColor = System.Drawing.Color.Green; break; case 4: MainBox.AppendText("PCB 4 goto Running !\n"); P4Signal.BackColor = System.Drawing.Color.Green; break; case 5: MainBox.AppendText("PCB 5 goto Running !\n"); P5Signal.BackColor = System.Drawing.Color.Green; break; default: Console.WriteLine("用户这辈子都看不到这句话!"); break; } }
private void RunToBlock(object sender, EventArgs e) { switch (Run.Gettop()) { case 1: Run.Pop(); MainBox.AppendText("PCB 1 goto Block !\n"); P1Block_Click(sender, e); break; case 2: Run.Pop(); MainBox.AppendText("PCB 2 goto Block !\n"); P2Block_Click(sender, e); break; case 3: Run.Pop(); MainBox.AppendText("PCB 3 goto Block !\n"); P3Block_Click(sender, e); break; case 4: Run.Pop(); MainBox.AppendText("PCB 4 goto Block !\n"); P4Block_Click(sender, e); break; case 5: Run.Pop(); MainBox.AppendText("PCB 5 goto Block !\n"); P5Block_Click(sender, e); break; default: Console.WriteLine("用户这辈子都看不到这句话!"); break; } }
public void ToLight(object sender, EventArgs e, int i) { switch (i) { case 1: P1Signal.BackColor = System.Drawing.Color.Green; MainBox.AppendText("PCB 1 is running !\n"); break; case 2: P2Signal.BackColor = System.Drawing.Color.Green; MainBox.AppendText("PCB 2 is running !\n"); break; case 3: P3Signal.BackColor = System.Drawing.Color.Green; MainBox.AppendText("PCB 3 is running !\n"); break; case 4: P4Signal.BackColor = System.Drawing.Color.Green; MainBox.AppendText("PCB 4 is running !\n"); break; case 5: P5Signal.BackColor = System.Drawing.Color.Green; MainBox.AppendText("PCB 5 is running !\n"); break; default: Console.WriteLine("用户这辈子都看不到这句话!"); break; } }
private void P5Block_Click(object sender, EventArgs e) { MainBox.AppendText("PCB 5 is Blocking !\n"); P5Signal.BackColor = System.Drawing.Color.Red; if (Run.Gettop() == 5) { Console.WriteLine("Run的栈顶是" + Run.Gettop()); Console.WriteLine("Block的栈顶是" + Block.Gettop()); Run.Pop(); Run.Push(Block.Gettop()); Console.WriteLine("RunPush之后的站顶是" + Run.Gettop()); ToLight(sender, e, Run.Gettop()); Block.Pop(); Block.Push(5); Console.WriteLine("Block的栈顶是" + Block.Gettop()); } else { Block.Push(5); } }
private void P4Ready_Click(object sender, EventArgs e) { MainBox.AppendText("PCB 4 is Ready !\n"); P4Signal.BackColor = System.Drawing.Color.Yellow; Ready.Push(4); }
//ReadyArea public void P1Ready_Click(object sender, EventArgs e) { MainBox.AppendText("PCB 1 is Ready !\n"); P1Signal.BackColor = System.Drawing.Color.Yellow; Ready.Push(1); }