示例#1
0
 /// <summary>
 /// Constructor for memory window that takes the window instance that is creating this window
 /// PLEASE NOTE: This constructor should always be used so data can be passed back to the parent window
 /// </summary>
 /// <param name="parentWindow">The window that is creating this window </param>
 /// <param name="currentPage"> The memory page to be displayed in the window </param>
 public MemoryWindow(MainWindow parentWindow, MemoryPage currentPage) : this()
 {
     this.mainParentWindow = parentWindow;
     this.currentPage      = currentPage;
     currentInstance       = this;
     SetMemoryWindowInstance();
     PopulateDataView();
 }
示例#2
0
 private void PhysicalMemoryWindow1_Loaded(object sender, RoutedEventArgs e)
 {
     if (osParent != null)
     {
         if (osParent.WindowParent != null)
         {
             foreach (MemoryPage page in osParent.WindowParent.Memory.Pages)
             {
                 MemoryButton b = new MemoryButton(page);
                 b.Content = "Size: " + MemoryPage.PAGE_SIZE + " Frame Number: " + page.FrameNumber + "Start Offset: " + page.StartOffset + "PID: " + page.ProcessId;
                 b.Width   = lst_Pages.Width - 5;
                 b.Height  = lst_Pages.Height / 10;
                 b.Click  += delegate
                 {
                     MemoryWindow wind = new MemoryWindow(this, page);
                     wind.Show();
                 };
                 lst_Pages.Items.Add((MemoryButton)b);
             }
         }
         else
         {
             MessageBox.Show("ERROR With window manager OSWin Please report this error to your tutor \n" + "The program will now terminate");
             Environment.Exit(1);
         }
     }
     else if (utilisationParent != null)
     {
         if (utilisationParent.OsParent.WindowParent != null)
         {
             foreach (MemoryPage page in utilisationParent.OsParent.WindowParent.Memory.Pages)
             {
                 MemoryButton b = new MemoryButton(page);
                 b.Content = "Size: " + MemoryPage.PAGE_SIZE + " Frame Number: " + page.FrameNumber + "Start Offset: " + page.StartOffset + "PID: " + page.ProcessId;
                 b.Width   = lst_Pages.Width - 5;
                 b.Height  = lst_Pages.Height / 10;
                 b.Click  += delegate
                 {
                     MemoryWindow wind = new MemoryWindow(this, page);
                     wind.Show();
                 };
                 lst_Pages.Items.Add((MemoryButton)b);
             }
         }
         else
         {
             MessageBox.Show("ERROR With window manager UtilWin Please report this error to your tutor \n" + "The program will now terminate");
             Environment.Exit(1);
         }
     }
     else if (mainParent != null)
     {
         foreach (MemoryPage page in mainParent.Memory.Pages)
         {
             MemoryButton b = new MemoryButton(page);
             b.Content = "Size: " + MemoryPage.PAGE_SIZE + " Frame Number: " + page.FrameNumber + "Start Offset: " + page.StartOffset + "PID: " + page.ProcessId;
             b.Width   = lst_Pages.Width - 5;
             b.Height  = lst_Pages.Height / 10;
             b.Click  += delegate
             {
                 MemoryWindow wind = new MemoryWindow(this, page);
                 wind.Show();
             };
             lst_Pages.Items.Add((MemoryButton)b);
         }
     }
     else
     {
         MessageBox.Show("ERROR With window manager MainWin Please report this error to your tutor \n" + "The program will now terminate");
         Environment.Exit(1);
     }
 }
示例#3
0
 private void Window_Closing(object sender, CancelEventArgs e)
 {
     currentInstance = null;
     SetMemoryWindowInstance();
 }
示例#4
0
 /// <summary>
 /// Default constructor for memory window
 /// </summary>
 public MemoryWindow()
 {
     InitializeComponent();
     currentInstance = this;
     SetMemoryWindowInstance();
 }
 /// <summary>
 /// Constructor for page table window that takes the window instance that is creating this window
 /// PLEASE NOTE: This constructor should always be used so data can be passed back to the parent window
 /// </summary>
 /// <param name="parent">The window that is creating this window </param>
 public PageTableWindow(MemoryWindow parent)
 {
     this.parent = parent;
     //physicalMemoryParent = null;
     InitializeComponent();
 }