private void ExecuteCode(object sender, RoutedEventArgs e) { try { ConsoleCtrl.Clear(); List <ErrorInfo> list = ErrorList.ItemsSource as List <ErrorInfo>; if (list.Count > 0) { StatusContent.Text = "在执行前请改正所有错误"; return; } ConsoleTab.IsSelected = true; string code = CodeEditor.Text; VirtualMachine vm = new VirtualMachine(); VMStartup v = new VMStartup(vm, new string(code.ToCharArray()), this); ConsoleThread = new Thread(v.Execute); ConsoleThread.Start(); } catch (Exception) { } }