public void Setup() { //Get the Fundamentals List flfundamentals.Controls.Clear(); foreach (var type in Array.FindAll(ReflectMan.Types, t => t.GetInterfaces().Contains(typeof(IShiftnetSite)) && t.BaseType == typeof(UserControl) && Shiftorium.UpgradeAttributesUnlocked(t))) { var attrs = type.GetCustomAttributes(false); var attribute = attrs.FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute; if (attribute != null) { if (attrs.OfType <ShiftnetFundamentalAttribute>().Any()) { var dash = new Label(); dash.Text = " - "; dash.AutoSize = true; flfundamentals.Controls.Add(dash); dash.Show(); var link = new LinkLabel(); link.Text = attribute.Name; link.Click += (o, a) => { GoToUrl?.Invoke(attribute.Url); }; flfundamentals.Controls.Add(link); flfundamentals.SetFlowBreak(link, true); link.Show(); link.LinkColor = SkinEngine.LoadedSkin.ControlTextColor; } } } }
public void SetupListing() { fllist.Controls.Clear(); foreach (var type in Array.FindAll(ReflectMan.Types, t => t.GetInterfaces().Contains(typeof(IShiftnetSite)))) { var attr = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute; if (attr != null) { if (attr.Url.StartsWith("shiftnet/")) { var lnk = new LinkLabel(); lnk.LinkColor = SkinEngine.LoadedSkin.ControlTextColor; lnk.Text = attr.Name; var desc = new Label(); desc.AutoSize = true; lnk.AutoSize = true; desc.MaximumSize = new Size(this.Width / 3, 0); desc.Text = attr.Description; desc.Padding = new Padding { Bottom = 25, Top = 0, Left = 10, Right = 10 }; lnk.Click += (o, a) => { GoToUrl?.Invoke(attr.Url); }; fllist.Controls.Add(lnk); fllist.Controls.Add(desc); ControlManager.SetupControls(lnk); lnk.Show(); desc.Show(); } } } }
private List <ConsoleDebuggerActionHook> GetActionHooks(int index, IEnumerable <Keyword> allKeywords) { var commands = new List <ConsoleDebuggerActionHook>() { new ConsoleDebuggerActionHook("find (.+)", "find X: use this to test a web element locator", input => { var arg = ParseArguments(input, 1).First(); var script = $@"tagMatches(getExactMatches(""{arg}""));"; (Selenium.WebDriver).RunLibraryScript(script); DontDoAnything(index); }), new ConsoleDebuggerActionHook("click (.+)", "click X: use this to click on element ad-hoc", input => { var arg = ParseArguments(input, 1).First(); var click = new Click(arg); ServiceLocator.Instance.Resolve(click); Command.SelectedKeyword = click; Command.NextIndex = Command.NextIndex - 1; }), new ConsoleDebuggerActionHook("isvisible (.+)", "isvisible X: checks visibility of text", input => { var arg = ParseArguments(input, 1).First(); var isVisible = new IsVisible(arg) { Expect = true }; ServiceLocator.Instance.Resolve(isVisible); Command.SelectedKeyword = isVisible; Command.NextIndex = Command.NextIndex - 1; }), new ConsoleDebuggerActionHook("fill (.+) (.+)", "fill X Y: use this to fill on element ad-hoc", input => { var args = ParseArguments(input, 2); var fill = new Fill(args.First(), args.Last()); ServiceLocator.Instance.Resolve(fill); Command.SelectedKeyword = fill; Command.NextIndex = Command.NextIndex - 1; }), new ConsoleDebuggerActionHook("show", "show [left|right]: highlights buttons with their sort orders using a screen overlay", input => { var args = ParseArguments(input, 1); var show = new Show(args.First()); ServiceLocator.Instance.Resolve(show); Command.SelectedKeyword = show; Command.NextIndex = Command.NextIndex - 1; }), new ConsoleDebuggerActionHook("goto (.+)", "goto X: use this to click on element ad-hoc", input => { var arg = ParseArguments(input, 1).First(); var go = new GoToUrl(arg); ServiceLocator.Instance.Resolve(go); Command.SelectedKeyword = go; Command.NextIndex = Command.NextIndex - 1; }), new ConsoleDebuggerActionHook("restart", "restart : go back to the beginning of the test", input => { Command.NextIndex = -1; Command.RunStep = false; }), new ConsoleDebuggerActionHook("savehtml", "savehtml : save current page source to a new HTML file", input => { var save = new SaveHtml(); ServiceLocator.Instance.Resolve(save); Command.SelectedKeyword = save; Command.NextIndex = Command.NextIndex - 1; }), new ConsoleDebuggerActionHook("run ([0-9]*)", "run <N>: runs N steps", input => { var args2 = ParseArguments(input, 1); Command.StopOnIndex = Math.Min(allKeywords.Count() - 2, index + 1 + int.Parse(args2.First())); Command.StepThrough = false; }), new ConsoleDebuggerActionHook("run", "run : Run selected step", input => { Command.StepThrough = false; }), new ConsoleDebuggerActionHook("back ([0-9]*)", "back <N>: Return selection N steps back", input => { var args3 = ParseArguments(input, 1); Command.NextIndex = Math.Max(-1, index - 1 - int.Parse(args3.First())); Command.RunStep = false; }), new ConsoleDebuggerActionHook("back", "back : Return selection to previous step", input => { Command.NextIndex = Math.Max(-1, index - 2); Command.RunStep = false; }), new ConsoleDebuggerActionHook("skip ([0-9]*)", "skip N : Skips N steps", input => { var args4 = ParseArguments(input, 1); Command.NextIndex = Math.Min(allKeywords.Count() - 2, index - 1 + int.Parse(args4.First())); Command.RunStep = false; }), new ConsoleDebuggerActionHook("skip", "skip : Skips one step", input => { Command.RunStep = false; }), new ConsoleDebuggerActionHook("stop", "stop : Stops the test", input => { Command.Break = true; DontDoAnything(index); }), new ConsoleDebuggerActionHook("reload", "reload : re-reads all input files", input => { foreach (var dataAccess1 in Data.DataAccesses.OfType <FileObjectAccess>()) { dataAccess1.ForceReload(); } Command.Reload = true; DontDoAnything(index); }) }; return(commands); }
private void btnping_Click(object sender, EventArgs e) { GoToUrl?.Invoke("shiftnet/shiftsoft/ping"); }