Ejemplo n.º 1
0
        public ShooterEditViewModel()
        {
            AddToAssingedParticipationCommand = new RelayCommand <ParticipationListItem>(ExecuteAddToAssignedParticipationCommand,
                                                                                         CanExecuteAddtoAssignedParticipationCommand);
            RemoveFromAssingedParticipationCommand =
                new RelayCommand <ShooterParticipationListItem>(ExecuteRemoveFromAssignedParticipationCommand,
                                                                CanExecuteRemoveFromAssignedParticipationCommand);
            CancelCommand = new RelayCommand <object>(ExecuteCloseCommand);
            AssignShooterCollectionCommand = new RelayCommand <UiShooterCollection>(ExecuteAssignShooterCommand,
                                                                                    CanExecuteAssignShooterCommand);

            if (!DesignTimeHelper.IsInDesignMode)
            {
                IConfiguration config = ConfigurationSource.Configuration;
                _participationDataStore        = config.GetParticipationDataStore();
                _windowService                 = config.GetWindowService();
                _shooterParticipationDataStore = config.GetShooterParticipationDataStore();
                _collectionShooterDataStore    = config.GetCollectionShooterDataStore();
                _personDataStore               = config.GetPersonDataStore();
                _uiEvents = config.GetUIEvents();
                _uiEvents.ShooterSelected += shooter => { UiShooter = shooter; };
                _uiEvents.RequireSelectedShooter();
                _shooterNumberService       = config.GetShooterNumberService();
                _shooterDataStore           = config.GetShooterDataStore();
                _shooterParticipationView   = config.GetShooterParticipationView();
                _shooterCollectionDataStore = config.GetShooterCollectionDataStore();
                _shooterCollectionParticipationDataStore = config.GetShooterCollectionParticipationDataStore();
                LoadData();

                UiShooterCollections = new ObservableCollection <UiShooterCollection>(_shooterCollectionDataStore.GetAll().Select(UiBusinessObjectMapper.ToUiShooterCollection).OrderBy(_ => _.CollectionName));
            }
        }
        public static UiParticipation FetchShooters(this UiParticipation participation,
                                                    IShooterCollectionParticipationDataStore shooterCollectionParticipationDataStore,
                                                    IShooterCollectionDataStore shooterCollectionDataStore,
                                                    ICollectionShooterDataStore collectionShooterDataStore,
                                                    IShooterDataStore shooterDataStore,
                                                    IPersonDataStore personDataStore)
        {
            participation.ShooterCollections = new List <UiShooterCollection>();
            List <ShooterCollectionParticipation> shooterCollectionParticipations =
                shooterCollectionParticipationDataStore.FindByIdParticipationId(participation.ParticipationId).ToList();
            List <ShooterCollection> shooterCollections = shooterCollectionParticipations.Select(_ => shooterCollectionDataStore.FindById(_.ShooterCollectionId)).ToList();

            foreach (ShooterCollection shooterCollection in shooterCollections)
            {
                List <CollectionShooter> collectionShooters =
                    collectionShooterDataStore.FindByShooterCollectionId(shooterCollection.ShooterCollectionId).ToList();

                participation.ShooterCollections.Add(new UiShooterCollection
                {
                    CollectionName      = shooterCollection.CollectionName,
                    ShooterCollectionId = shooterCollection.ShooterCollectionId,
                    Shooters            = collectionShooters.Select(_ => ToUiShooter(shooterDataStore.FindById(_.ShooterId)).FetchPerson(personDataStore))
                });
            }

            return(participation);
        }
        public ParticipationCreateViewModel()
        {
            if (!DesignTimeHelper.IsInDesignMode)
            {
                IConfiguration config = ConfigurationSource.Configuration;
                _participationDataStore     = config.GetParticipationDataStore();
                _shooterCollectionDataStore = config.GetShooterCollectionDataStore();
                _shooterCollectionParticipationDataStore = config.GetShooterCollectionParticipationDataStore();
                _collectionShooterDataStore    = config.GetCollectionShooterDataStore();
                _shooterParticipationDataStore = config.GetShooterParticipationDataStore();
                _shooterDataStore = config.GetShooterDataStore();
                _personDataStore  = config.GetPersonDataStore();
                _windowService    = config.GetWindowService();
                _events           = config.GetUIEvents();
                _events.FetchSelectedParticipation += () => _selectedUiParticipation;

                LoadParticipations();
                LoadAvailableShooters();
            }

            OkCommand     = new RelayCommand <ParticipationDraft>(ExecuteCreateParticipationCommand, CanExecuteCreateParticipationCommand);
            CancelCommand = new RelayCommand <object>(ExecuteCancelCommand);

            AssignCommand = new RelayCommand <UiShooter>(ExecuteAssignCommand, CanExecuteAssignCommand);
            RemoveCommand = new RelayCommand <UiShooter>(ExecuteRemoveCommand, CanExecuteRemoveCommand);
            DeleteCommand = new RelayCommand <UiShooterCollection>(ExecuteDeleteShooterCollectionCommand,
                                                                   CanExecuteDeleteShooterCollectionCommand);
            CreateCommand = new RelayCommand <UiParticipation>(ExecuteCreateShooterCollectionParticipation,
                                                               CanExecuteShooterCollectionParticipation);
        }
 public DefaultConfiguration()
 {
   //_shootingRange = new SiusDataFileProvider(@"C:\Users\eberlid\Dropbox\SSC\2014\Herbstschiessen\ShootingRange\20140516_164043.log");
   //_shootingRange = new SiusDataFileProvider(@"C:\Users\eberlid\Documents\My Dropbox\SSC\2014\Herbstschiessen\ShootingRange\20140516_164043.log");
   //_shootingRange = new SiusDataFileProvider(@"C:\Users\eberlid\Dropbox\SSC\2014\Herbstschiessen\ShootingRange\20130914_132912.log");
   //_shootingRange = new SiusApiProvider("http://192.168.1.4");
   _shootingRange = new SiusDataSocketProvider("127.0.0.1", 4000);
   _events = new ShootingRangeEvents();
   _uiEvents = new UIEvents();
   ShootingRangeEntities entities = new ShootingRangeEntities();
   _personRepository = new PersonDataStore(entities);
   _shooterRepository = new ShooterDataStore(entities);
   _participationDataStore = new ParticipationDataStore(entities);
   _sessionDataStore = new SessionDataStore(entities);
   _shotDataStore = new ShotDataStore(entities);
   _sessionDetailsView = new SessionDetailsView(entities);
   _shooterNumberConfigDataStore = new ShooterNumberConfigDataStore(entities);
   _shooterParticipationDataStore = new ShooterParticipationDataStore(entities);
   _sessionSubtotalDataStore = new SessionSubtotalDataStore(entities);
   _programItemDataStore = new ProgramItemDataStore(entities);
   _groupMemberDetailsView = new GroupMemberDetailsView(entities);
   _groupDetailsView = new GroupDetailsView(entities);
   _shooterParticipationView = new ShooterParticipationView(entities);
   _windowService = new WindowService();
   _barcodePrintService = new PtouchBarcodePrinter();
   _barcodeBuilderService = new Barcode2Of5InterleavedService();
   _shooterNumberService = new ShooterNumberService(_shooterNumberConfigDataStore);
   _shooterCollectionParticipationDataStore = new ShooterCollectionParticipationDataStore(entities);
   _shooterCollectionDataStore = new ShooterCollectionDataStore(entities);
   _collectionShooterDataStore = new CollectionShooterDataStore(entities);
   _ssvShooterDataWriterService = new SsvFileWriter(@"C:\Sius\SiusData\SSVDaten\SSV_schuetzen.txt");
 }
