Exemple #1
0
        private void RegisterRemoveGroupingFromShooterDialog(ICollectionShooterDataStore collectionShooterDataStore)
        {
            _messenger.Register <RemoveGroupingFromShooterDialogMessage>(this,
                                                                         x =>
            {
                YesNoMessageBoxViewModel vm = new YesNoMessageBoxViewModel
                {
                    DefaultYes = false,
                    Caption    = "Gruppierungszugehörigkeit löschen?",
                    Message    =
                        string.Format("Möchtest du die Gruppierungszugehörigkeit '{0}' wirklich löschen?",
                                      x.Grouping.GroupingName)
                };

                IWindow w   = _vs.ExecuteFunction <YesNoMessageBoxViewModel, IWindow>((IWindow)Current.MainWindow, vm);
                bool?result = w.ShowDialog();

                if (!result.HasValue || !result.Value)
                {
                    return;
                }

                CollectionShooter cs = collectionShooterDataStore.FindById(x.Grouping.ShooterCollectionId);
                collectionShooterDataStore.Delete(cs);

                _messenger.Send(new RefreshDataFromRepositoriesMessage());
            });
        }
        private void RemoveShooterFromGrouping()
        {
            if (SelectedShooterCollection != null && SelectedShooter != null)
            {
                int shooterCollectionId = SelectedShooterCollection.ShooterCollectionId;
                ICollectionShooterDataStore collectionShooterDataStore = ServiceLocator.Current.GetInstance <ICollectionShooterDataStore>();

                CollectionShooter collectionShooter =
                    collectionShooterDataStore.FindByShooterId(SelectedShooter.ShooterId)
                    .SingleOrDefault(cs => cs.ShooterCollectionId == SelectedShooterCollection.ShooterCollectionId);

                collectionShooterDataStore.Delete(collectionShooter);
                MessengerInstance.Send(new RefreshDataFromRepositoriesMessage());
                MessengerInstance.Send(new SetSelectedCollectionProgramNumber(ProgramNumber));
                MessengerInstance.Send(new SetSelectedShooterCollectionMessage(shooterCollectionId));
            }
        }
        private void RegisterRemoveGroupingFromShooterDialog(ICollectionShooterDataStore collectionShooterDataStore)
        {
            _messenger.Register<RemoveGroupingFromShooterDialogMessage>(this,
                x =>
                {
                    YesNoMessageBoxViewModel vm = new YesNoMessageBoxViewModel
                    {
                        DefaultYes = false,
                        Caption = "Gruppierungszugehörigkeit löschen?",
                        Message =
                            string.Format("Möchtest du die Gruppierungszugehörigkeit '{0}' wirklich löschen?",
                                x.Grouping.GroupingName)
                    };

                    IWindow w = _vs.ExecuteFunction<YesNoMessageBoxViewModel, IWindow>((IWindow) Current.MainWindow, vm);
                    bool? result = w.ShowDialog();

                    if (!result.HasValue || !result.Value) return;

                    CollectionShooter cs = collectionShooterDataStore.FindById(x.Grouping.ShooterCollectionId);
                    collectionShooterDataStore.Delete(cs);

                    _messenger.Send(new RefreshDataFromRepositoriesMessage());
                });
        }