private void ComboBoxOrderBy_SelectedIndexChanged(object sender, EventArgs e) { TextBoxSearch.Focus(); if (ComboBoxOrderBy.SelectedIndex == 0) { ProductBox.Products = ProductBox.Products.OrderBy(Product => !Product.Promotion).ThenByDescending(Product => Product.PromotionPercentage).ToList(); } if (ComboBoxOrderBy.SelectedIndex == 1) { ProductBox.Products = ProductBox.Products.OrderBy(Product => Product.Name).ToList(); } if (ComboBoxOrderBy.SelectedIndex == 2) { ProductBox.Products = ProductBox.Products.OrderByDescending(Product => Product.Promotion ? Product.PromotionValue : Product.Value).ToList(); } if (ComboBoxOrderBy.SelectedIndex == 3) { ProductBox.Products = ProductBox.Products.OrderBy(Product => Product.Promotion ? Product.PromotionValue : Product.Value).ToList(); } ProductBox.UpdateView(); }
public AdoptionList() { InitializeComponent(); adoptions = adoptionViewModel.GetAdoptions(); // load own class model to field adoptionsWithoutFilter = new ObservableCollection <AdoptionToView>(adoptions); // load own class model to field - clean for search filter DataGridAdoptions.ItemsSource = adoptions; TextBoxSearch.Focus(); }
private ObservableCollection <AdopterWithAdress> adoptersWithAdressWithoutFilter; // ObserveableColletion for DataGrid - clean without filter public AdopterList() { InitializeComponent(); adoptersWithAdress = viewModelAdopter.GetJoinData(); adoptersWithAdressWithoutFilter = new ObservableCollection <AdopterWithAdress>(adoptersWithAdress); DataGridAdopters.ItemsSource = adoptersWithAdress; TextBoxSearch.Focus(); }
private ObservableCollection <Dog> dogsWithoutFilter; // ObserveableColletion for DataGrid - without filtering public DogList() { InitializeComponent(); dogs = viewModel.GetDogs(); // load to ObservableColletion list from DB dogsWithoutFilter = new ObservableCollection <Dog>(dogs); // copy ObservableColletion dgDogs.ItemsSource = dogs; TextBoxSearch.Focus(); }
private ObservableCollection <Volunteer> volunteersWithoutFilter; // Save ObserveableColletion for DataGrid public VolunteerList() { InitializeComponent(); volunteers = viewModel.GetVolunteers(); // load to OvservableColletion list from DB volunteersWithoutFilter = new ObservableCollection <Volunteer>(volunteers); // copy for reseting filtering dgVolunteers.ItemsSource = volunteers; TextBoxSearch.Focus(); }
private void ButtonSearch_Click(object sender, RoutedEventArgs e) { Ac.AnimateButton(new ColumnDefinition[] { GridColSave }, new Button[] { ButtonSave }, false); Ac.SelectButton(sender, ref PrvButton, this); Ac.AnimateButton(new ColumnDefinition[] { GridColReport }, new Button[] { ButtonReport }, true); Ac.AnimateRowGrid(GridRowNew, GridRowSearch, GridNew, GridSearch, ref PrevHeight); TextBoxSearch.Focus(); DataGridView.ItemsSource = Bills; DataGridView.Items.Refresh(); }
private void ComboBoxData_KeyDown(object sender, KeyEventArgs e) { if (e.Key >= Key.Space && e.Key <= Key.Z) { var ch = (char)KeyInterop.VirtualKeyFromKey(e.Key); var caret = TextBoxSearch.CaretIndex; //TextBoxSearch.Text.Insert(caret, ch.ToString()); //TextBoxSearch.Text += e.Key.ToString(); TextBoxSearch.AppendText(ch.ToString()); //var val = Encoding.Default.GetString(Encoding.Convert(Encoding.Unicode, Encoding.Default, unicode.GetBytes(TextBoxSearch.Text))); //byte[] bytes = Encoding.UTF8.GetBytes(UniCodeFeld1.Text); //Encoding enc = Encoding.GetEncoding("Windows-1252"); //string asd = enc.GetString(); } else if (e.Key == Key.Back && !TextBoxSearch.Text.Equals("")) { TextBoxSearch.Text = TextBoxSearch.Text.Substring(0, TextBoxSearch.Text.Length - 1); } //var ch = (char)KeyInterop.VirtualKeyFromKey(e.Key); //if (!char.IsLetter(ch)) { return; } //bool upper = false; //if (Keyboard.IsKeyToggled(Key.Capital) || Keyboard.IsKeyToggled(Key.CapsLock)) { // upper = !upper; //} //if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) { // upper = !upper; //} //if (!upper) { // ch = char.ToLower(ch); //} //var box = TextBoxSearch; //var text = box.Text; //var caret = box.CaretIndex; ////string urdu = AsciiToUrdu(e.Key); //byte[] bytes = Encoding.UTF8.GetBytes(ch); //Encoding enc = Encoding.GetEncoding("Windows-1258"); //string asd = enc.GetString(); ////string urdu = ASCIIEncoding. (ch); ////Update the TextBox' text.. //box.Text = text.Insert(caret, urdu); ////..move the caret accordingly.. //box.CaretIndex = caret + urdu.Length; ////..and make sure the keystroke isn't handled again by the TextBox itself: //e.Handled = true; }
private void TextBoxSearch_LostFocus(object sender, RoutedEventArgs e) { if (dataGridSearch.SelectedValue == null) { dataGridSearch.Visibility = Visibility.Collapsed; TextBoxSearch.Clear(); } //else //{ // DataRowView drv = (DataRowView)dataGridSearch.SelectedItem; // TextBoxSearch.Text = (drv`"Unit #"`).ToString(); // dataGridSearch.Visibility = Visibility.Collapsed; //} }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == Keys.Enter) { SetNodes(); return(true); } if (keyData == Keys.Escape) { TextBoxSearch.Clear(); TreeViewFind.Nodes.Clear(); return(true); } return(base.ProcessCmdKey(ref msg, keyData)); }
protected void ImageButtonAddItem_Click(object sender, ImageClickEventArgs e) { TableMainData.Rows[1].Cells[0].Attributes.Add("width", "60%"); TableMainData.Rows[1].Cells[1].Attributes.Add("width", "40%"); TableMainData.Rows[1].Cells[1].Visible = true; TableMainData.Rows[0].Cells[1].Visible = true; ImageButtonCancelAction.Visible = true; ImageButtonAddItem.Visible = false; ImageButtonRemoveItem.Visible = false; TextBoxSearch.Focus(); TextBoxExtensions.SelectText(TextBoxSearch); DisplaySearchResults(); GetDeviceDetails(); }
public PageSearchByNameOrNumber(List <ItemFilial> itemsFilial) { InitializeComponent(); this.itemsFilial = itemsFilial; TextBlockSelectedFilials.Text = TextBlockSelectedFilials.Text + string.Join(", ", itemsFilial.Select(x => x.ShortName).ToArray()); DataContext = this; ItemsIC.CollectionChanged += (s, e) => { AutoResizeGridViewColumns(ListViewSearchResults.View as GridView); }; TextBoxSearch.Focus(); ItemsIC.Add(new ItemIC() { SHORTNAME = "Введите текст и нажмите кнопку поиск" }); }
/// <summary> /// Loaded event: Sets up the custom filter for our current set of directions. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_Loaded(object sender, RoutedEventArgs e) { // Build the directions that are available from this room. this.DirectionList = new List <Direction>(); this.BuildDirections(); // Setup the view that will allow us to filter this list. _view = CollectionViewSource.GetDefaultView(this.DirectionList); _view.Filter = DirectionsFilter; ListBoxDirections.ItemsSource = _view; // Wire up what we're going to do for the search box. TextBoxSearch.SearchExecuted += this.TextBoxSearch_SearchExecuted; // Focus the text box so the user can start typing immediately. TextBoxSearch.Focus(); }
private void metroTileSearch_Click(object sender, EventArgs e) { int rows = 0; try { rows = employeeTA.SearchBySurname(this.employeeDS.EMPLOYEE, TextBoxSearch.Text.ToLower()); if (rows == 0) { MessageBox.Show("The surname: " + TextBoxSearch.Text + " does not exist in our database records."); TextBoxSearch.Clear(); } } catch (Exception ex) { MessageBox.Show("Error searching staff member:\n" + ex.Message.ToString()); } }
private void TextBoxSearch_SelectionChanged(object sender, RoutedEventArgs e) { List <Country> Temp = null; if (TextBoxSearch.Text != "Search for Country") { Temp = Countries.FindAll(c => c.Name.ToLower().Contains(TextBoxSearch.Text.ToLower())).ToList(); if (Temp.Count > 0) { TreeViewCountries.ItemsSource = GetContinents(Temp.ToList()); } else { MessageBox.Show("The country does not exist!"); TreeViewCountries.ItemsSource = GetContinents(Countries.ToList()); TextBoxSearch.Text = string.Empty; TextBoxSearch.Focus(); } } }
private void ButtonAddPlaylist_Click(object sender, EventArgs e) { openFileDialog.FileName = ""; openFileDialog.Title = "Відкрити плейліст"; openFileDialog.Filter = "XML File (.xml)|*.xml|TXT File (.txt)|*.txt"; if (openFileDialog.ShowDialog() == DialogResult.OK) { dataGridView1.Rows.Clear(); XmlReaderSettings ws = new XmlReaderSettings(); //ws.IgnoreWhitespace = false; XmlSerializer serializer = new XmlSerializer(typeof(List <Song>)); string path = ""; try { using (XmlReader xmlWriter = XmlReader.Create(openFileDialog.FileName, ws)) { path = openFileDialog.FileName; if (Path.GetExtension(openFileDialog.FileName) == ".xml") { Songs = serializer.Deserialize(xmlWriter) as List <Song>; foreach (Song song in Songs) { dataGridView1.Rows.Add(song.Artist, song.Album, song.Name, song.Year, song.Genre); } ButtonSavePlaylist.Enabled = true; ButtonLyrics.Enabled = true; TextBoxSearch.Clear(); } else { MessageBox.Show("Wrong format, .xml required", "Wrong format error", MessageBoxButtons.OK); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error reading file", MessageBoxButtons.OK); } } }//Deserialization
private void ButtonClearSearchFilters_Click(object sender, EventArgs e) { dataGridView1.Rows.Clear(); TextBoxSearch.Clear(); ButtonSearch.Enabled = true; ButtonSavePlaylist.Enabled = true; foundSongs.Clear(); try { for (int i = 0; i < Songs.Count; i++) { dataGridView1.Rows.Insert(i, Songs[i].Artist, Songs[i].Album, Songs[i].Name, Songs[i].Year, Songs[i].Genre); } dataGridView1.ClearSelection(); ButtonDelete.Enabled = false; ButtonFormat.Enabled = false; ButtonLyrics.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public MainWindow() { Instance = this; CommandHistory = new List <string>(); DataContext = this; InitializeComponent(); // Load settings... // Create an keyboard hook... KeyboardHook = new KeyboardHook(); KeyboardHook.KeyPressed += (object sender, KeyPressedEventArgs e) => { Show(); Activate(); TextBoxSearch.Focus(); }; KeyboardHook.RegisterHotKey(ModifierKeys.Control | ModifierKeys.Windows, System.Windows.Forms.Keys.Space); // Default hotkey. // Hide window and help section... Visibility = Visibility.Hidden; BorderHelp.Visibility = Visibility.Collapsed; App.AutoStartOnLogon = true; }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { TextBoxSearch.Focus(); }
private void MainWindow_PreviewKeyDown(object sender, KeyEventArgs e) { TextBoxSearch.Focus(); }
///<summary> Обработчик нажатия на надпись поиска </summary> private void TextBlockSearch_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { TextBlockSearch.Visibility = Visibility.Collapsed; TextBoxSearch.Focus(); }
protected void Page_Load(object sender, EventArgs e) { TextBoxSearch.Attributes.Add("onkeydown", "javascript:preventEnter(event);"); TextBoxSearch.Focus(); }
private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e) { // Need to be in loaded event, focusmanger won't work... TextBoxSearch.Focus(); }
/// <summary> /// Метод проверка всех комбинаций быстрых кнопок при нажатии /// </summary> /// <param name="e"></param> /// <returns></returns> private bool CheckAllWindowHotKey(ref System.Windows.Input.KeyEventArgs e) { Key PressedKey; bool Shift; bool Control; Hotkey hk; if (/*Bindings.GrantedAccess.HasFlag(AccessRoles.Full)*/ true) { Shift = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift; Control = (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control; bool flag = (Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt; PressedKey = e.Key; hk = Hotkeys.FirstOrDefault <Hotkey>(p => ((p.HotKey == PressedKey) && !(Shift ^ p.Shift)) && (Control == p.Control)); if ((hk != null) && !string.IsNullOrEmpty(hk.Command)) { RibbonButton button = FindLogicalChildren <RibbonButton>(RibbonWin).FirstOrDefault <RibbonButton>(p => (p.Label != null) && (p.Label.ToString().ToLower() == hk.Command.ToLower())); if (button != null) { if ((button.Command != null) && button.Command.CanExecute(button.CommandParameter)) { button.Command.Execute(button.CommandParameter); } if (button.IsEnabled && (button.Visibility == Visibility.Visible)) { button.RaiseEvent(new RoutedEventArgs(System.Windows.Controls.Primitives.ButtonBase.ClickEvent)); } } else { RibbonMenuItem item = FindLogicalChildren <RibbonMenuItem>(RibbonWin).FirstOrDefault <RibbonMenuItem>(p => (p != null) && (p.Header.ToString().ToLower() == hk.Command.ToLower())); if ((item.Command != null) && item.Command.CanExecute(item.CommandParameter)) { item.Command.Execute(item.CommandParameter); } if (((item != null) && item.IsEnabled) && (item.Visibility == Visibility.Visible)) { item.RaiseEvent(new RoutedEventArgs(System.Windows.Controls.MenuItem.ClickEvent)); } } e.Handled = true; return(true); } switch (e.Key) { case Key.F1: listBox.SelectedItem = lbiHelp; e.Handled = true; return(true); case Key.F: if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { listBox.SelectedItem = listBoxItemSearchCVZ; Dispatcher.Invoke(() => { TextBoxSearch.Focus(); }); e.Handled = true; } return(true); //case Key.F2: // if (this.DiagnosticsAndSettingsTab.IsEnabled) // { // this.RibbonWin.SelectedIndex = 1; // } // e.Handled = true; // return true; //case Key.F3: // if (this.NetworkTab.IsEnabled) // { // this.RibbonWin.SelectedIndex = 2; // } // e.Handled = true; // return true; case Key.F4: DSList.Properties.Settings.Default.ProvInfoExpanded = !Properties.Settings.Default.ProvInfoExpanded; e.Handled = true; return(true); case Key.F5: Dispatcher.Invoke(async() => { await PingSelectedTT(false); }); e.Handled = true; return(true); case Key.Escape: this.ClearSearch(); e.Handled = true; return(true); } } return(false); }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. The Parameter /// property is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { TextBoxSearch.Focus(FocusState.Keyboard); }
public NewMainWindow() { try { Log("<-- Запуск DSList -->"); InitializeComponent(); Bindings = new BindingVariables(); DataContext = Bindings; // Выполняется привязка контекста MainWindows к BindingVariables для корректной работы привязки элементов, прописанных в Xaml #region Поиск сотрудников в TS и формирование списка AD Bindings.VisibilitySetting = Visibility.Collapsed; progressBarWorker = new BackgroundWorker(); listPcIPAndPcName = new ObservableCollection <IPAndName>(); listADUsers = new ObservableCollection <ADUser>(); searchListADUser = new ObservableCollection <ADUser>(); listTSUser = new ObservableCollection <TSUser>(); searchListTSUser = new ObservableCollection <TSUser>(); dataGridTS.ItemsSource = listTSUser; dataGridAD.ItemsSource = listADUsers; dataGridIPPC.ItemsSource = listPcIPAndPcName; dataGridIPPC.HorizontalContentAlignment = HorizontalAlignment.Stretch; searchListBoxAD.ItemsSource = searchListADUser; searchListBoxTS.ItemsSource = searchListTSUser; #endregion this.version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); Bindings.title = "DSList " + this.version; IsWindows10 = FileVersionInfo.GetVersionInfo(System.IO.Path.Combine(Environment.SystemDirectory, "Kernel32.dll")).ProductMajorPart >= 10; Bindings.IsTSConnecting = Environment.UserDomainName.ToLower().Contains("dengisrazy") ? true : false; NewMainWindow.settings.OnSaveOrLoad += settings_OnSaveOrLoad; Title = Bindings.title; //siteTable = new TableFromSite(); //TabCtrl.SelectionChanged += TabCtrl_SelectionChanged; Tabs.SelectionChanged += Tabs_SelectionChanged; //searchListBox.DisplayMemberPath = "ToStringDisplay"; // Представление отображения в списке найденных Customer cvzNotifyIcon.Icon = Properties.Resources.vsnetwebservicedynamicdiscovery_8215; cvzNotifyIcon.Text = "DSList"; cvzNotifyIcon.Visible = true; cvzNotifyIcon.Click += new EventHandler(this.ni_Click); if (DSList.Properties.Settings.Default.Maximized) { base.WindowState = WindowState.Maximized; } this.SearchTimer.Tick += new EventHandler(this.SearchTimer_Tick); this.SearchADTimer.Tick += new EventHandler(this.SearchADTimer_Tick); //this.UpdateTimer.Tick += new EventHandler(this.UpdateTimer_Tick); this.UpdateTimer.Interval = new TimeSpan(0, 0, 15, 0, 0); this.UpdateTimer.Start(); LoadHotkeys(); LoadUserCredentials(); SelectedLoginCreate(); CreateNewCredentials(); // Формируется список логинов и паролей, прописанных в методе CreateCredentials() LoadCredentialsFromSQLServer(); NewMainWindow.MRU = new ObservableCollection <MRUTT>(); LoadMRU(); ListViewMRU.ItemsSource = MRU; //ListViewMRU.MouseDoubleClick += (object sender, MouseButtonEventArgs args) => { }; ListViewMRU.MouseDoubleClick += MRUItem_Click; //TabCtrl.ItemsSource = OpenedTT; //Tabs.ItemsSource = OpenedTT; TabContextMenuCreate(); LoadPopup(); RefreshCredentials(); //TabCtrl.ContextMenu = tabContextMenu; #region PinnedWatchTimer this.PinnedWatchTimer.Tick += new EventHandler(this.PinnedWatchTimer_Tick); this.PinnedWatchTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); this.PinnedWatchTimer.Start(); #endregion //ListViewIP.DataContext = SelectedTT; TextBoxSearch.Focus(); } catch (Exception ex) { Log("Ошибка загрузки основного окна MainWindow. " + ex.Message, true, false, ex.StackTrace); } }