Ejemplo n.º 5
0
        public DefaultConfiguration()
        {
            //_shootingRange = new SiusDataFileProvider(@"C:\Users\eberlid\Dropbox\SSC\2014\Herbstschiessen\ShootingRange\20140516_164043.log");
            //_shootingRange = new SiusDataFileProvider(@"C:\Users\eberlid\Documents\My Dropbox\SSC\2014\Herbstschiessen\ShootingRange\20140516_164043.log");
            //_shootingRange = new SiusDataFileProvider(@"C:\Users\eberlid\Dropbox\SSC\2014\Herbstschiessen\ShootingRange\20130914_132912.log");
            //_shootingRange = new SiusApiProvider("http://192.168.1.4");
            _shootingRange = new SiusDataSocketProvider("127.0.0.1", 4000);
            _events        = new ShootingRangeEvents();
            _uiEvents      = new UIEvents();
            ShootingRangeEntities entities = new ShootingRangeEntities();

            _personRepository                        = new PersonDataStore(entities);
            _shooterRepository                       = new ShooterDataStore(entities);
            _participationDataStore                  = new ParticipationDataStore(entities);
            _sessionDataStore                        = new SessionDataStore(entities);
            _shotDataStore                           = new ShotDataStore(entities);
            _sessionDetailsView                      = new SessionDetailsView(entities);
            _shooterNumberConfigDataStore            = new ShooterNumberConfigDataStore(entities);
            _shooterParticipationDataStore           = new ShooterParticipationDataStore(entities);
            _sessionSubtotalDataStore                = new SessionSubtotalDataStore(entities);
            _programItemDataStore                    = new ProgramItemDataStore(entities);
            _groupMemberDetailsView                  = new GroupMemberDetailsView(entities);
            _groupDetailsView                        = new GroupDetailsView(entities);
            _shooterParticipationView                = new ShooterParticipationView(entities);
            _windowService                           = new WindowService();
            _barcodePrintService                     = new PtouchBarcodePrinter();
            _barcodeBuilderService                   = new Barcode2Of5InterleavedService();
            _shooterNumberService                    = new ShooterNumberService(_shooterNumberConfigDataStore);
            _shooterCollectionParticipationDataStore = new ShooterCollectionParticipationDataStore(entities);
            _shooterCollectionDataStore              = new ShooterCollectionDataStore(entities);
            _collectionShooterDataStore              = new CollectionShooterDataStore(entities);
            _ssvShooterDataWriterService             = new SsvFileWriter(@"C:\Sius\SiusData\SSVDaten\SSV_schuetzen.txt");
        }
    public ShooterEditViewModel()
    {
            AddToAssingedParticipationCommand = new RelayCommand<ParticipationListItem>(ExecuteAddToAssignedParticipationCommand,
        CanExecuteAddtoAssignedParticipationCommand);
      RemoveFromAssingedParticipationCommand =
        new RelayCommand<ShooterParticipationListItem>(ExecuteRemoveFromAssignedParticipationCommand,
          CanExecuteRemoveFromAssignedParticipationCommand);
      CancelCommand = new RelayCommand<object>(ExecuteCloseCommand);
      AssignShooterCollectionCommand = new RelayCommand<UiShooterCollection>(ExecuteAssignShooterCommand,
        CanExecuteAssignShooterCommand);

      if (!DesignTimeHelper.IsInDesignMode)
      {
        IConfiguration config = ConfigurationSource.Configuration;
        _participationDataStore = config.GetParticipationDataStore();
        _windowService = config.GetWindowService();
        _shooterParticipationDataStore = config.GetShooterParticipationDataStore();
        _collectionShooterDataStore = config.GetCollectionShooterDataStore();
        _personDataStore = config.GetPersonDataStore();
        _uiEvents = config.GetUIEvents();
        _uiEvents.ShooterSelected += shooter => { UiShooter = shooter; };
        _uiEvents.RequireSelectedShooter();
        _shooterNumberService = config.GetShooterNumberService();
        _shooterDataStore = config.GetShooterDataStore();
        _shooterParticipationView = config.GetShooterParticipationView();
        _shooterCollectionDataStore = config.GetShooterCollectionDataStore();
        _shooterCollectionParticipationDataStore = config.GetShooterCollectionParticipationDataStore();
        LoadData();

        UiShooterCollections = new ObservableCollection<UiShooterCollection>(_shooterCollectionDataStore.GetAll().Select(UiBusinessObjectMapper.ToUiShooterCollection).OrderBy(_ => _.CollectionName));
      }
    }
    public ParticipationCreateViewModel()
    {
      if (!DesignTimeHelper.IsInDesignMode)
      {
        IConfiguration config = ConfigurationSource.Configuration;
        _participationDataStore = config.GetParticipationDataStore();
        _shooterCollectionDataStore = config.GetShooterCollectionDataStore();
        _shooterCollectionParticipationDataStore = config.GetShooterCollectionParticipationDataStore();
        _collectionShooterDataStore = config.GetCollectionShooterDataStore();
        _shooterParticipationDataStore = config.GetShooterParticipationDataStore();
        _shooterDataStore = config.GetShooterDataStore();
        _personDataStore = config.GetPersonDataStore();
        _windowService = config.GetWindowService();
        _events = config.GetUIEvents();
        _events.FetchSelectedParticipation += () => _selectedUiParticipation;

        LoadParticipations();
        LoadAvailableShooters();
      }

      OkCommand = new RelayCommand<ParticipationDraft>(ExecuteCreateParticipationCommand, CanExecuteCreateParticipationCommand);
      CancelCommand = new RelayCommand<object>(ExecuteCancelCommand);

      AssignCommand = new RelayCommand<UiShooter>(ExecuteAssignCommand, CanExecuteAssignCommand);
      RemoveCommand = new RelayCommand<UiShooter>(ExecuteRemoveCommand, CanExecuteRemoveCommand);
      DeleteCommand = new RelayCommand<UiShooterCollection>(ExecuteDeleteShooterCollectionCommand,
        CanExecuteDeleteShooterCollectionCommand);
      CreateCommand = new RelayCommand<UiParticipation>(ExecuteCreateShooterCollectionParticipation,
        CanExecuteShooterCollectionParticipation);
    }
