private void Form1_Load(object sender, EventArgs e) { cboPlatform.Items.Clear(); foreach (var platform in Enum.GetValues <SilkPlatform>()) { cboPlatform.Items.Add(new SilkPlatformListItem(RunProgram.GetPlatformDescription(platform), platform)); } cboPlatform.SelectedIndex = 0; }
public frmRun(RunProgram runProgram, CompiledProgram program) { if (runProgram == null) { throw new NullReferenceException(nameof(runProgram)); } if (program == null) { throw new NullReferenceException(nameof(program)); } RunProgram = runProgram; Program = program; InitializeComponent(); }
private void CompileAndRunToolStripMenuItem_Click(object sender, EventArgs e) { string script = txtScript.Text; if (string.IsNullOrWhiteSpace(script)) { MessageBox.Show("There is no code to run."); return; } if (documentManager1.Save()) { try { lvwErrors.Items.Clear(); // Compile program RunProgram runProgram = new RunProgram(); if (runProgram.Compile(documentManager1.FileName, out CompiledProgram program, false)) { // Success: run program in Run form frmRun frm = new frmRun(runProgram, program); frm.ShowDialog(); } else { // Build failed: Display errors foreach (Error error in runProgram.Errors) { ListViewItem item = lvwErrors.Items.Add(error.Level.ToString()); item.SubItems.Add(string.Format("1{0,03:D3}", (int)error.Code)); item.SubItems.Add(error.Line.ToString()); item.SubItems.Add(error.Description); item.Tag = error; item.ForeColor = Color.Red; } } }