// // UI Event handlers: // private void StartToolStripMenuItem_Click(object sender, EventArgs e) { if (!_system.IsExecuting) { SystemExecutionContext context = new SystemExecutionContext(null, null, null, OnExecutionError); _system.StartExecution(context); } else { _system.StopExecution(); } }
protected override void OnShown(EventArgs e) { base.OnShown(e); if (firstShown) { firstShown = false; if (Configuration.Start && !_system.IsExecuting) { SystemExecutionContext context = new SystemExecutionContext(null, null, null, OnExecutionError); _system.StartExecution(context); } } }
private void OnDebuggerWindowClosed(object sender, FormClosedEventArgs e) { _debuggerWindow = null; // // Reattach our context if the system is currently running. // if (_system.IsExecuting) { _system.StopExecution(); SystemExecutionContext context = new SystemExecutionContext(null, null, null, OnExecutionError); _system.StartExecution(context); } }
private void StartExecution(bool singleStepIOP, bool singleStepCP, bool singleStepMesa) { _singleStepIOP = singleStepIOP; _singleStepCP = singleStepCP; _singleStepMesa = singleStepMesa; SystemExecutionContext context = new SystemExecutionContext(StepCallback8085, StepCallbackCP, StepCallbackMesa, ErrorCallback); _system.StartExecution(context); if (!_singleStepCP && !_singleStepIOP && !_singleStepMesa) { WriteLine("System started."); } }
private void LoadHardDiskToolStripMenuItem_Click(object sender, EventArgs e) { string imagePath = ShowImageLoadDialog(false); if (!string.IsNullOrWhiteSpace(imagePath)) { // // Timer to update progress bar while loading: // Timer t = new Timer(); t.Interval = 100; t.Enabled = true; t.Tick += (o, i) => { if (ProgressBar.Value >= ProgressBar.Maximum) { ProgressBar.Value = 0; } ProgressBar.Increment(10); }; // // Do load asynchronously. UI is disabled during this time. // System.Threading.ThreadPool.QueueUserWorkItem( delegate { BeginInvoke((MethodInvoker) delegate { // // Set up status bar // ProgressBar.Visible = true; ProgressBar.Style = ProgressBarStyle.Blocks; ProgressBar.Value = 0; ProgressBar.Minimum = 0; ProgressBar.Maximum = 100; // // Disable UI // SystemMenu.Enabled = false; }); // // Pause the system if it's running. // bool isRunning = _system.IsExecuting; SystemExecutionContext context = _system.ExecutionContext; if (isRunning) { _system.StopExecution(); } DialogResult res = DialogResult.Yes; try { // Commit current image to disk. _system.HardDrive.Save(); } catch (Exception ex) { res = MessageBox.Show( String.Format("Unable to save current hard drive's contents. Error: {0}. Continue loading new drive image?", ex.Message), "Error:", MessageBoxButtons.YesNo); } if (res == DialogResult.Yes) { try { // Load new image. _system.HardDrive.Load(imagePath); } catch (Exception ex) { MessageBox.Show( String.Format("Unable to load drive image. Error: {0}", ex.Message), "Error:"); } Configuration.HardDriveImage = imagePath; } // // Restart the system if necessary // if (isRunning) { _system.StartExecution(context); } // // Hide status text, re-enable UI // this.BeginInvoke((MethodInvoker) delegate { t.Stop(); ProgressBar.Visible = false; SystemMenu.Enabled = true; UpdateHardDriveLabel(); }); }); } }