Ejemplo n.º 8
0
        public MainViewModel()
        {
            if (DesignTimeHelper.IsInDesignMode)
            {
                _personDataStore        = new FakePersonDataStore();
                _shooterDataStore       = new FakeShooterDataStore();
                _participationDataStore = new FakeParticipationDataStore();
                _groupMemberDetailsView = new FakeGroupMemberDetailsView();
                _groupDetailsView       = new FakeGroupDetailsView();
            }
            else
            {
                IConfiguration config = ConfigurationSource.Configuration;
                _personDataStore                         = config.GetPersonDataStore();
                _shooterDataStore                        = config.GetShooterDataStore();
                _participationDataStore                  = config.GetParticipationDataStore();
                _shooterParticipationDataStore           = config.GetShooterParticipationDataStore();
                _groupMemberDetailsView                  = config.GetGroupMemberDetailsView();
                _shooterParticipationView                = config.GetShooterParticipationView();
                _groupDetailsView                        = config.GetGroupDetailsView();
                _sessionDetailsView                      = config.GetSessionDetailsView();
                _shooterDataWriterService                = config.GetSsvShooterDataWriterService();
                _collectionShooterDataStore              = config.GetCollectionShooterDataStore();
                _shooterCollectionDataStore              = config.GetShooterCollectionDataStore();
                _shooterCollectionParticipationDataStore = config.GetShooterCollectionParticipationDataStore();
                _shooterNumberService                    = config.GetShooterNumberService();
                _windowService         = config.GetWindowService();
                _barcodePrintService   = config.GetBarcodePrintService();
                _barcodeBuilderService = config.GetBarcodeBuilderService();
                _events   = config.GetEvents();
                _uiEvents = config.GetUIEvents();
                _uiEvents.RequireSelectedPerson   += () => _uiEvents.PersonSelected(SelectedUiPerson);
                _uiEvents.SelectPersonById        += (id) => { SelectedUiPerson = UiPeople.FirstOrDefault(_ => _.PersonId == id); };
                _uiEvents.RequireSelectedShooter  += () => _uiEvents.ShooterSelected(SelectedUiShooter);
                _uiEvents.FetchSelectedShooter    += () => SelectedUiShooter;
                _uiEvents.PersonDataStoreChanged  += LoadPersonList;
                _uiEvents.ShooterDataStoreChanged += LoadShooterList;
                _shooterNumberService.Configure(_shooterDataStore);

                LoadPersonList();
                LoadShooterList();
                LoadParticipationList();
            }

            CreatePersonCommand = new RelayCommand <object>(ExecuteCreatePersonCommand);
            EditPersonCommand   = new RelayCommand <UiPerson>(ExecuteEditPersonCommand, CanExecuteEditPersonCommand);
            DeletePersonCommand = new RelayCommand <UiPerson>(ExecuteDeletePersonCommand, CanExecuteDeletePersonCommand);

            CreateShooterCommand = new RelayCommand <UiPerson>(ExecuteCreateShooterCommand, CanExecuteCreateShooterCommand);
            EditShooterCommand   = new RelayCommand <UiShooter>(ExecuteEditShooterCommand, CanExecuteEditShooterCommand);
            DeleteShooterCommand = new RelayCommand <UiShooter>(ExecuteDeleteShooterCommand, CanExecuteDeleteShooterCommand);

            CreateParticipationCommand = new RelayCommand <object>(ExecuteCreateParticipationCommand);
            //EditParticipationCommand = new RelayCommand<UiParticipation>
            //DeleteParticipationCommand = new RelayCommand<UiParticipation>

            PrintBarcodeCommand = new RelayCommand <UiShooter>(ExecutePrintBarcodeCommand, CanExecutePrintBarcodeCommand);
            EditPassCommand     = new RelayCommand <SessionDetails>(ExecuteEditPassCommand);
        }
