private void KeywordTextBox_PreviewKeyDown(object sender, KeyEventArgs e) { //if the user backspaces or presses the delete key then remove the line the cursor is on //or remove the text selection if (e.Key == Key.Delete || e.Key == Key.Back) { //remove the line that the cursor is on string currentText = KeywordTextBox.Text; int lineIndex = KeywordTextBox.GetLineIndexFromCharacterIndex(KeywordTextBox.CaretIndex); if (lineIndex == -1) { return; } int lineLength = KeywordTextBox.GetLineLength(lineIndex); int lineIndexStart = KeywordTextBox.GetCharacterIndexFromLineIndex(lineIndex); if (currentText.Length < (lineIndexStart + lineLength)) { return; } currentText = KeywordTextBox.Text.Remove(lineIndexStart, lineLength).Trim(); KeywordTextBox.Text = currentText; e.Handled = true; } else { e.Handled = true; } }
private void SearchButton_Click(object sender, RoutedEventArgs e) { if (SearchPanel.Visibility == Visibility.Collapsed) { SubSplitView.IsPaneOpen = true; SearchPanel.Visibility = Visibility.Visible; KeywordTextBox.Focus(FocusState.Programmatic); } else { SearchPanel.Visibility = Visibility.Collapsed; } }
public MainWindow() { InitializeComponent(); MarginAnimation(new Thickness(-1000, 7, 1000, 7), OriginalTextBox); MarginAnimation(new Thickness(7, 1000, 7, -1000), EncryptedTextBox); MarginAnimation(new Thickness(1000, 7, -1000, 7), DecryptedTextBox); DoubleAnimation KeyWordTextBoxAnimation = new DoubleAnimation(); KeyWordTextBoxAnimation.From = 0; KeyWordTextBoxAnimation.To = 36; KeyWordTextBoxAnimation.Duration = TimeSpan.FromSeconds(2); KeywordTextBox.BeginAnimation(TextBox.HeightProperty, KeyWordTextBoxAnimation); }
private void OnAddKeywordClick(object sender, RoutedEventArgs e) { var vm = DataContext as TwitterNotifierViewModel; if (vm != null) { var keyword = KeywordTextBox.Text; if (!string.IsNullOrWhiteSpace(keyword)) { vm.Settings.Keywords.Add(keyword); } KeywordTextBox.Text = string.Empty; KeywordTextBox.Focus(); } }
private void AddKeywordButton_Click(object sender, RoutedEventArgs e) { var keyword = KeywordTextBox.Text; if (keyword.IsNullOrEmpty()) { return; } var binding = new KeywordBinding { Action = KeywordAction.Favorite, IsEnabled = true, Keyword = keyword }; binding.BeginEdit(); keywordBindings.Add(binding); KeywordTextBox.Clear(); }
private void AddKeywordButton_Click(object sender, RoutedEventArgs e) { if (KeywordTextBox.Text == "") { MessageBox.Show("Enter a keyword to add to the list!", "No keyword", MessageBoxButton.OK, MessageBoxImage.Exclamation); KeywordTextBox.Clear(); } else if (KeywordListBox.Items.Contains(KeywordTextBox.Text)) { MessageBox.Show("This keyword is already on the list!", "Duplicate keyword", MessageBoxButton.OK, MessageBoxImage.Exclamation); KeywordTextBox.Clear(); } else { KeywordListBox.Items.Add(KeywordTextBox.Text); KeywordTextBox.Clear(); } }
public void SearchGQ(string keyWord) { Thread.Sleep(2000); KeywordTextBox.SendKeys(keyWord); SearchButton1.Click(); }
public void SearchGlobalQuestions(DataRow dr) { string keyWord = string.Empty; SelectQuestionTypePage qTypePage = new SelectQuestionTypePage(driver); DataTable dt; switch (dr["GQType"].ToString()) { case "Single Line Text Box": dt = ExcelData.GetData_DataTable("ER_TESTDATA", "GQSingleLineTextBox", "KeyName", "Default"); keyWord = qTypePage.CreateGQ_SingleLineTextBox(dt.Rows[0]); break; case "Multi Line Text Area": dt = ExcelData.GetData_DataTable("ER_TESTDATA", "GQMultiLineTextArea", "KeyName", "Default"); keyWord = qTypePage.CreateGQ_MultiLineTextArea(dt.Rows[0]); break; case "Select Single Item from a List": dt = ExcelData.GetData_DataTable("ER_TESTDATA", "GQSelectSingleItem", "KeyName", "Default"); keyWord = qTypePage.CreateGQ_SelectSingleItem(dt.Rows[0]); break; case "Select Multiple Items from a List": dt = ExcelData.GetData_DataTable("ER_TESTDATA", "GQSelectMultipleItems", "KeyName", "Default"); keyWord = qTypePage.CreateGQ_SelectMultipleitems(dt.Rows[0]); break; case "Numeric": dt = ExcelData.GetData_DataTable("ER_TESTDATA", "GQNumeric", "KeyName", "Default"); keyWord = qTypePage.CreateGQ_Numeric(dt.Rows[0]); break; case "Yes or No": dt = ExcelData.GetData_DataTable("ER_TESTDATA", "GQYesorNo", "KeyName", "Default"); keyWord = qTypePage.CreateGQ_YesorNo(dt.Rows[0]); break; case "Date": dt = ExcelData.GetData_DataTable("ER_TESTDATA", "GQDate", "KeyName", "Default"); keyWord = qTypePage.CreateGQ_Date(dt.Rows[0]); break; case "File Upload": dt = ExcelData.GetData_DataTable("ER_TESTDATA", "GQFileUpload", "KeyName", "Default"); keyWord = qTypePage.CreateGQ_FileUpload(dt.Rows[0]); break; default: break; } if (dr["Advanced Search"].ToString() == "No") { ExtentReport.test.Log(LogStatus.Info, "Searching Global Questions for the keyword - " + keyWord + " in Global Questions List Page"); SearchGQ(keyWord); } else { ExtentReport.test.Log(LogStatus.Pass, "Advanced Searching Global Questions for the keyword - " + keyWord + " in Global Questions List Page"); Thread.Sleep(2000); KeywordTextBox.SendKeys(keyWord); ShowAdvancedSearchButton.Click(); Thread.Sleep(2000); if (dr["Date"].ToString() == "Yes") { DateCheckbox.Click(); } if (dr["File Upload"].ToString() == "Yes") { FileUploadCheckbox.Click(); } if (dr["Select Multiple Items from a List"].ToString() == "Yes") { SelectMultipleItemsfromaListCheckbox.Click(); } if (dr["Numeric"].ToString() == "Yes") { NumericCheckbox.Click(); } if (dr["Ordered Preference"].ToString() == "Yes") { OrderedPreferenceCheckbox.Click(); } if (dr["Multi Line Text Area"].ToString() == "Yes") { MultiLineTextAreaCheckbox.Click(); } if (dr["Select Single Item from a List"].ToString() == "Yes") { SelectSingleItemfromaListCheckbox.Click(); } if (dr["Single Line Text Box"].ToString() == "Yes") { SingleLineTextBoxCheckbox.Click(); } if (dr["Yes or No"].ToString() == "Yes") { YesorNoCheckbox.Click(); } if (dr["Label"].ToString() == "Yes") { LabelCheckbox.Click(); } DateRangeTextBox.SendKeys(dr["Date Range"].ToString()); Thread.Sleep(2000); ApplyButton.Click(); BaseMethods.DdlSelectByText(IsActiveDropDownList, dr["Is Active"].ToString()); SearchButton2.Click(); } Thread.Sleep(2000); IList <IWebElement> searchedList = driver.FindElements(By.XPath("//table[@class='table table-nga footable footableConfigurable base-list-table default footable-loaded']/tbody/tr")); bool searchResult = false; for (int i = 0; i < searchedList.Count; i++) { if (searchedList[i].Text.Contains(keyWord) && searchedList[i].Text.Contains(dr["GQType"].ToString().Trim())) { searchResult = true; } } Assert.IsTrue(searchResult, "Searching Global Questions for the keyword - " + keyWord + " in Global Questions List Page is Unsuccessful"); ExtentReport.test.Log(LogStatus.Pass, "Searching Global Questions for the keyword - " + keyWord + " in Global Questions List Page is Successful"); }