//send char to console. public void SendChar(char c) { SendToConsoleEventArgs e = new SendToConsoleEventArgs(); e.c = c; onOutputDetected(e); }
}//display a char form the Computer class. private void UpdateConsole(object sender, SendToConsoleEventArgs e) { if (this.InvokeRequired) { this.BeginInvoke(new ConsoleUpdateDelegate(UpdateConsole), e); return; } }
//sends output to the Form1 model class using Event mechanism public void onOutputDetected(SendToConsoleEventArgs e) { EventHandler <SendToConsoleEventArgs> handler = ConsoleChar; if (handler != null) { handler(this, e); } }
public void UpdateConsole(SendToConsoleEventArgs e) { terminalBox.AppendText(e.c.ToString()); }