Example #1
0
        /// <summary>
        /// Sets age value depending on DatePicker value
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DatePicker_OnSelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            DateTime?dateTimeTemp = (DateTime?)e.AddedItems[0];

            DatePicker  datePicker = (DatePicker)sender;
            DataGridRow row        = (DataGridRow)PeopleDataGrid.ContainerFromElement(datePicker);
            Person      gridModel  = (Person)PeopleDataGrid.Items[row.GetIndex()];

            gridModel.Age = (DateTime.Now.Year - dateTimeTemp.Value.Year).ToString();
        }
Example #2
0
        /// <summary>
        /// Whenever the View is unloaded, we want to cancel any edit operation
        /// that is in progress.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UserControl_Unloaded(object sender, RoutedEventArgs e)
        {
            logger.Debug("UserControl unloading.");

            if (IsInPeopleEditMode)
            {
                logger.Debug("IsInPeopleEditMode is true during unload. Canceling edit.");

                ((IEditableCollectionView)_peopleView).CancelEdit();
                PeopleDataGrid.CancelEdit();
                IsInPeopleEditMode = false;
            }

            if (IsInFamilyEditMode)
            {
                logger.Debug("IsInFamilyEditMode is true during unload. Canceling edit.");
                ((IEditableCollectionView)_familyView).CancelEdit();
                FamilyDataGrid.CancelEdit();
                IsInFamilyEditMode = false;
            }
        }
Example #3
0
        /// <summary>
        /// Whenever a person is finished being added, we will scroll to that
        /// person in the grid after updating the RowTimestamp
        /// </summary>
        /// <param name="person"></param>
        public void PersonInsertCompleted(CACCCheckInDb.Person person)
        {
            // Look for the person that was just inserted in in the people list.
            CACCCheckInDb.Person existingPerson =
                PeopleDataContext.FirstOrDefault(p => p.Id.Equals(person.Id));

            existingPerson.RowTimestamp = person.RowTimestamp;

            _peopleView.MoveCurrentTo(existingPerson);

            try
            {
                if (null != _peopleView.CurrentItem)
                {
                    PeopleDataGrid.ScrollIntoView(_peopleView.CurrentItem);
                }
            }
            catch (NullReferenceException ex)
            {
                logger.Error("ScrollIntoView Exception: ", ex);
            }
        }
Example #4
0
        /// <summary>
        /// The constructor for the ClassesView. Wires up all the necessary
        /// objects and events needed by this View.
        /// </summary>
        /// <param name="presenter"></param>
        /// <param name="eventAggregator"></param>
        /// <param name="configurationService"></param>
        public PersonsView(PersonsPresenter presenter, IEventAggregator eventAggregator,
                           IConfigurationService configurationService) : this()
        {
            _presenter            = presenter;
            _presenter.View       = this;
            _eventAggregator      = eventAggregator;
            _configurationService = configurationService;

            logger.Debug("Subscribing to ShellRefreshRequestedEvent.");

            ShellRefreshRequestedEvent shellRefreshRequestedEvent = _eventAggregator.GetEvent <ShellRefreshRequestedEvent>();

            shellRefreshRequestedEvent.Subscribe(OnShellRefreshRequested, ThreadOption.UIThread);

            // Hook into the CanExecuteEvent of the DataGrid so that we can look for
            // when user tries to Delete
            PeopleDataGrid.AddHandler(CommandManager.CanExecuteEvent,
                                      new CanExecuteRoutedEventHandler(OnCanExecuteRoutedEventHandler), true);

            // Hook into the CanExecuteEvent of the DataGrid so that we can look for
            // when user tries to Delete
            FamilyDataGrid.AddHandler(CommandManager.CanExecuteEvent,
                                      new CanExecuteRoutedEventHandler(OnCanExecuteRoutedEventHandler), true);
        }