Beispiel #1
0
        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();
        }
Beispiel #2
0
        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();
        }
        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 <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 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();
        }
Beispiel #6
0
 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();
 }
Beispiel #7
0
        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();
        }
        /// <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();
        }
        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 = "Введите текст и нажмите кнопку поиск"
            });
        }
        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();
                }
            }
        }
Beispiel #11
0
        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();
 }
Beispiel #14
0
        ///<summary> Обработчик нажатия на надпись поиска </summary>
        private void TextBlockSearch_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            TextBlockSearch.Visibility = Visibility.Collapsed;

            TextBoxSearch.Focus();
        }
Beispiel #15
0
        /// <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);
        }
Beispiel #16
0
 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>
 /// 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);
 }
Beispiel #19
0
        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);
            }
        }