Ejemplo n.º 1
0
 protected void GridViewLRU_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         for (int i = 0; i < dataDeloy.getDataLRU().pagefalut.Length; i++)
         {
             if ((e.Row.Cells[i + 2].Text) == itemType.arrayInt[i].ToString())
             {
                 e.Row.Cells[i + 2].BackColor = System.Drawing.Color.Yellow;
                 e.Row.Cells[i + 2].Font.Bold = true;
             }
         }
     }
 }
Ejemplo n.º 2
0
        public DataTable gridViewInstall(DataDeloy dataDeloy, String key, int kind)
        {
            DataTable dataTable = new DataTable(key);
            ItemData  itemData;

            // Đổ data main
            switch (kind)
            {
            case 0:
            {
                itemData = dataDeloy.getDataFIFO();
            }
            break;

            case 1:
            {
                itemData = dataDeloy.getDataLRU();
            }
            break;

            case 2:
            {
                itemData = dataDeloy.getDataOPT();
            } break;

            case 3:
            {
                itemData = dataDeloy.getDataCLOCK();
            } break;

            default:
                return(dataTable);
            }


            dataTable.Columns.Add(new DataColumn(" ", typeof(string)));
            dataTable.Columns.Add(new DataColumn(title3, typeof(string)));
            for (int i = 0; i < itemType.arrayInt.Count; i++)
            {
                dataTable.Columns.Add(new DataColumn(i.ToString(), typeof(string)));
            }

            dataTable.Rows.Add();
            dataTable.Rows[dataTable.Rows.Count - 1][" "] = title0;
            for (int j = 0; j < itemType.arrayInt.Count; j++)
            {
                dataTable.Rows[dataTable.Rows.Count - 1][j.ToString()] = itemType.arrayInt[j];
            }
            dataTable.Rows.Add();
            dataTable.Rows[dataTable.Rows.Count - 1][" "]    = title1;
            dataTable.Rows[dataTable.Rows.Count - 1][title3] = title1;
            for (int j = 0; j < itemType.arrayInt.Count; j++)
            {
                dataTable.Rows[dataTable.Rows.Count - 1][j.ToString()] = title2;
            }
            for (int i = 0; i < itemType.frame; i++)
            {
                dataTable.Rows.Add();
                dataTable.Rows[dataTable.Rows.Count - 1][" "] = String.Format("Frame[{0}]", i);
                for (int j = 0; j < itemType.arrayInt.Count; j++)
                {
                    if (!(itemData.xy[j][i] == -1 || itemData.xy[j][i] == -2 || itemData.pagefalut[j] == -1))
                    {
                        dataTable.Rows[dataTable.Rows.Count - 1][j.ToString()] = "" + itemData.xy[j][i];
                    }
                }
            }
            dataTable.Rows.Add();
            dataTable.Rows[dataTable.Rows.Count - 1][" "]    = title1;
            dataTable.Rows[dataTable.Rows.Count - 1][title3] = title1;
            for (int j = 0; j < itemType.arrayInt.Count; j++)
            {
                dataTable.Rows[dataTable.Rows.Count - 1][j.ToString()] = title2;
            }
            dataTable.Rows.Add();
            dataTable.Rows[dataTable.Rows.Count - 1][" "]    = "Page fault";
            dataTable.Rows[dataTable.Rows.Count - 1][title3] = title1;
            for (int j = 0; j < itemType.arrayInt.Count; j++)
            {
                if (itemData.pagefalut[j] != -1)
                {
                    dataTable.Rows[dataTable.Rows.Count - 1][j.ToString()] = "F";
                }
            }

            // Đổ data next, loca
            switch (kind)
            {
            case 0:
            {
                gridViewNextFIFO(dataDeloy);
            }
            break;

            case 1:
            {
                gridViewLocaLRU(dataDeloy);
            } break;

            case 2:
            {
                gridViewLocaOPT(dataDeloy);
            }
            break;

            case 3:
            {
                gridViewStatusNextCLOCK(dataDeloy);
            }
            break;
            }
            return(dataTable);
        }