private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog() { DefaultExt = "xml", InitialDirectory = Path.Combine(Application.StartupPath, "reqs"), }; dlg.Title = "Open Request"; dlg.Filter = "xml files (*.xml)|*.xml"; if (dlg.ShowDialog() == DialogResult.OK) { using (StreamReader sr = new StreamReader(dlg.FileName, true)) { XDocument xmlDoc = XDocument.Load(sr); CurrentFile = dlg.FileName; StringWriter sw = new StringWriter(); XmlTextWriter xw = new XmlTextWriter(sw); xw.Formatting = Formatting.Indented; xmlDoc.WriteTo(xw); txtReq.Text = sw.ToString(); HighlightColors.HighlightRTF(txtReq); } } dlg.Dispose(); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (summaryDataTable != null) { xmlHelper.saveSummary(summaryDataTable, "summary" + DateTime.Now.ToFileTime().ToString() + ".txt"); } if (_rtbTestAllLog.Text != string.Empty) { HighlightColors.HighlightRTF(_rtbTestAllLog); _rtbTestAllLog.SaveFile("testAll" + DateTime.Now.ToFileTime().ToString() + ".rtf"); } }
public void WrapUpTestAll() { if (_rtbTestAllLog.InvokeRequired) { _rtbTestAllLog.BeginInvoke((Action) delegate { HighlightColors.HighlightRTF(_rtbTestAllLog); _rtbTestAllLog.SaveFile("testAll" + DateTime.Now.ToFileTime().ToString() + ".rtf"); }); } else { HighlightColors.HighlightRTF(_rtbTestAllLog); _rtbTestAllLog.SaveFile("testAll" + DateTime.Now.ToFileTime().ToString() + ".rtf"); } }
public void WrapUpTestCustom(string res, string hdr) { if (treeRes.InvokeRequired) { treeRes.BeginInvoke((Action) delegate { treeRes.Nodes.Clear(); xmlHelper.fillTree(res, treeRes); txtRes.Text = res; HighlightColors.HighlightRTF(txtRes); }); } else { treeRes.Nodes.Clear(); xmlHelper.fillTree(res, treeRes); txtRes.Text = res; HighlightColors.HighlightRTF(txtRes); } }
private void btnLoadReq_Click(object sender, EventArgs e) { Progress("Processing", true); CurrentFile = null; try { if (tableLayoutPanel6.RowCount > 2) { int rows = tableLayoutPanel6.RowCount; for (int i = 3; i <= rows; i++) { tableLayoutPanel6.Controls.RemoveByKey("param" + (i - 3)); tableLayoutPanel6.RowCount -= 1; } } txtReq.Text = ""; Type type = typeof(EzServiceClient); MethodInfo method = type.GetMethod(SelectedMethod); object[] args = new object[] { }; int pPos = 0; string pType = null; string pName = null; foreach (ParameterInfo pParameter in method.GetParameters()) { //Position of parameter in method pPos = pParameter.Position; //Name of parameter type pType = pParameter.ParameterType.Name; //Name of parameter pName = pParameter.Name; txtReq.Text += string.Format("pos:{0}{3}type:{1}{3}name:{2}{3}{3}", pPos, pType, pName, Environment.NewLine); AddControl(new TextBox() { Name = "param" + pPos, Text = pName }); } HighlightColors.HighlightRTF(txtReq); } catch (TargetInvocationException ex) { Exception inner = ex.InnerException; if (inner.GetType() == typeof(NotImplementedException)) { txtException.Text = (SelectedMethod + " Not Implemented\n"); } else if (inner.GetType() == typeof(NullReferenceException)) { txtException.Text = (SelectedMethod + " test method is missing\n "); } else if (inner.GetType() == typeof(TimeoutException)) { txtException.Text = (SelectedMethod + " timeout exception \n"); } else { txtException.Text = SelectedMethod + "\n" + ex + "\n" + ex.StackTrace + "\n"; } } catch (Exception ex) { txtException.Text = ex.Message; } finally { Progress("Finished"); } }