private static void RunWorker(CommandList cmdList) { try { cmdList.Run(); } catch (ThreadAbortException) { UO.PrintInformation("Command execution terminated."); } catch (ScriptErrorException e) { Trace.WriteLine("Unhandled exception:\n" + e.ToString(), "Script"); UO.PrintError(e.Message); } catch (Exception e) { Trace.WriteLine("Unhandled error during command execution. Exception:" + Environment.NewLine + e.ToString(), "Runtime"); UO.PrintError("Command error: {0}", e.Message); } }
private void Run() { CommandList cl = new CommandList(commandBox.Text); ThreadStarter.StartBackround(new RunWorkerDelegate(RunWorker), cl); }