public Timeline[] CalculateTimeLine(Process[] _process) { int totalBurstTime = 0; foreach (var item in _process) // Creating Timeline with reference of BurstTime { totalBurstTime += item.BurstTime; } totalBurstTime = 50; //***BOŞ GEÇİRİLEN ZAMANIDA HESABA KATMAK İÇİN ELLE DEĞER VERDİK****** var timeLine = new Scheduling.Timeline[totalBurstTime]; //Timeline Limit should be equal to TotalBurstTime timeLine[0].TotalBurstTime = totalBurstTime; //Record Total Burst Time for (int currentTime = 0; currentTime < totalBurstTime; currentTime++) { timeLine[currentTime].Process = FindNextProcessToExecute(_process, currentTime); _process = CheckandMarkProcesses(_process, timeLine); } //TRY //string sıra = ""; //int count = 0; //foreach (var item in timeLine) //{ // sıra = sıra + " " + "(" + count + ")" + item.Process.Name; // count++; //} //MessageBox.Show(sıra); return(timeLine); }
public void DrawRectangle(SecondaryWindow window, Brush color, Point coordinate, Scheduling.Timeline process) { var grid = new Grid(); Rectangle rec = new Rectangle() { Width = 30, Height = 30, Fill = color, StrokeThickness = 0 }; TextBlock tb = new TextBlock() { Text = process.Process.Name + itemCounter, FontSize = 16, Height = double.NaN, Width = double.NaN, Opacity = 50, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center }; //Thickness margin = tb.Margin; //margin.Left = 5; //margin.Right = 5; //margin.Top = 3; //margin.Bottom = 5; //tb.Margin = margin; grid.Children.Add(rec); grid.Children.Add(tb); window._Canvas.Children.Add(grid); //window._Canvas.Children.Add(rec); Canvas.SetLeft(grid, coordinate.X); Canvas.SetTop(grid, coordinate.Y); //itemCounter++; }