Exemplo n.º 1
0
 private void buttonReset_Click(object sender, RoutedEventArgs e)
 {
     value = 0;
     button1.Visibility = Visibility.Visible;
     button2.Visibility = Visibility.Visible;
     button3.Visibility = Visibility.Visible;
     button4.Visibility = Visibility.Visible;
     button5.Visibility = Visibility.Visible;
     button6.Visibility = Visibility.Visible;
     newWindow          = new finished(globalResults.AverageTurnAroundTime, globalResults.AverageWaitTime, globalResults.CPUUtilization, globalResults.WaitTimes, globalResults.TurnAroundTimes);
     Drawing(globalEvents);
 }
Exemplo n.º 2
0
        private void buttonCalc(object sender, RoutedEventArgs e)
        {
            button1.Visibility = Visibility.Visible;
            button2.Visibility = Visibility.Visible;
            button3.Visibility = Visibility.Visible;
            button4.Visibility = Visibility.Visible;
            button5.Visibility = Visibility.Visible;
            button6.Visibility = Visibility.Visible;

            var procList = new List <Proc>()
            {
                new Proc()
                {
                    Name = "P1", Color = Objects.Color.white, Priority = Int32.Parse(priority1.Text), Burst = Int32.Parse(burst1.Text), InitialBurst = Int32.Parse(burst1.Text), Arrival = Int32.Parse(arrival1.Text)
                },
                new Proc()
                {
                    Name = "P2", Color = Objects.Color.blue, Priority = Int32.Parse(priority2.Text), Burst = Int32.Parse(burst2.Text), InitialBurst = Int32.Parse(burst2.Text), Arrival = Int32.Parse(arrival2.Text)
                },
                new Proc()
                {
                    Name = "P3", Color = Objects.Color.purple, Priority = Int32.Parse(priority3.Text), Burst = Int32.Parse(burst3.Text), InitialBurst = Int32.Parse(burst3.Text), Arrival = Int32.Parse(arrival3.Text)
                },
                new Proc()
                {
                    Name = "P4", Color = Objects.Color.green, Priority = Int32.Parse(priority4.Text), Burst = Int32.Parse(burst4.Text), InitialBurst = Int32.Parse(burst4.Text), Arrival = Int32.Parse(arrival4.Text)
                },
                new Proc()
                {
                    Name = "P5", Color = Objects.Color.red, Priority = Int32.Parse(priority5.Text), Burst = Int32.Parse(burst5.Text), InitialBurst = Int32.Parse(burst5.Text), Arrival = Int32.Parse(arrival5.Text)
                },
                new Proc()
                {
                    Name = "P6", Color = Objects.Color.orange, Priority = Int32.Parse(priority6.Text), Burst = Int32.Parse(burst6.Text), InitialBurst = Int32.Parse(burst6.Text), Arrival = Int32.Parse(arrival6.Text)
                }
            };
            var handler = new Handler(procList);

            var(events, results)  = handler.DoWork();
            buttoncalc.Visibility = Visibility.Hidden;
            newWindow             = new finished(results.AverageTurnAroundTime, results.AverageWaitTime, results.CPUUtilization, results.WaitTimes, results.TurnAroundTimes);
            globalEvents          = events;
            globalResults         = results;

            Drawing(globalEvents);
        }