Ejemplo n.º 9
0
    public MainViewModel()
    {
      if (DesignTimeHelper.IsInDesignMode)
      {
        _personDataStore = new FakePersonDataStore();
        _shooterDataStore = new FakeShooterDataStore();
        _participationDataStore = new FakeParticipationDataStore();
        _groupMemberDetailsView = new FakeGroupMemberDetailsView();
        _groupDetailsView = new FakeGroupDetailsView();
      }
      else
      {
        IConfiguration config = ConfigurationSource.Configuration;
        _personDataStore = config.GetPersonDataStore();
        _shooterDataStore = config.GetShooterDataStore();
        _participationDataStore = config.GetParticipationDataStore();
        _shooterParticipationDataStore = config.GetShooterParticipationDataStore();
        _groupMemberDetailsView = config.GetGroupMemberDetailsView();
        _shooterParticipationView = config.GetShooterParticipationView();
        _groupDetailsView = config.GetGroupDetailsView();
        _sessionDetailsView = config.GetSessionDetailsView();
        _shooterDataWriterService = config.GetSsvShooterDataWriterService();
        _collectionShooterDataStore = config.GetCollectionShooterDataStore();
        _shooterCollectionDataStore = config.GetShooterCollectionDataStore();
        _shooterCollectionParticipationDataStore = config.GetShooterCollectionParticipationDataStore();
        _shooterNumberService = config.GetShooterNumberService();
        _windowService = config.GetWindowService();
        _barcodePrintService = config.GetBarcodePrintService();
        _barcodeBuilderService = config.GetBarcodeBuilderService();
        _events = config.GetEvents();
        _uiEvents = config.GetUIEvents();
        _uiEvents.RequireSelectedPerson += () => _uiEvents.PersonSelected(SelectedUiPerson);
        _uiEvents.SelectPersonById += (id) => { SelectedUiPerson = UiPeople.FirstOrDefault(_ => _.PersonId == id); };
        _uiEvents.RequireSelectedShooter += () => _uiEvents.ShooterSelected(SelectedUiShooter);
        _uiEvents.FetchSelectedShooter += () => SelectedUiShooter;
        _uiEvents.PersonDataStoreChanged += LoadPersonList;
        _uiEvents.ShooterDataStoreChanged += LoadShooterList;
        _shooterNumberService.Configure(_shooterDataStore);

        LoadPersonList();
        LoadShooterList();
        LoadParticipationList();
      }

      CreatePersonCommand = new RelayCommand<object>(ExecuteCreatePersonCommand);
      EditPersonCommand = new RelayCommand<UiPerson>(ExecuteEditPersonCommand, CanExecuteEditPersonCommand);
      DeletePersonCommand = new RelayCommand<UiPerson>(ExecuteDeletePersonCommand, CanExecuteDeletePersonCommand);
      
      CreateShooterCommand = new RelayCommand<UiPerson>(ExecuteCreateShooterCommand, CanExecuteCreateShooterCommand);
      EditShooterCommand = new RelayCommand<UiShooter>(ExecuteEditShooterCommand, CanExecuteEditShooterCommand);
      DeleteShooterCommand = new RelayCommand<UiShooter>(ExecuteDeleteShooterCommand, CanExecuteDeleteShooterCommand);

      CreateParticipationCommand = new RelayCommand<object>(ExecuteCreateParticipationCommand);
      //EditParticipationCommand = new RelayCommand<UiParticipation>
      //DeleteParticipationCommand = new RelayCommand<UiParticipation>

      PrintBarcodeCommand = new RelayCommand<UiShooter>(ExecutePrintBarcodeCommand, CanExecutePrintBarcodeCommand);
      EditPassCommand = new RelayCommand<SessionDetails>(ExecuteEditPassCommand);
    }
