예제 #1
0
        private void RegisterAddGroupingToShooterDialog(ICollectionShooterDataStore collectionShooterDataStore)
        {
            _messenger.Register <AddGroupingToShooterDialogMessage>(this,
                                                                    x =>
            {
                SelectGroupingViewModel vm = new SelectGroupingViewModel
                {
                    Title = "Gruppe auswählen"
                };

                vm.Initialize(x.ShooterId);

                IWindow w   = _vs.ExecuteFunction <SelectGroupingViewModel, IWindow>((IWindow)Current.MainWindow, vm);
                bool?result = w.ShowDialog();
                if (!result.HasValue || !result.Value)
                {
                    return;
                }

                CollectionShooter cs = new CollectionShooter
                {
                    ShooterId           = x.ShooterId,
                    ShooterCollectionId = vm.SelectedGrouping.ShooterCollectionId
                };
                collectionShooterDataStore.Create(cs);

                _messenger.Send(new RefreshDataFromRepositoriesMessage());
            });
        }
        private void ExecuteAssignShooterCommand(UiShooterCollection obj)
        {
            CollectionShooter collectionShooter = new CollectionShooter
            {
                ShooterId           = UiShooter.ShooterId,
                ShooterCollectionId = UiShooterCollection.ShooterCollectionId
            };

            _collectionShooterDataStore.Create(collectionShooter);
            _windowService.CloseEditShooterWindow();
        }
예제 #3
0
        private void RegisterAddGroupingToShooterDialog(ICollectionShooterDataStore collectionShooterDataStore)
        {
            _messenger.Register<AddGroupingToShooterDialogMessage>(this,
                x =>
                {
                    SelectGroupingViewModel vm = new SelectGroupingViewModel
                    {
                        Title = "Gruppe auswählen"
                    };

                    vm.Initialize(x.ShooterId);

                    IWindow w = _vs.ExecuteFunction<SelectGroupingViewModel, IWindow>((IWindow) Current.MainWindow, vm);
                    bool? result = w.ShowDialog();
                    if (!result.HasValue || !result.Value) return;

                    CollectionShooter cs = new CollectionShooter
                    {
                        ShooterId = x.ShooterId,
                        ShooterCollectionId = vm.SelectedGrouping.ShooterCollectionId
                    };
                    collectionShooterDataStore.Create(cs);

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