/// <summary>
        /// Called when [remove state command].
        /// </summary>
        /// <param name="state">The state.</param>
        private void OnRemoveStateCommand(SelectListItem state)
        {
            try
            {
                SelectedStates.Remove(state);
                AvailableStates = AvailableStates.SourceCollection.OfType <SelectListItem>()
                                  .Concat(new[] { state })
                                  .OrderBy(item => item.Value != null)
                                  .ThenBy(item => item.Text).ToListCollectionView();

                ApplyContextCommand.RaiseCanExecuteChanged();
            }
            catch (Exception ex)
            {
                Events.GetEvent <ErrorNotificationEvent>().Publish(ex);
            }
        }
Пример #2
0
 private void OnRemoveStateCommand(State state)
 {
     try
     {
         SelectedStates.Remove(state);
         //                StateCollection.MoveCurrentToFirst();
         StateCollection = StateCollection.SourceCollection.OfType <KeyValuePair <string, State> >()
                           .Concat(new[] { new KeyValuePair <string, State>(state.Name, state) })
                           .OrderBy(item => item.Value != null)
                           .ThenBy(item => item.Key).ToListCollectionView();
         RaisePropertyChanged(() => SelectedStates);
     }
     catch (Exception ex)
     {
         EventAggregator.GetEvent <ErrorNotificationEvent>().Publish(ex);
     }
 }