Beispiel #1
0
        /// <summary>
        /// Обработчик события нажатия кнопки переноса сотрудника в коллекцию выбраных
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnAddToSelectedButtonClick(object sender, RoutedEventArgs e)
        {
            Employee[] selectedItems     = new Employee[AllEmployeesListBox.SelectedItems.Count];
            Employee   firstSelectedItem = (Employee)AllEmployeesListBox.SelectedItem;
            int        nextSelection     = AllEmployeesListBox.Items.IndexOf(firstSelectedItem);

            AllEmployeesListBox.SelectedItems.CopyTo(selectedItems, 0);
            foreach (Employee item in selectedItems)
            {
                RecipientsEditorControlModel.SelectedEmployees.Add(item);
                RecipientsEditorControlModel.AllEmployees.Remove(item);
            }
            AllEmployeesListBox.SelectedIndex = nextSelection;
            if (nextSelection < AllEmployeesListBox.Items.Count)
            {
                AllEmployeesListBox.Focus();
            }
            else
            {
                AddToSelectedButton.IsEnabled = false;
            }
        }
Beispiel #2
0
 /// <summary>
 /// Отмечает всех сотрудников в списке AllEmployeesListBox по комбинации ctrl + a
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void OnAllEmployeesSelectAllExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     AllEmployeesListBox.SelectAll();
 }