public CsvCommandQueryResult Run(Csv csv, CsvCommand cmd) { try { var res = cmd.Query(csv); if (OnSuccess != null) { OnSuccess.Invoke(cmd, res); } return(res); } catch (Exception e) { if (OnError != null) { OnError.Invoke(cmd, e); } return(null); } }
public CsvCommandQueryResult Run(Csv csv, string cmdStr) { CsvCommand cmd = null; try { cmd = CsvCommand.Parse(cmdStr); var res = cmd.Query(csv); if (OnSuccess != null) { OnSuccess.Invoke(cmd, res); } return(res); } catch (Exception e) { if (OnError != null) { OnError.Invoke(cmd, e); } return(null); } }
private void Runner_OnSuccess(CsvCommand cmd, CsvCommandQueryResult result) { switch (cmd.CommandType) { case CsvCommandType.Select: lastSelectCommand = cmd; break; } switch (result.Type) { case CsvCommandQueryResultType.Csv: DisplayCsv(result.Csv); break; case CsvCommandQueryResultType.Int: if (lastSelectCommand != null) { CsvCommandRunner.GetInstance().Run(csv, lastSelectCommand); } UpdateText(); break; } }
private void Runner_OnError(CsvCommand cmd, Exception e) { MessageBox.Show(e.Message, "Csv Command Error"); }