Ejemplo n.º 10
0
        public TextBoxInputViewModel()
        {
            if (!DesignTimeHelper.IsInDesignMode)
            {
                IConfiguration config = ConfigurationSource.Configuration;
                _shooterCollectionDataStore = config.GetShooterCollectionDataStore();
                _shooterCollectionParticipationDataStore = config.GetShooterCollectionParticipationDataStore();
                _uiEvents      = config.GetUIEvents();
                _windowService = config.GetWindowService();
            }

            AddCommand    = new RelayCommand <string>(ExecuteAddCommand, CanExecuteAddCommand);
            CancelCommand = new RelayCommand <object>((_) => _windowService.CloseTextBoxInputDialog());
        }
    public TextBoxInputViewModel()
    {
      if (!DesignTimeHelper.IsInDesignMode)
      {
        IConfiguration config = ConfigurationSource.Configuration;
        _shooterCollectionDataStore = config.GetShooterCollectionDataStore();
        _shooterCollectionParticipationDataStore = config.GetShooterCollectionParticipationDataStore();
        _uiEvents = config.GetUIEvents();
        _windowService = config.GetWindowService();
      }

      AddCommand = new RelayCommand<string>(ExecuteAddCommand, CanExecuteAddCommand);
      CancelCommand = new RelayCommand<object>((_) => _windowService.CloseTextBoxInputDialog());
    }
    public static UiParticipation FetchShooters(this UiParticipation participation,
      IShooterCollectionParticipationDataStore shooterCollectionParticipationDataStore,
      IShooterCollectionDataStore shooterCollectionDataStore,
      ICollectionShooterDataStore collectionShooterDataStore,
      IShooterDataStore shooterDataStore,
      IPersonDataStore personDataStore)
    {
      participation.ShooterCollections = new List<UiShooterCollection>();
      List<ShooterCollectionParticipation> shooterCollectionParticipations =
        shooterCollectionParticipationDataStore.FindByIdParticipationId(participation.ParticipationId).ToList();
      List<ShooterCollection> shooterCollections = shooterCollectionParticipations.Select(_ => shooterCollectionDataStore.FindById(_.ShooterCollectionId)).ToList();

      foreach (ShooterCollection shooterCollection in shooterCollections)
      {
        List<CollectionShooter> collectionShooters =
          collectionShooterDataStore.FindByShooterCollectionId(shooterCollection.ShooterCollectionId).ToList();

        participation.ShooterCollections.Add(new UiShooterCollection
        {
          CollectionName = shooterCollection.CollectionName,
          ShooterCollectionId = shooterCollection.ShooterCollectionId,
          Shooters = collectionShooters.Select(_ => ToUiShooter(shooterDataStore.FindById(_.ShooterId)).FetchPerson(personDataStore))
        });
      }

      return participation;
    }