Ejemplo n.º 1
0
 public override string ToString()
 {
     if (String.IsNullOrEmpty(id))
     {
         return($"Espacio libre -> {Nucleo.RepresentarKB(Size)}");
     }
     else
     {
         return($"{id} -> {Nucleo.RepresentarKB(Size)}");
     }
 }
Ejemplo n.º 2
0
 private void BtnSize_Click(object sender, EventArgs e)
 {
     try
     {
         MiMemoria      = new Memoria(Nucleo.TransformarAKB(double.Parse(tbSize.Text), cbUnidad.Text), pnMemoria.Height);
         pnSize.Visible = false;
         pnSO.Visible   = true;
         lblSize.Text   = Nucleo.RepresentarKB(MiMemoria.Size);
     }
     catch
     {
         MessageBox.Show("Error al agregar la memoria");
     }
 }
Ejemplo n.º 3
0
        public void DibujarGrafica()
        {
            double Cant = MiMemoria.MemoriaTotal;

            dtgLibres.Rows.Clear();
            dtgTareas.Rows.Clear();
            pnMemoria.Controls.Clear();
            int i = 0;

            //MessageBox.Show($"Memoria Total: {MiMemoria.Height.ToString()}, height respecto{MiMemoria.SO.miPanel.Height.ToString()}");

            lbTareas.Items.Clear();

            MiMemoria.modo = "particiones";
            foreach (Particion p in MiMemoria)
            {
                //MessageBox.Show($"Memoria Total: {MiMemoria.Size.ToString()}, height respecto{p.Height.ToString()}");
                Cant -= p.Size;
                pnMemoria.Controls.Add(p.GetPanel(Cant));
                if (!p.Ocupada)
                {
                    i++;
                    dtgLibres.Rows.Add(i, p.PosicionY, p.Size);
                }
            }
            i = 0;
            MiMemoria.modo = "tareas";
            foreach (Particion p in MiMemoria)
            {
                //MessageBox.Show($"Memoria Total: {MiMemoria.Size.ToString()}, height respecto{p.Height.ToString()}");
                dtgTareas.Rows.Add(p.id, p.PosicionY, p.Size);
                lbTareas.Items.Add(p.ToString());
            }
            pnMemoria.Controls.Add(MiMemoria.SO.GetPanel(0));
            MiMemoria.MostrarMemoriaDisponible();
            lblDisponible.Text = Nucleo.RepresentarKB(MiMemoria.MemoriaDisponible);
        }
Ejemplo n.º 4
0
        public Panel GetPanel()
        {
            Panel miPanel = new Panel()
            {
                Dock   = DockStyle.Top,
                Height = this.Height
            };

            if (SO)
            {
                Panel Left = new Panel()
                {
                    Dock      = DockStyle.Left,
                    Width     = 150,
                    BackColor = System.Drawing.Color.White
                };
                Left.Controls.Add(new Label()
                {
                    Dock = DockStyle.Top, Text = $"{Nucleo.RepresentarKB(Size)}", Font = new System.Drawing.Font("Century Gothic", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)))
                });
                Left.Controls.Add(new Panel {
                    Dock = DockStyle.Bottom, Height = 3, BackColor = System.Drawing.Color.Black
                });
                miPanel.Controls.Add(Left);
                Panel Right = new Panel {
                    Dock = DockStyle.Fill, BackColor = System.Drawing.Color.Black
                };
                Right.Controls.Add(new Label()
                {
                    TextAlign = System.Drawing.ContentAlignment.MiddleCenter, ForeColor = System.Drawing.Color.White, Dock = DockStyle.Fill, Text = "S.O.", Font = new System.Drawing.Font("Century Gothic", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)))
                });;
                Right.Controls.Add(new Panel {
                    Dock = DockStyle.Bottom, Height = 3, BackColor = System.Drawing.Color.Black
                });

                miPanel.Controls.Add(Right);
            }
            else
            {
                if (Ocupada)
                {
                    Panel Left = new Panel()
                    {
                        Dock      = DockStyle.Left,
                        Width     = 150,
                        BackColor = System.Drawing.Color.White
                    };
                    Left.Controls.Add(new Label()
                    {
                        Dock = DockStyle.Top, Text = $"{id} ", Font = new System.Drawing.Font("Century Gothic", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)))
                    });
                    Left.Controls.Add(new Label()
                    {
                        Dock = DockStyle.Top, Text = $"{Nucleo.RepresentarKB(Size)}", Font = new System.Drawing.Font("Century Gothic", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)))
                    });
                    Left.Controls.Add(new Panel {
                        Dock = DockStyle.Bottom, Height = 3, BackColor = System.Drawing.Color.Black
                    });
                    miPanel.Controls.Add(Left);
                    Panel Right = new Panel {
                        Dock = DockStyle.Fill, BackColor = System.Drawing.Color.Red
                    };
                    Right.Controls.Add(new Panel {
                        Dock = DockStyle.Bottom, Height = 3, BackColor = System.Drawing.Color.Black
                    });
                    miPanel.Controls.Add(Right);
                }
                else
                {
                    Panel Left = new Panel()
                    {
                        Dock      = DockStyle.Left,
                        Width     = 150,
                        BackColor = System.Drawing.Color.White
                    };
                    Left.Controls.Add(new Label()
                    {
                        Text = Nucleo.RepresentarKB(Size), Font = new System.Drawing.Font("Century Gothic", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)))
                    });
                    Left.Controls.Add(new Panel {
                        Dock = DockStyle.Bottom, Height = 3, BackColor = System.Drawing.Color.Black
                    });
                    miPanel.Controls.Add(Left);
                    Panel Right = new Panel {
                        Dock = DockStyle.Fill, BackColor = System.Drawing.Color.Blue
                    };
                    Right.Controls.Add(new Panel {
                        Dock = DockStyle.Bottom, Height = 3, BackColor = System.Drawing.Color.Black
                    });
                    miPanel.Controls.Add(Right);
                }
            }


            return(miPanel);
        }