private void DocPaneControl_Load(object sender, EventArgs e) { this.comboBox1.Items.AddRange(TestCommandFactory.GetCommandNames().ToArray()); this.webBrowser1.Navigate("about:blank"); this.webBrowser1.Navigate(Properties.Resources.HelpUrl); #if DEBUG this.webBrowser1.IsWebBrowserContextMenuEnabled = true; #endif }
private void AddCommandWorkbookIfNotExists(Excel.Workbook workbook) { Excel.Worksheet worksheet = this.GetCommandWorksheet(workbook); if (null == worksheet) { worksheet = ExcelHelper.WorksheetAdd(workbook); worksheet.Name = SeleniumCommandWorksheetName; } var versionString = ExcelWorksheetCustomPropertyAccessor.Get(worksheet, SeleniumCommandVersion); var commandUpdating = true; if (!string.IsNullOrWhiteSpace(versionString)) { var version = new Version(versionString); if (App.Context.Version <= version) { commandUpdating = false; } } #if DEBUG commandUpdating = true; #endif if (!commandUpdating) { return; } ExcelWorksheetCustomPropertyAccessor.Set(worksheet, SeleniumCommandVersion, App.Context.Version.ToString()); var commands = TestCommandFactory.GetCommandNames(); for (int i = 0; i < commands.Count(); i++) { string command = commands.ElementAt(i).Trim(); worksheet.Cells[i + 1, 1] = command.Trim(); } worksheet.Visible = Excel.XlSheetVisibility.xlSheetHidden; }
public string Convert() { var items = new List <Item>(); var xml = this.GetXml(); var ns = xml.Root.Name.Namespace; var elements = xml.XPathSelectElements("//strong/a[@name]"); foreach (var element in elements) { var item = new Item() { Name = element.Attribute("name").Value, }; XElement dt = element.Parent.Parent; this.GetArgs(item, dt); XElement dd = dt.ElementsAfterSelf().First(); this.GetArgs2(item, dd); this.GetDescription(item, dd); var tmps = new List <Item>(); tmps.Add(item); tmps.AddRange(this.GetSubItems(dd, item.Description)); foreach (var tmp in tmps) { var andWaitName = tmp.Name + "AndWait"; if (this.IsCommandExists(andWaitName)) { items.Add(new Item() { Name = andWaitName, Target = item.Target, Value = item.Value, Description = item.Description, }); } } items.AddRange(tmps); } var missing = new StringBuilder(); foreach (var name in TestCommandFactory.GetCommandNames()) { if (0 == items.Where(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase)).Count()) { missing.AppendLine(name); } } File.WriteAllText(Path.Combine(App.TempDir, "commands-missing.txt"), missing.ToString()); StringBuilder sb = new StringBuilder(); foreach (var item in items .Where(i => this.IsCommandExists(i.Name)) .OrderBy(i => i.Name)) { var s = @" <div class=""command""> <h3 id=""***NAME***"">***NAME***</h3> <ul> ***TARGET*** ***VALUE*** </ul> <div class=""command-description"">***DESC***</div> </div> "; s = s.Replace("***NAME***", item.Name); if (string.IsNullOrWhiteSpace(item.Target)) { s = s.Replace("***TARGET***", string.Empty); } else { s = s.Replace("***TARGET***", @"<li class=""command-target""><strong>Target</strong> = <span class=""command-target-description"">" + item.Target + "</span></li>"); } if (string.IsNullOrWhiteSpace(item.Value)) { s = s.Replace("***VALUE***", string.Empty); } else { s = s.Replace("***VALUE***", @"<li class=""command-value""><strong>Value</strong> = <span class=""command-value-description"">" + item.Value + "</span></li>"); } s = s.Replace("***DESC***", item.Description); sb.AppendLine(s); } return(sb.ToString()); }
private bool IsCommandExists(string name) { var names = TestCommandFactory.GetCommandNames(); return(0 < names.Where(i => string.Equals(i, name, StringComparison.OrdinalIgnoreCase)).Count()); }