public ItemManagementPage(IWebDriver driver) : base(driver) { // SearchByFieldSet is unique identifier of ItemManagementPage searchByFieldSet = new TextLabel(Driver, new Locator("SearchByFieldSet", By.XPath("//div[@id='list']//legend"))); editFirstProductLink = new Link(Driver, new Locator("EditFirstProductLink", By.XPath("//table[@id='table']/tbody/tr[1]/td[4]/a"))); searchInput = new TextInputField(Driver, new Locator("SearchInput", By.Id("searchField"))); searchButton = new Button(Driver, new Locator("SearchButton", By.XPath("//form[@id='searchForm']/input[2]"))); firstProductNameText = new Link(Driver, new Locator("FirstProductNameText", By.XPath("//table[@id='table']/tbody/tr[1]/td[1]"))); firstProductDescriptionText = new Link(Driver, new Locator("FirstProductDescriptionText", By.XPath("//table[@id='table']/tbody/tr[1]/td[2]"))); firstProductPriceText = new Link(Driver, new Locator("FirstProductPriceText", By.XPath("//table[@id='table']/tbody/tr[1]/td[3]"))); countOfProductFound = new TextLabel(Driver, new Locator("CountOfProductFound", By.XPath("//span[@id='recordsFound']"))); userInfoLink = new Link(Driver, new Locator("UserInfoLink", By.XPath("//ul[@id='nav']/li[2]/a"))); addProductLink = new Link(Driver, new Locator("AddProductLink", By.XPath("//div[@id='list']/a[1]"))); createReportLink = new Link(Driver, new Locator("CreateReportLink", By.XPath("//div[@id='list']/a[2]"))); }
private void Update() { if (Input.GetButtonDown("Toggle Dev Command Console") && (!InputFocusManager.Instance.IsAnyInputFieldInFocus() || InputFocusManager.Instance.IsInputFieldInFocus(TextInputField))) { ShowConsole = !ShowConsole; if (ShowConsole) { TextInputField.ActivateInputField(); } else { TextInputField.DeactivateInputField(); } } if (TextInputField.isFocused) { if (Input.GetKeyDown(KeyCode.UpArrow)) { OnHistoryUpClicked(); TextInputField.MoveTextEnd(false); } if (Input.GetKeyDown(KeyCode.DownArrow)) { OnHistoryDownClicked(); TextInputField.MoveTextEnd(false); } } }
private static GameObject MakeTextEntryPrefab() { GameObject result = GameObject.Instantiate(ComboBoxPrefab); GameObject originalTextBox = InterfaceManager.LoadPanel <Panel_Confirmation>().m_GenericMessageGroup?.m_InputField?.gameObject; GameObject newTextBox = GameObject.Instantiate(originalTextBox); newTextBox.transform.position = result.transform.FindChild("Label_Value").position; newTextBox.transform.parent = result.transform; newTextBox.name = "Text_Box"; TextInputField textInputField = newTextBox.GetComponent <TextInputField>(); textInputField.m_MaxLength = 25; GameObject.DestroyImmediate(result.GetComponent <ConsoleComboBox>()); result.DestroyChild("Button_Decrease"); result.DestroyChild("Button_Increase"); result.DestroyChild("Label_Value"); newTextBox.DestroyChild("bg"); newTextBox.DestroyChild("glow"); result.AddComponent <UIButton>(); return(result); }
public CreateNewOrderPage(IWebDriver driver) : base(driver) { // CVV2Text is unique identifier of CreateNewOrderPage cVV2Text = new TextLabel(Driver, new Locator("CVV2Text", By.XPath("//form[@id='form2']//tr[3]/td[1]/strong"))); addItemButton = new Button(Driver, new Locator("AddItemButton", By.XPath("//form[@id='addItem']/input[@value = 'Add Item']"))); orderNumberField = new TextInputField(Driver, new Locator("OrderNumberField", By.Id("orderNum"))); preferableDeliveryDateChooseLink = new Link(Driver, new Locator("PreferableDeliveryDateChooseLink", By.ClassName("dp-choose-date"))); calendarPopupElement = new Element(Driver, new Locator("CalendarPopupElement", By.XPath("//div[@id='dp-popup']"))); calendarMonthForwardButton = new Button(Driver, new Locator("CalendarMonthForwardButton", By.XPath("//div[@id='dp-popup']/div[2]/a[2]"))); dateLink = new Link(Driver, new Locator("DateLink", By.XPath("//div[@id='dp-popup']//tbody/tr[3]/td[4]"))); assigneeDropdown = new DropDown(Driver, new Locator("AssigneeDropdown", By.Id("assignee"))); saveButton = new Button(Driver, new Locator("SaveButton", By.Id("save"))); customerOrderingPageLink = new Link(Driver, new Locator("ClickCustomerOrderingPageLink", By.XPath("(//ul[@id='nav']//a)[1]"))); }
public AddProductPage(IWebDriver driver) : base(driver) { // OkButton is unique identifier of AddProductPage okButton = new Button(Driver, new Locator("OkButton", By.XPath("//form[@id='productModel']/input[2]"))); cancelButton = new Button(Driver, new Locator("CancelButton", By.XPath("//form[@id='productModel']/input[3]"))); productNameInput = new TextInputField(Driver, new Locator("ProductNameInput", By.Id("name"))); productDescriptionInput = new TextInputField(Driver, new Locator("TextInputField", By.Id("description"))); productPriceInput = new TextInputField(Driver, new Locator("ProducrPriceInput", By.Id("price"))); productNameErrorText = new Element(Driver, new Locator("ProductNameErrorText", By.XPath("//form[@id='productModel']/table/tbody/tr[1]/td[3]"))); productDescriptionErrorText = new Element(Driver, new Locator("ProductDescriptionErrorText", By.XPath("//form[@id='productModel']/table/tbody/tr[2]/td[3]"))); productPriceErrorText = new Element(Driver, new Locator("ProductPriceErrorText", By.XPath("//form[@id='productModel']/table/tbody/tr[3]/td[3]"))); }
public MerchandiserOrderingPage(IWebDriver driver) : base(driver) { //SearchByText is unique identifier of MerchandiserOrderingPage searchByText = new TextLabel(Driver, new Locator("SeachByText", By.XPath("//form[@id='searchFilter']//tr/td[1]"))); userInfoLink = new Link(Driver, new Locator("UserInfoLink", By.XPath("//ul[@id='nav']/li[2]/a"))); editFirstOrderLink = new Link(Driver, new Locator("EditFirstOrderLink", By.XPath("//div[@id='list']//tr[2]/td[6]/a"))); searchDropdown = new DropDown(Driver, new Locator("SearchDropDown", By.XPath("//select[@id='search']"))); searchInput = new TextInputField(Driver, new Locator("SearchInput", By.Id("searchValue"))); applyButton = new Button(Driver, new Locator("ApplyButton", By.XPath("//form[@id='searchFilter']//td[4]/input"))); firstOrderNameCell = new Link(Driver, new Locator("FirstOrderNameCell", By.XPath("//div[@id='list']/table/tbody/tr[2]/td[1]"))); firstOrderDeleteCell = new Link(Driver, new Locator("FirstOrderDeleteCell", By.XPath("//div[@id='list']/table/tbody/tr[2]/td[7]/a"))); }
public CreateUserPage(IWebDriver driver) : base(driver) { //Unique CreateUserPage Web Element loginNameLabel = new TextLabel(Driver, new Locator("LoginNameLabel", By.XPath("//*[@id='userModel']/table/tbody/tr[1]/td[1]"))); loginInput = new TextInputField(Driver, new Locator("LoginInput", By.Id("login"))); firstNameInput = new TextInputField(Driver, new Locator("FirstNameInput", By.Id("firstName"))); lastNameInput = new TextInputField(Driver, new Locator("LastNameInput", By.Id("lastName"))); passwordInput = new TextInputField(Driver, new Locator("PasswordInput", By.Id("password"))); confirmPasswordInput = new TextInputField(Driver, new Locator("ConfirmPasswordInput", By.Id("confirmPassword"))); emailInput = new TextInputField(Driver, new Locator("EmailInput", By.Id("email"))); productNameInput = new TextInputField(Driver, new Locator("ProductNameInput", By.Id("name"))); regionIdDropDown = new DropDown(Driver, new Locator("RegionIdDropDown", By.Id("regionID"))); roleDropDown = new DropDown(Driver, new Locator("RoleDropDown", By.Id("roleID"))); createButton = new Button(Driver, new Locator("CreateButton", By.XPath("//*[@id='userModel']/input[4]"))); cancelButton = new Button(Driver, new Locator("CancelButton", By.XPath("//*[@id='userModel']/input[5]"))); }
public CustomerOrderingPage(IWebDriver driver) : base(driver) { //CreateNewOrderLink is unique identifier of CustomerOrderingPage createNewOrderLink = new Link(Driver, new Locator("CreateNewOrderLink", By.XPath("//div[@id='content']/a"))); userInfoLink = new Link(Driver, new Locator("UserInfoLink", By.XPath("//ul[@id='nav']/li[2]/a"))); searchOrdersDropdown = new DropDown(Driver, new Locator("SearchOrdersDropdown", By.Id("search"))); searchOrdersInputField = new TextInputField(Driver, new Locator("SearchOrdersInputField", By.Id("searchValue"))); applyButton = new Button(Driver, new Locator("ApplyButton", By.Name("Apply"))); firstBodyEditLink = new Link(Driver, new Locator("FirstBodyEditLink", By.XPath("(//div[@id='list']//td/a)[1]"))); firstOrderNameCellTextField = new Element(Driver, new Locator("FirstOrderNameCellTextField", By.XPath("//div[@id='list']//td[1]"))); firstBodyDeleteLink = new Link(Driver, new Locator("FirstBodyDeleteLink", By.XPath("//div[@id='list']/table/tbody/tr[2]/td[8]"))); }
/// <summary> /// Create text input field /// </summary> /// <param name="_enterCallback">Callback when pressed enter key</param> /// <param name="pos">Position of the text field</param> /// <param name="_maxInput">Maximum allowed input</param> public void CreateTextInputField(TextInputField.Callback _enterCallback, Vector2 pos, int _maxInput) { TextInputField temp = Instantiate(textInputField); temp.transform.position = pos; temp.SetCallback(_enterCallback); temp.maxInput = _maxInput; currentInput = temp; }
private void MessageWindow_Loaded(object sender, RoutedEventArgs e) { if (this.MessageType != MessageWindowType.TextInput) { return; } Activate(); TextInputField.Focus(); Keyboard.Focus(TextInputField); TextInputField.SelectAll(); }
public LogInPage(IWebDriver driver) : base(driver) { usernameInput = new TextInputField(Driver, new Locator("UserNameInput", By.Name("j_username"))); passwordInput = new TextInputField(Driver, new Locator("PasswordInput", By.Name("j_password"))); logInButton = new Button(Driver, new Locator("LogInButton", By.Name("submit"))); cancelButton = new Button(Driver, new Locator("CancelButton", By.Name("reset"))); }
public void OnSubmit() { // We only want to submit when Enter is pressed, not when we simply lose focus if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) { var enteredLine = TextInputField.text; DevCommandMgr.QueueDevCommand(enteredLine); CurrentHistoryIndex = DevCommandMgr.History.Count; TextInputField.ActivateInputField(); } }
public EditProductPage(IWebDriver driver) : base(driver) { productNameInput = new TextInputField(Driver, new Locator("ProductNameInput", By.Id("name"))); productDescriptionInput = new TextInputField(Driver, new Locator("ProductDescriptionInput", By.Id("description"))); productPriceInput = new TextInputField(Driver, new Locator("ProductPriceInput", By.Id("price"))); okButton = new Button(Driver, new Locator("OkButton", By.XPath("//form[@id='productModel']/input[2]"))); cancelButton = new Button(Driver, new Locator("CancelButton", By.XPath("//form[@id='productModel']/input[3]"))); }
public static TextInputField CreateTextField(Vector2 pos, Point size, string prompt = "", Transform parent = null, ColorSet theme = ColorSet.Light) { TextInputFieldBuilder tBuilder = new TextInputFieldBuilder(pos, size) .TextAlignment(Alignment.Left) .Prompt(prompt) .Parent(parent); switch (theme) { case ColorSet.Light: tBuilder.Background(PanelOpaque, Color.White, 4) .Font(editor, Color.Black) .Animation(Color.White, Color.Yellow, Color.Orange, Color.Red); break; case ColorSet.Dark: tBuilder.Background(PanelTransparent, new Color(Color.Black, 0.667f), 4) .Font(editor, Color.Red) .Animation(new Color(Color.Black, 0.667f), Color.DarkGray, Color.LightGray, Color.White); break; case ColorSet.Blue: tBuilder.Background(PanelTransparent, Color.Blue, 4) .Font(editor, Color.White) .Animation(Color.Blue, Color.DarkBlue, Color.Indigo, Color.Purple); break; case ColorSet.Red: tBuilder.Background(PanelTransparent, Color.Red, 4) .Font(editor, Color.Black) .Animation(Color.Red, Color.OrangeRed, Color.Orange, Color.Yellow); break; default: throw new ArgumentOutOfRangeException(nameof(theme), theme, null); } TextInputField textField = tBuilder; UIColorAnimator colorAnim = textField.GetComponent <UIColorAnimator>(); if (colorAnim != null) { textField.OnFocus += () => colorAnim.Toggle(); textField.OnUnfocus += () => colorAnim.Untoggle(); } return(textField); }
public NetworkTestMenu() : base(Vector2.Zero) { if (Screen.IsFullHeadless) { return; } notConnectedMenu = new GameObject(Vector2.Zero, 0f, Vector2.One); Transform parentTransform = notConnectedMenu.Transform; parentTransform.SetParent(Transform); Button hostServer = EditorTheme.CreateButton(new Vector2(100, 100), new Point(200, 100), "Start server", parentTransform, EditorTheme.ColorSet.Blue); spawnButton = EditorTheme.CreateButton(new Vector2(100, 100), new Point(200, 100), "Spawn stuff", Transform, EditorTheme.ColorSet.Light); Button connect = EditorTheme.CreateButton(new Vector2(100, 400), new Point(200, 100), "Connect", parentTransform, EditorTheme.ColorSet.Blue); TextInputField addressField = EditorTheme.CreateTextField(new Vector2(310, 100), new Point(200, 40), null, parentTransform); addressField.DefocusOnConfirm = false; addressField.ClearOnUnfocus = false; addressField.SetValue("127.0.0.1"); TextInputField portField = EditorTheme.CreateTextField(new Vector2(620, 100), new Point(100, 40), null, parentTransform); portField.DefocusOnConfirm = false; portField.ConfirmOnEnter = false; portField.ClearOnUnfocus = false; portField.SetValue(Random.Next(1, 25000).ToString()); spawnButton.Disable(); addressField.Confirmed += (sender, args) => Network.Connect(addressField.Input.Value, Convert.ToInt32(portField.Input.Value), 919); hostServer.Clicked += (sender, args) => Network.StartServer(919, 920); spawnButton.Clicked += (sender, args) => Game.SpawnStuff(); connect.Clicked += (sender, args) => Network.Connect(addressField.Input.Value, Convert.ToInt32(portField.Input.Value), 919); }
public AdministrationPage(IWebDriver driver) : base(driver) { // FoundUsersTextLabel is unique identifier of AdministrationPage foundUsersTextLabel = new TextLabel(Driver, new Locator("FoundUsersTextLabel", By.XPath("//div[@id='list']/h4[1]"))); userInfoLink = new Link(Driver, new Locator("UserInfoLink", By.XPath("//ul[@id='nav']/li[2]/a"))); createNewUserLink = new Link(Driver, new Locator("CreateNewUserLink", By.XPath("//div[@id='list']/a"))); createReportLink = new Link(Driver, new Locator("CreateReportLink", By.XPath("//div[@id='list']/h5/a"))); editFirstUserLink = new Link(Driver, new Locator("EditFirstUserLink", By.XPath("//table[@id='table']//a[@href='editUser.htm?userID=1']"))); deleteUserCell = new Link(Driver, new Locator("DeleteUserCell", By.XPath("//*[@id='table']/tbody/tr[1]/td[7]/a"))); fieldFilter = new DropDown(Driver, new Locator("FieldFilter", By.XPath("//*[@id='field']"))); conditionFilter = new DropDown(Driver, new Locator("ConditionFilter", By.XPath("//*[@id='condition']"))); searchInputField = new TextInputField(Driver, new Locator("SearchInputField", By.XPath("//*[@id='searchField']"))); searchButton = new Button(Driver, new Locator("SearchButton", By.XPath("//*[@id='searchForm']/input[2]"))); deleteFirstCellLink = new Link(Driver, new Locator("DeleteFirstCellLink", By.XPath("//*[@id='table']/tbody/tr[1]/td[7]/a"))); logInFirstCellLink = new Link(Driver, new Locator("LoginFirstCellLink", By.XPath("//*[@id='table']/tbody/tr[1]/td[3]"))); firstNameHeader = new Button(Driver, new Locator("FirstNameHeader", By.XPath("//*[@id='table']/thead/tr/th[1]/a"))); lastNameHeader = new Button(Driver, new Locator("LastNameHeader", By.XPath("//*[@id='table']/thead/tr/th[2]/a"))); loginHeader = new Button(Driver, new Locator("LoginHeader", By.XPath("//*[@id='table']/thead/tr/th[3]/a"))); roleHeader = new Button(Driver, new Locator("RoleHeader", By.XPath("//*[@id='table']/thead/tr/th[4]/a"))); regionHeader = new Button(Driver, new Locator("RegionHeader", By.XPath("//*[@id='table']/thead/tr/th[5]/a"))); loginSecondCellLink = new Link(Driver, new Locator("LoginSecondCellLink", By.XPath("//*[@id='table']/tbody/tr[2]/td[3]"))); firstNameColumn = new Element(Driver, new Locator("FirstNameColumn", By.XPath("//*[@id='table']/tbody//td[1]"))); lastNameColumn = new Element(Driver, new Locator("LastNameColumn", By.XPath("//*[@id='table']/tbody//td[2]"))); loginColumn = new Element(Driver, new Locator("LoginColumn", By.XPath("//*[@id='table']/tbody//td[3]"))); roleColumn = new Element(Driver, new Locator("RoleColumn", By.XPath("//*[@id='table']/tbody//td[4]"))); regionColumn = new Element(Driver, new Locator("RegionColumn", By.XPath("//*[@id='table']/tbody//td[5]"))); }
//All the view classes derived from the View-class, and every class has a abstract method for general variables etc //so it's easy to add more functionality to the framework static void Main(string[] args) { //3 SCENARIOS FOR THIS FRAMEWORK // 1. Login in terminal [ /* With textfield and labels you can create a loginsystem in the CMD */ var start = new Application(); start.Initialize(); var mainWindow = new Window(100, 100, "black", start); ButtonClicked enButton = new ButtonClicked("hei", 1, 1, 1, 1); enButton.OnActionButton(); mainWindow.AddedViews.Add(enButton); new TextLabel("ku", 10, 20, 0, 0); new TextInputField("Enter Name", 10, 20, 30, 40); // ] // 2. Create a calulator in the CMD [ /* * Since you already can implement textlabels and textfield, the user can override the OnActions methods * so make a calculator * */ var start2 = new Application(); start.Initialize(); var mainWindow2 = new Window(100, 100, "black", start); ButtonClicked addButton = new ButtonClicked("Add", 1, 1, 1, 1); enButton.OnActionButton(); ButtonClicked substractButton = new ButtonClicked("Substract", 1, 1, 1, 1); enButton.OnActionButton(); ButtonClicked divideButton = new ButtonClicked("Divide", 1, 1, 1, 1); enButton.OnActionButton(); ButtonClicked multiplyButton = new ButtonClicked("Mulitply", 1, 1, 1, 1); enButton.OnActionButton(); var firstTextBlock = new TextLabel("3", 10, 20, 0, 0); var firstTextField = new TextInputField("Enter the first number", 0, 20, 30, 40); var secondTextBlock = new TextLabel("5", 10, 20, 0, 0); var secondTextField = new TextInputField("Enter the second number", 10, 20, 30, 40); mainWindow.AddedViews.Add(addButton); mainWindow.AddedViews.Add(substractButton); mainWindow.AddedViews.Add(divideButton); mainWindow.AddedViews.Add(multiplyButton); mainWindow.AddedViews.Add(firstTextBlock); mainWindow.AddedViews.Add(firstTextField); mainWindow.AddedViews.Add(secondTextBlock); mainWindow.AddedViews.Add(secondTextField); // ] // 3. Excel sheet [ var star1t = new Application(); star1t.Initialize(); var tertiaryWindow = new Window(200, 100, "black", start); int w = 0, h = 0, x = 0, y = 0; for (int i = 0; i < 10; i++) { tertiaryWindow.AddedViews.Add(new TextInputField("", 5, 10, 0, 0)); w += 10; h += 5; x += 10; if (i == 5) { y += 5; } } }
public TextInputFieldBuilder(Vector2 pos, Point size) { textInputField = new TextInputField(pos, size); }
public TextInputFieldBuilder(TextInputField existing) { textInputField = existing; }
public EditUserPage(IWebDriver driver) : base(driver) { // ConfirmPasswordText is unique identifier of EditUserPage confirmPasswordText = new TextInputField(Driver, new Locator("ConfirmPasswordText", By.Id("confirmPassword"))); }
public ConsoleUI() : base(Vector2.Zero) { consoleColor = new Color(0, 0, 0, 200); if (Screen.DisplayMode != DisplayMode.Normal) { background = new Image(new Vector2(0, 0), new Point(1920 - 30, 1040), AssetManager.Get <SpriteTexture>(this, "uiRect")) { SpriteColor = consoleColor, Parent = Transform }; ScrollView = new ScrollView(new Vector2(0, 0), new Point(1920 - 30, 1040), new Rectangle(0, 40, 1920, 1040)) { Parent = background.Transform, DisableHidden = true }; TextInputField = EditorTheme.CreateTextField(new Vector2(0, 1040), new Point(1920, 40), ">", background.Transform); ScrollBar = new ScrollBar(new Vector2(1920 - 30, 0), new Point(30, 1040), new Point(50, 50), AssetManager.Get <SpriteTexture>(this, "uiRect"), AssetManager.Get <SpriteTexture>(this, "uiRect")) { BackgroundColor = Color.Black, HandleColor = Color.White, Parent = background.Transform }; } else { background = new Image(new Vector2(0, 1080 - 300), new Point(1920 - 30, 300), AssetManager.Get <SpriteTexture>(this, "uiRect")) { SpriteColor = consoleColor, Parent = Transform }; ScrollView = new ScrollView(new Vector2(0, 0), new Point(1920 - 30, 300), new Rectangle(0, 1080 - 300, 1920, 300)) { Parent = background.Transform, DisableHidden = true }; TextInputField = EditorTheme.CreateTextField(new Vector2(0, 265), new Point(1920, 35), ">", background.Transform); ScrollBar = new ScrollBar(new Vector2(1920 - 30, 0), new Point(30, 265), new Point(50, 50), AssetManager.Get <SpriteTexture>(this, "uiRect"), AssetManager.Get <SpriteTexture>(this, "uiRect")) { BackgroundColor = Color.Black, HandleColor = Color.White, Parent = background.Transform }; } textLines = new List <Text>(maxLines); textPool = new GameObjectPool <Text>(() => EditorTheme.CreateText(Vector2.Zero, Color.Red, "", ScrollView.Transform), maxLines) { Behaviour = PoolBehavior.Fixed, ReturnOnDestroy = true }; ScrollView.ScrollBar = ScrollBar; TextInputField.DefocusOnConfirm = false; }