private void oScript_ScriptError(string symbol, string alertName, string description) { if (m_loading || m_dialogShown) { return; } m_dialogShown = true; //Prevent the error from occuring over and over Alert oAlert = m_TSAlertDictionary[symbol]; if (oAlert == null) { return; } //Find and highlight the record int row = -1; for (int n = 0; n < grdResults.Rows.Count; n++) { if (string.Compare(grdResults.Rows[n].Cells["Symbol"].Value.ToString(), symbol, true) == 0) { row = n; break; } } DataGridViewImageButtonCell cell = (DataGridViewImageButtonCell)grdResults.Rows[row].Cells["Start"]; if (cell == null) { return; } TempScript = oAlert.AlertName; if (string.IsNullOrEmpty(oAlert.AlertName)) //if not already paused { TempScript = oAlert.AlertScript; oAlert.AlertName = oAlert.AlertScript; //Using AlertName as a Tag oAlert.AlertScript = string.Empty; //Pause cell.Checked = true; } // Display the error message if (!string.IsNullOrEmpty(oAlert.ScriptHelp)) { if (MessageBox.Show("Your script generated an error: " + Environment.NewLine + description + Environment.NewLine + "Would you like to view help regarding this error?", "Error:", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { MessageBox.Show(oScript.ScriptHelp, symbol, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Your script generated an error:" + Environment.NewLine + description, symbol, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } //Show edit dialog TempScript = string.IsNullOrEmpty(oAlert.AlertScript) ? oAlert.AlertName : oAlert.AlertScript; frmScannerScript settings = new frmScannerScript(this) { HeaderText = symbol + " Script" }; DialogResult result = settings.ShowDialog(); m_dialogShown = false; if (result == DialogResult.Abort) { m_frmMain.OpenURL("http://www.modulusfe.com/TradeScript/TradeScript.pdf", "TradeScript Help"); return; } if (result == DialogResult.OK) { oAlert.AlertScript = TempScript; oAlert.AlertName = string.Empty; cell.Checked = false; //Script is runing now } }
//Display the TradeScript documentation private void cmdDocumentation_Click(object sender, EventArgs e) { m_frmMain.OpenURL("http://www.modulusfe.com/tradescript/TradeScript.pdf", "TradeScript Help"); }